-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile.BSD
53 lines (47 loc) · 1.65 KB
/
Makefile.BSD
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
PKG= bsdec2-image-upload
PROGS= bsdec2-image-upload
TESTS=
SUBST_VERSION_FILES= bsdec2-image-upload/main.c
PUBLISH= ${PROGS} COPYRIGHT SETUP Makefile libcperciva lib
### Shared code between Tarsnap projects.
# These definitions improve the readability of the below material.
MAKEBSD:= ${MAKE} -f Makefile.BSD
RELEASEDATE!= date "+%B %d, %Y"
RELEASEISODATE!= date "+%F"
CFLAGS_HARDCODED= -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DCPUSUPPORT_CONFIG_FILE=\\\"cpusupport-config.h\\\"
# This creates (and deletes) a fake cpusupport-config.h that is
# blank (and thus does not require any special CFLAGS to compile).
.for D in ${PROGS} ${TESTS}
${D}/Makefile::
CPP="${CPP}" ./release-tools/metabuild.sh \
"${D}" "${MAKEBSD}" "${CFLAGS_HARDCODED}"
.endfor
Makefiles:
.for D in ${PROGS} ${TESTS}
${MAKEBSD} ${D}/Makefile
.endfor
# This uses temporary files for sed because the FreeBSD and GNU
# behaviour of sed -i is different.
publish: clean Makefiles
if [ -z "${VERSION}" ]; then \
echo "VERSION must be specified!"; \
exit 1; \
fi
if find . | grep \~; then \
echo "Delete temporary files before publishing!"; \
exit 1; \
fi
rm -f ${PKG}-${VERSION}.tgz
mkdir ${PKG}-${VERSION}
tar -cf- --exclude 'Makefile.*' ${PUBLISH} | \
tar -xf- -C ${PKG}-${VERSION}
.for F in ${SUBST_VERSION_FILES}
sed -e 's/@VERSION@/${VERSION}/' -e 's/@DATE@/${RELEASEDATE}/' \
-e 's/@ISODATE@/${RELEASEISODATE}/' \
< ${PKG}-${VERSION}/${F} > ${PKG}-${VERSION}/${F}.tmp
mv ${PKG}-${VERSION}/${F}.tmp ${PKG}-${VERSION}/${F}
.endfor
tar -cvzf ${PKG}-${VERSION}.tgz ${PKG}-${VERSION}
rm -r ${PKG}-${VERSION}
SUBDIR= ${PROGS}
.include <bsd.subdir.mk>