about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8a8d04d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+CFLAGS:=-Wall -Wextra -Wpedantic -std=c11
+ALL:=mkgpt
+
+dev: CFLAGS+=-g3 -Og -fsanitize=address -fsanitize=undefined
+dev: LDFLAGS+=-fsanitize=address -fsanitize=undefined
+dev: $(ALL)
+
+prod: CFLAGS+=-g0 -Os
+prod: LDFLAGS+=-s
+prod: $(ALL)
+
+static: CC:=musl-gcc
+static: CFLAGS+=-g0 -Os
+static: LDFLAGS+=-static -s
+static: $(ALL)
+
+mkgpt: mkgpt.o crc32.o fstypes.o guid.o
+
+mkgpt.o: mkgpt.c guid.h fstypes.h part.h
+fstypes.o: fstypes.c fstypes.h guid.h
+guid.o: guid.c guid.h
+crc32.o: crc32.c
+
+.PHONY: check clean format
+check:
+	cppcheck --enable=all --inconclusive --std=c11 .
+clean:
+	$(RM) *.o $(ALL)
+format:
+	clang-format -verbose -i *.[ch]