examples

Toy examples in single C files.
git clone git://henryandlizzy.uk/examples
Log | Files | Refs

commit 94a2185f3e15a7e6a3b0abed8baca35d5b959d41
parent b23dfab9bb09f383d02f1779393b7e1cd95bd8a9
Author: Henry Wilson <henry@henryandlizzy.uk>
Date:   Mon,  6 Feb 2023 22:32:32 +0000

makefile: Move output executables into bin/

Diffstat:
M.gitignore | 42+-----------------------------------------
MTupfile | 4++--
Mmakefile | 29+++++++++++++++++++----------
3 files changed, 22 insertions(+), 53 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -3,44 +3,4 @@ ##### Do not edit. .tup /.gitignore -/aio -/alsa-simple -/arena-tree -/atexit -/bit_cast -/cat -/cie-1931 -/clock-test -/cobs -/coro-poll -/coro-round-robin -/coro-throwing -/coro-timer-dispatch -/coro-unconditional-dispatch -/crc-table -/crc7 -/dsp -/elastic-tabstops -/enviro -/epoll -/eventfd -/flat-set -/gl-asteroids -/glob -/guess-number -/hush -/io_uring -/list-composition -/mmallocator -/model -/morse -/mutex_container -/owning_ptr -/pulse-async-client -/pulse-simple-client -/regex -/sorts -/sudoku -/token-threaded-forth -/triple-buf -/whichtty +/bin diff --git a/Tupfile b/Tupfile @@ -10,7 +10,7 @@ LDLIBS_pulse-async-client = -lpulse LDLIBS_pulse-simple-client = -lpulse-simple -lm LDLIBS_alsa-simple = -lasound -: foreach src/*.c |> cc $(CFLAGS) -o %o %f $(LDLIBS_%B) |> %B -: foreach src/*.cpp |> c++ $(CXXFLAGS) -o %o %f $(LDLIBS_%B) |> %B +: foreach src/*.c |> cc $(CFLAGS) -o %o %f $(LDLIBS_%B) |> bin/%B +: foreach src/*.cpp |> c++ $(CXXFLAGS) -o %o %f $(LDLIBS_%B) |> bin/%B .gitignore diff --git a/makefile b/makefile @@ -6,8 +6,8 @@ CXXFLAGS := -std=c++20 $(COMMON_FLAGS) c_sources := $(wildcard src/*.c) cpp_sources := $(wildcard src/*.cpp) -c_targets := $(notdir $(basename $(c_sources))) -cpp_targets := $(notdir $(basename $(cpp_sources))) +c_targets := $(addprefix bin/,$(notdir $(basename $(c_sources)))) +cpp_targets := $(addprefix bin/,$(notdir $(basename $(cpp_sources)))) VPATH := src @@ -17,14 +17,23 @@ all-c: $(c_targets) all-c++: $(cpp_targets) clean: - $(RM) $(c_targets) $(cpp_targets) - -aio: -lrt -gl-asteroids: -lglfw -lGL -lm -lasound -io_uring: -luring -pulse-async-client: -lpulse -pulse-simple-client: -lpulse-simple -lm -alsa-simple: -lasound + $(RM) -r $(c_targets) $(cpp_targets) bin/ + +bin/aio: -lrt +bin/gl-asteroids: -lglfw -lGL -lm -lasound +bin/io_uring: -luring +bin/pulse-async-client: -lpulse +bin/pulse-simple-client: -lpulse-simple -lm +bin/alsa-simple: -lasound + +bin/: + mkdir -p $@ + +bin/%: %.c | bin/ + $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +bin/%: %.cpp | bin/ + $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@ wait: inotifywait -qe close_write makefile src