about summary refs log tree commit diff stats
path: root/Makefile
blob: 731570a1263cfea90daf70df9db5b8625d2d6e84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
CFLAGS+=-Wall -Wextra -Wpedantic -std=c11 -D_DEFAULT_SOURCE
ALL:=mkgpt
PREFIX:=/usr/local

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: LDFLAGS+=-static
static: prod

musl-static: CC:=musl-gcc
musl-static: static

mkgpt: mkgpt.o crc32.o fstypes.o guid.o

mkgpt.o: mkgpt.c guid.h fstypes.h part.h crc32.h
fstypes.o: fstypes.c fstypes.h guid.h
guid.o: guid.c guid.h
crc32.o: crc32.c crc32.h

.PHONY: check clean format install uninstall
check:
	-cppcheck --enable=all --inconclusive --std=c11 .
	-shellcheck *.sh
clean:
	$(RM) *.o $(ALL)
format:
	-clang-format -verbose -i *.[ch]
install: prod
	mkdir -pv $(DESTDIR)$(PREFIX)/bin
	cp -fv mkgpt $(DESTDIR)$(PREFIX)/bin
uninstall:
	rm -fv $(DESTDIR)$(PREFIX)/bin/mkgpt