STDLIB_HEADERS := $(wildcard stdlib/include/*) STDLIB_SOURCES := $(wildcard stdlib/src/*) TARGETS := $(patsubst src/%.c,bin/%,$(wildcard src/*.c)) CFLAGS := -O2 -nostdlib -Istdlib/include -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-builtin -std=c99 -pedantic -Wall -Werror -fno-stack-protector -static -Wl,-n .PHONY: all clean all: $(TARGETS) bin/%: src/%.c $(STDLIB_SOURCES) $(STDLIB_HEADERS) @mkdir -p $(@D) gcc $(CFLAGS) $< $(STDLIB_SOURCES) -o $@ strip -R .comment $@ out/%.txt: in/%.txt bin/% @mkdir -p $(@D) <$< bin/$* >$@ clean: rm -rf bin