-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
91 lines (78 loc) · 2.32 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
82
83
84
85
86
87
88
89
90
91
.POSIX:
PROGS= imds-filterd imds-proxy
TESTS=
BINDIR_DEFAULT= /usr/local/sbin
CFLAGS_DEFAULT= -O2
LIBCPERCIVA_DIR= libcperciva
TEST_CMD= true
### Shared code between Tarsnap projects.
all: cflags-filter.sh cpusupport-config.h posix-flags.sh
export CFLAGS="$${CFLAGS:-${CFLAGS_DEFAULT}}"; \
. ./posix-flags.sh; \
. ./cpusupport-config.h; \
. ./cflags-filter.sh; \
export HAVE_BUILD_FLAGS=1; \
for D in ${PROGS} ${TESTS}; do \
( cd $${D} && ${MAKE} all ) || exit 2; \
done
# For "loop-back" building of a subdirectory
buildsubdir: cflags-filter.sh cpusupport-config.h posix-flags.sh
. ./posix-flags.sh; \
. ./cpusupport-config.h; \
. ./cflags-filter.sh; \
export HAVE_BUILD_FLAGS=1; \
cd ${BUILD_SUBDIR} && ${MAKE} ${BUILD_TARGET}
posix-flags.sh:
if [ -d ${LIBCPERCIVA_DIR}/POSIX/ ]; then \
export CC="${CC}"; \
cd ${LIBCPERCIVA_DIR}/POSIX; \
printf "export \"LDADD_POSIX="; \
command -p sh posix-l.sh "$$PATH"; \
printf "\"\n"; \
printf "export \"CFLAGS_POSIX="; \
command -p sh posix-cflags.sh "$$PATH"; \
printf "\"\n"; \
fi > $@
if [ ! -s $@ ]; then \
printf "#define POSIX_COMPATIBILITY_NOT_CHECKED 1\n"; \
fi >> $@
cflags-filter.sh:
if [ -d ${LIBCPERCIVA_DIR}/POSIX/ ]; then \
export CC="${CC}"; \
cd ${LIBCPERCIVA_DIR}/POSIX; \
command -p sh posix-cflags-filter.sh "$$PATH"; \
fi > $@
if [ ! -s $@ ]; then \
printf "# Compiler understands normal flags; "; \
printf "nothing to filter out\n"; \
fi >> $@
cpusupport-config.h:
if [ -d ${LIBCPERCIVA_DIR}/cpusupport/ ]; then \
export CC="${CC}"; \
command -p sh \
${LIBCPERCIVA_DIR}/cpusupport/Build/cpusupport.sh \
"$$PATH"; \
fi > $@
if [ ! -s $@ ]; then \
printf "#define CPUSUPPORT_NONE 1\n"; \
fi >> $@
install: all
export BINDIR=$${BINDIR:-${BINDIR_DEFAULT}}; \
for D in ${PROGS}; do \
( cd $${D} && ${MAKE} install ) || exit 2; \
done
clean:
rm -f cflags-filter.sh cpusupport-config.h posix-flags.sh
for D in ${PROGS} ${TESTS}; do \
( cd $${D} && ${MAKE} clean ) || exit 2; \
done
.PHONY: test test-clean
test: all
${TEST_CMD}
test-clean:
rm -rf tests-output/ tests-valgrind/
# Developer targets: These only work with BSD make
Makefiles:
${MAKE} -f Makefile.BSD Makefiles
publish:
${MAKE} -f Makefile.BSD publish