2024-12-05 20:22:19 +00:00
|
|
|
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 $@
|
|
|
|
|
2024-12-05 21:01:27 +00:00
|
|
|
out/%.txt: in/%.txt bin/%
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
<$< bin/$* >$@
|
|
|
|
|
2024-12-05 20:22:19 +00:00
|
|
|
clean:
|
|
|
|
rm -rf bin
|