-
Notifications
You must be signed in to change notification settings - Fork 63
/
Makefile
141 lines (124 loc) · 5.4 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Top level Makefile for CCNx
#
# Part of the CCNx distribution.
#
# Copyright (C) 2009-2014 Palo Alto Research Center, Inc.
#
# This work is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Free Software Foundation.
# This work is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.
#
# Subdirectories we build in
TOPSUBDIRS = csrc schema `cat local.subdirs 2>/dev/null || :`
# Packing list for packaging
PACKLIST = Makefile README LICENSE NEWS NOTICES configure doc/index.txt \
doc/technical doc/manpages schema android experiments csrc javasrc apps
# Default target:
default:
# If csrc/conf.mk is missing or old, we need to run configure.
csrc/conf.mk: csrc/configure csrc/Makefile javasrc/Makefile apps/Makefile
./configure
SUBMAKE = $(MAKE) -f ../csrc/conf.mk -f Makefile
IBINSTALL = $(SUBMAKE) install \
DINST_BIN=$$ib/bin DINST_INC=$$ib/include DINST_LIB=$$ib/lib
default all: csrc/conf.mk _always
for i in $(TOPSUBDIRS); do \
(cd "$$i" && pwd && $(SUBMAKE) $@) || exit 1; \
done
for i in doc/technical doc/manpages javasrc apps; do \
(cd "$$i" && pwd && $(MAKE) $@) || exit 1; \
done
mkdir -p ./lib ./bin
test -d ./include || ln -s ./csrc/include
ib=`pwd` && (cd csrc && $(IBINSTALL))
ib=`pwd` && (cd javasrc && $(IBINSTALL))
ib=`pwd` && (cd apps && $(IBINSTALL))
clean depend test check shared testinstall install uninstall html: csrc/conf.mk _always
for i in $(TOPSUBDIRS) javasrc apps; do \
(cd "$$i" && pwd && $(SUBMAKE) $@) || exit 1; \
done
@rm -f _always
documentation dist-docs : _always
for i in $(TOPSUBDIRS) doc/technical doc/manpages javasrc apps android; do \
(cd "$$i" && pwd && $(MAKE) $@) || exit 1; \
done
@rm -f _always
clean-documentation: csrc/conf.mk _always
rm -rf doc/ccode
rm -rf doc/javacode
rm -rf doc/android
(cd doc && pwd && $(MAKE) clean-documentation)
clean: clean-testinstall
clean-testinstall: _always
rm -rf bin include lib
# The rest of this is for packaging purposes.
_manifester:
rm -f _manifester
test -d .svn && { type svn >/dev/null 2>/dev/null; } && ( echo svn list -R $(PACKLIST) > _manifester; ) || :
test -f _manifester || ( git branch >/dev/null 2>/dev/null && echo git ls-files $(PACKLIST) > _manifester; ) || :
test -f _manifester || ( test -f MANIFEST && echo cat MANIFEST > _manifester ) || :
test -f _manifester || ( test -f 00MANIFEST && echo cat 00MANIFEST > _manifester ) || :
test -f _manifester || ( echo false > _manifester )
MANIFEST: _manifester
echo MANIFEST > MANIFEST.new
@cat _manifester
sh _manifester | grep -v -e '/$$' -e '^MANIFEST$$' -e '[.]gitignore' >> MANIFEST.new
sort MANIFEST.new | uniq > MANIFEST
rm MANIFEST.new
rm _manifester
tar: ccnx.tar
ccnx.tar: MANIFEST
tar cf ccnx.tar -T MANIFEST
mv MANIFEST 00MANIFEST
distfile: tar
echo $(VERSION) > version
# make sure VERSION= has been provided
grep '^[0-9]....' version
# check the Doxyfiles for good version information
# fail on the next step if the directory already exists
mkdir ccnx-$(VERSION)
( cd ccnx-$(VERSION) && tar xf ../ccnx.tar && $(MAKE) fixupversions VERSION=$(VERSION) && $(MAKE) MD5 SHA1 )
: > ccnx-$(VERSION)/csrc/conf.mk
# Build the documentation
( cd ccnx-$(VERSION) && $(MAKE) dist-docs 2>&1) > ccnx-$(VERSION)-documentation.log
rm ccnx-$(VERSION)/csrc/conf.mk
tar cf ccnx-$(VERSION).tar ccnx-$(VERSION)
gzip -9 ccnx-$(VERSION).tar
ls -l ccnx-$(VERSION).tar.gz
fixupversions: _always
Fix1 () { sed -e '/^PROJECT_NUMBER/s/=.*$$/= $(VERSION)/' $$1 > DTemp && mv DTemp $$1; } && Fix1 csrc/Doxyfile && Fix1 csrc/Doxyfile.dist && Fix1 csrc/Doxyfile.latex && Fix1 javasrc/Doxyfile && Fix1 javasrc/Doxyfile.dist && Fix1 javasrc/Doxyfile.latex && Fix1 doc/manpages/Makefile && Fix1 android/Doxyfile && cp android/CCNx-Android-Services/strings.xml.tpl android/CCNx-Android-Services/res/values/strings.xml && sed -e "s/PROJECT_NUMBER/$(VERSION)/g" android/CCNx-Android-Services/strings.xml.tpl > android/CCNx-Android-Services/res/values/strings.xml && Fix1 android/Doxyfile.dist && Fix1 android/Doxyfile.latex
IGNORELINKS = -e android/CCNx-Android-Services/jni/csrc -e android/CCNx-Android-Services/jni/openssl/openssl-armv5
MD5: _always
grep -v $(IGNORELINKS) MANIFEST | xargs openssl dgst > MD5
SHA1: _always
grep -v $(IGNORELINKS) MANIFEST | xargs openssl dgst -sha1 > SHA1
pkgbin: default
echo $(VERSION) > version
# make sure VERSION= has been provided
grep '^[0-9]....' version
mkdir -p ccnx-pkg-$(VERSION)
mkdir -p ccnx-pkg-$(VERSION)/lib
mkdir -p ccnx-pkg-$(VERSION)/include
mkdir -p ccnx-pkg-$(VERSION)/bin
mkdir -p ccnx-pkg-$(VERSION)/man/man1
mkdir -p ccnx-pkg-$(VERSION)/etc
mkdir -p ccnx-pkg-$(VERSION)/doc
$(MAKE) dist-docs
cp -r doc/ccode ccnx-pkg-$(VERSION)/doc
cp -r doc/javacode ccnx-pkg-$(VERSION)/doc
cp -r doc/manpages ccnx-pkg-$(VERSION)/doc
cp -r doc/technical ccnx-pkg-$(VERSION)/doc
cp -r doc/android ccnx-pkg-$(VERSION)/doc
cp doc/index.html ccnx-pkg-$(VERSION)/doc
cp LICENSE ccnx-pkg-$(VERSION)
cp NEWS ccnx-pkg-$(VERSION)
mv ccnx-pkg-$(VERSION)/doc/manpages/*.1 ccnx-pkg-$(VERSION)/man/man1
$(MAKE) install INSTALL_BASE= DESTDIR=`pwd`/ccnx-pkg-$(VERSION)
tar cf ccnx-pkg-$(VERSION).tar ccnx-pkg-$(VERSION)
gzip -9 ccnx-pkg-$(VERSION).tar
ls -l ccnx-pkg-$(VERSION).tar.gz
_always:
.PHONY: _always