aboutsummaryrefslogtreecommitdiff
path: root/utils/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'utils/Makefile')
-rw-r--r--utils/Makefile30
1 files changed, 30 insertions, 0 deletions
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)