-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakefile
82 lines (63 loc) · 2.23 KB
/
makefile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# PROJECT: pickle, a TCL like interpreter
# LICENSE: BSD (see 'pickle.c' or 'LICENSE' file)
# SITE: https://github.com/howerj/pickle
#
# Might want to occasionally compile with "-fsanitize=undefined" to
# catch any undefined behavior.
#
VERSION = 0x050201ul
TARGET = pickle
CFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 -fwrapv ${DEFINES} ${EXTRA} -DPICKLE_VERSION="${VERSION}"
AR = ar
ARFLAGS = rcs
TRACE =
DESTDIR = install
.PHONY: all run test clean install dist profile
all: ${TARGET}
run: ${TARGET} shell
${TRACE} ./${TARGET} shell
test: ${TARGET} shell
${TRACE} ./${TARGET} shell -t
main.o: main.c ${TARGET}.h
${TARGET}.o: ${TARGET}.c ${TARGET}.h
lib${TARGET}.a: ${TARGET}.o
${AR} ${ARFLAGS} $@ $<
${TARGET}: main.o lib${TARGET}.a
${CC} ${CFLAGS} $^ -o $@
-strip ${TARGET}
${TARGET}.1: readme.md
pandoc -s -f markdown -t man $< -o $@
install: ${TARGET} lib${TARGET}.a ${TARGET}.1 .git
install -p -D ${TARGET} ${DESTDIR}/bin/${TARGET}
install -p -m 644 -D lib${TARGET}.a ${DESTDIR}/lib/lib${TARGET}.a
install -p -m 644 -D ${TARGET}.h ${DESTDIR}/include/${TARGET}.h
-install -p -m 644 -D ${TARGET}.1 ${DESTDIR}/man/${TARGET}.1
mkdir -p ${DESTDIR}/src
cp -a .git ${DESTDIR}/src
cd ${DESTDIR}/src && git reset --hard HEAD
dist: install
tar zcf ${TARGET}-${VERSION}.tgz ${DESTDIR}
check:
-scan-build make
-cppcheck --enable=all *.c
clean:
git clean -dffx
small: CFLAGS=-std=c99 -Os -DNDEBUG -Wall -Wextra -fwrapv -DPICKLE_VERSION="${VERSION}"
small: main.c ${TARGET}.c ${TARGET}.h
${CC} ${CFLAGS} main.c ${TARGET}.c -o $@
-strip $@
micro: CFLAGS=-DNDEBUG -DDEFINE_TESTS=0 -DDEFINE_MATHS=0 -DDEFINE_STRING=0 -DDEFINE_REGEX=0 -DDEFINE_LIST=0 -DPICKLE_VERSION="${VERSION}"
micro: CFLAGS+=-std=c99 -Os ${DEFINES} -Wall -Wextra -fwrapv
micro: main.c ${TARGET}.c ${TARGET}.h
${CC} ${CFLAGS} main.c ${TARGET}.c -o $@
-strip $@
fast: CFLAGS=-std=c99 -O3 -DNDEBUG -static -Wall -Wextra -DPICKLE_VERSION="${VERSION}"
fast: main.c ${TARGET}.c ${TARGET}.h
${CC} ${CFLAGS} main.c ${TARGET}.c -o $@
-strip $@
debug: CFLAGS=-std=c99 -g -Wall -Wextra -DPICKLE_VERSION="${VERSION}"
debug: main.c ${TARGET}.c ${TARGET}.h shell
${CC} ${CFLAGS} main.c ${TARGET}.c -o $@
profile: debug shell
valgrind --tool=callgrind ./debug shell -t
kcachegrind