From f472887ca69ca82c31f97dfac8f84a3d841564b0 Mon Sep 17 00:00:00 2001 From: Mango0x45 Date: Mon, 18 Jan 2021 22:51:35 +0100 Subject: Add Makefile --- utils/Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 utils/Makefile diff --git a/utils/Makefile b/utils/Makefile new file mode 100644 index 0000000..bfd55de --- /dev/null +++ b/utils/Makefile @@ -0,0 +1,30 @@ +target := math +objs := math.o + +CC := gcc +CFLAGS := -O3 -std=c99 -pedantic -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-result + +all: $(target) + +### +# Automatic dependency tracking +# +deps := $(patsubst %.o,%.d,$(objs)) +-include $(deps) +DEPFLAGS = -MMD -MF $(@:.o=.d) + +### +# Compile the program +# +$(target): $(objs) + $(CC) $(CFLAGS) -o $@ $^ + +%.o: src/%.c + $(CC) $(CFLAGS) -c $< $(DEPFLAGS) + +### +# Phony targets +# +.PHONY: clean +clean: + rm -f $(target) $(objs) $(deps) -- cgit v1.2.3