examples

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

commit 81d627024d28dfe28d0d2d6896eb64e4a3b4e91a
parent 37684c738d6677744ccc7db1b996c3f582c18b14
Author: Henry Wilson <henry@henryandlizzy.uk>
Date:   Thu, 25 Apr 2024 23:21:08 +0100

build: Add generated build.sh for Tup-less hosts

Diffstat:
Abuild.sh | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dmakefile | 42------------------------------------------
2 files changed, 61 insertions(+), 42 deletions(-)

diff --git a/build.sh b/build.sh @@ -0,0 +1,61 @@ +#! /bin/sh -e +# This file is automatically generated with: tup generate build.sh +export tup_vardict="$(cd $(dirname $0) && pwd)/tup-generate.vardict" +mkdir -p "bin" +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/aio src/aio.c -lrt) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/alsa-simple src/alsa-simple.c -lasound) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/cat src/cat.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/clock-test src/clock-test.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/cobs src/cobs.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/crc-table src/crc-table.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/damm-checksum src/damm-checksum.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/dsp src/dsp.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/enviro src/enviro.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/epoll src/epoll.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/eventfd src/eventfd.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/gl-3d src/gl-3d.c -lglfw -lGL -lm) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/gl-lighting src/gl-lighting.c -lglfw -lGL -lm) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/gl src/gl.c -lglfw -lGL -lm) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/glob src/glob.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/guess-number src/guess-number.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/morse src/morse.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/mremap src/mremap.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/pulse-simple-client src/pulse-simple-client.c -lpulse-simple -lm) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/regex src/regex.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/sudoku src/sudoku.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/whichtty src/whichtty.c ) +(cc -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/xor-linked-list src/xor-linked-list.c ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/arena-tree src/arena-tree.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/atexit src/atexit.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/barrier src/barrier.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/bit_cast src/bit_cast.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/cie-1931 src/cie-1931.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-generator-consumer src/coro-generator-consumer.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-generator2 src/coro-generator2.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-poll src/coro-poll.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-round-robin src/coro-round-robin.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-state-machine src/coro-state-machine.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-throwing src/coro-throwing.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-timer-dispatch src/coro-timer-dispatch.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/coro-unconditional-dispatch src/coro-unconditional-dispatch.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/crc7 src/crc7.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/dimensions src/dimensions.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/elastic-tabstops src/elastic-tabstops.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/flat-set src/flat-set.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/gl-asteroids src/gl-asteroids.cpp -lglfw -lGL -lm -lasound) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/hush src/hush.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/io_uring src/io_uring.cpp -luring) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/list-composition src/list-composition.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/mmallocator src/mmallocator.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/model src/model.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/mutex_container src/mutex_container.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/owning_ptr src/owning_ptr.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/pulse-async-client src/pulse-async-client.cpp -lpulse) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/sdl src/sdl.cpp -lSDL2) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/sorts src/sorts.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/sqlite-saveload src/sqlite-saveload.cpp -lsqlite3) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/template_specialisation src/template_specialisation.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/token-threaded-forth src/token-threaded-forth.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/treeify src/treeify.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/triple-buf src/triple-buf.cpp ) +(c++ -std=c++20 -Wall -Wextra -Werror -fdiagnostics-color=always -fsanitize=undefined,address -o bin/type-erased-unique_ptr src/type-erased-unique_ptr.cpp ) diff --git a/makefile b/makefile @@ -1,42 +0,0 @@ -WARNINGS := -Wall -Wextra -Werror -COMMON_FLAGS := $(WARNINGS) -fdiagnostics-color=always -fsanitize=undefined,address -CFLAGS := $(COMMON_FLAGS) -CXXFLAGS := -std=c++20 $(COMMON_FLAGS) - -c_sources := $(wildcard src/*.c) -cpp_sources := $(wildcard src/*.cpp) - -c_targets := $(addprefix bin/,$(notdir $(basename $(c_sources)))) -cpp_targets := $(addprefix bin/,$(notdir $(basename $(cpp_sources)))) - -VPATH := src - -all: all-c all-c++ - -all-c: $(c_targets) -all-c++: $(cpp_targets) - -clean: - $(RM) -r $(c_targets) $(cpp_targets) bin/ - -bin/aio: -lrt -bin/alsa-simple: -lasound -bin/gl-asteroids: -lglfw -lGL -lm -lasound -bin/io_uring: -luring -bin/pulse-async-client: -lpulse -bin/pulse-simple-client: -lpulse-simple -lm -bin/sqlite-saveload: -lsqlite3 - -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 - -.PHONY: clean all all-c all-c++ wait