blob: 6d5c56f2f4cc961ea1a99b456ec2655aa2b22fa1 (
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
39
40
41
42
43
44
45
46
47
48
49
|
.POSIX:
CC?=cc # GNU make .POSIX fix
SHELL=/bin/sh # paranoia
.PHONY: prod static dev sane check clean depend format install uninstall
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
CFLAGS+=-Wall -Wextra -Wpedantic -std=c11 -D_DEFAULT_SOURCE #-D_FORTIFY_SOURCE=2
LDFLAGS+=
OBJS=mkgpt.o crc32.o guid.o part_ids.o
mkgpt: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
# use "make depend" to generate a new one
-include deps.mk
# different ways to build
prod:
CFLAGS="-g0 -Os" LDFLAGS="-s" $(MAKE) mkgpt
static:
CFLAGS="-g0 -Os" LDFLAGS="-s -static" $(MAKE) mkgpt
dev:
CFLAGS="-g3 -Og" $(MAKE) mkgpt
sane:
CFLAGS="-g3 -Og -fsanitize=address -fsanitize=undefined" \
LDFLAGS="-fsanitize=address -fsanitize=undefined" \
$(MAKE) mkgpt
check:
-cppcheck --enable=all --inconclusive --std=c11 .
-shellcheck *.sh
clean:
rm -fv $(OBJS) mkgpt
depend:
$(CC) -MM *.c >deps.mk
format:
-clang-format -verbose -i *.[ch]
PREFIX=/usr/local
install:
mkdir -pv $(DESTDIR)$(PREFIX)/bin
cp -fv mkgpt $(DESTDIR)$(PREFIX)/bin
uninstall:
rm -fv $(DESTDIR)$(PREFIX)/bin/mkgpt
|