aoc2024/Makefile
2024-12-05 21:22:19 +01:00

19 lines
512 B
Makefile

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 $@
clean:
rm -rf bin