|
1 # |
|
2 # Copyright 2004-2006 Intel Corporation |
|
3 # |
|
4 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 # you may not use this file except in compliance with the License. |
|
6 # You may obtain a copy of the License at |
|
7 # |
|
8 # http://www.apache.org/licenses/LICENSE-2.0 |
|
9 # |
|
10 # Unless required by applicable law or agreed to in writing, software |
|
11 # distributed under the License is distributed on an "AS IS" BASIS, |
|
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 # See the License for the specific language governing permissions and |
|
14 # limitations under the License. |
|
15 # |
|
16 |
|
17 # |
|
18 # Top level makefile for DTN2. |
|
19 # |
|
20 |
|
21 # |
|
22 # Define a set of dispatch rules that simply call make on the |
|
23 # constituent subdirectories. Note that the test directory isn't built |
|
24 # by default. |
|
25 # |
|
26 |
|
27 SUBDIRS := applib servlib daemon apps sim |
|
28 |
|
29 all: checkconfigure $(SUBDIRS) |
|
30 |
|
31 # |
|
32 # If srcdir/builddir aren't set by some other makefile, |
|
33 # then default to . |
|
34 # |
|
35 ifeq ($(SRCDIR),) |
|
36 SRCDIR := . |
|
37 BUILDDIR := . |
|
38 endif |
|
39 |
|
40 # |
|
41 # Include the common rules |
|
42 # |
|
43 include Rules.make |
|
44 include $(SRCDIR)/dtn-version.mk |
|
45 |
|
46 # |
|
47 # Dependency rules between subdirectories needed for make -j |
|
48 # |
|
49 applib servlib: dtn-version.o |
|
50 daemon: applib servlib |
|
51 apps: applib servlib |
|
52 sim: servlib |
|
53 |
|
54 # |
|
55 # Rules for the version files |
|
56 # |
|
57 dtn-version.o: dtn-version.c |
|
58 dtn-version.c: dtn-version.h |
|
59 dtn-version.h: dtn-version.h.in dtn-version.dat |
|
60 $(OASYS_ETCDIR)/tools/subst-version $(SRCDIR)/dtn-version.dat \ |
|
61 < $(SRCDIR)/dtn-version.h.in > dtn-version.h |
|
62 |
|
63 vpath dtn-version.h.in $(SRCDIR) |
|
64 vpath dtn-version.h $(SRCDIR) |
|
65 vpath dtn-version.c $(SRCDIR) |
|
66 vpath dtn-version.dat $(SRCDIR) |
|
67 |
|
68 bump-version: |
|
69 cd $(SRCDIR) && tools/bump-version dtn-version.dat |
|
70 |
|
71 # |
|
72 # Test rules |
|
73 # |
|
74 test: tests |
|
75 tests: |
|
76 $(MAKE) all |
|
77 $(MAKE) -C test |
|
78 |
|
79 dtn-tests: |
|
80 $(MAKE) -C test |
|
81 |
|
82 # |
|
83 # Installation rules |
|
84 # |
|
85 install: installdirs installbin installlib installetc |
|
86 |
|
87 installdirs: |
|
88 for dir in $(DESTDIR)$(localstatedir)/dtn \ |
|
89 $(DESTDIR)$(localstatedir)/dtn/bundles \ |
|
90 $(DESTDIR)$(localstatedir)/dtn/db ; do \ |
|
91 (mkdir -p $$dir; chmod 755 $$dir; \ |
|
92 [ x$(DTN_USER) = x ] || chown $(DTN_USER) $$dir); \ |
|
93 done |
|
94 |
|
95 [ -d $(DESTDIR)$(bindir) ] || \ |
|
96 (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir)) |
|
97 |
|
98 [ -d $(DESTDIR)$(libdir) ] || \ |
|
99 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) |
|
100 |
|
101 installbin: installdirs |
|
102 for prog in daemon/dtnd \ |
|
103 tools/dtnd-control \ |
|
104 apps/dtncat/dtncat \ |
|
105 apps/dtncp/dtncp \ |
|
106 apps/dtncpd/dtncpd \ |
|
107 apps/dtnhttpproxy/dtnhttpproxy \ |
|
108 apps/dtnperf/dtnperf-client \ |
|
109 apps/dtnperf/dtnperf-server \ |
|
110 apps/dtnping/dtnping \ |
|
111 apps/dtnping/dtntraceroute \ |
|
112 apps/dtnrecv/dtnrecv \ |
|
113 apps/dtnsend/dtnsend \ |
|
114 apps/dtntunnel/dtntunnel \ |
|
115 apps/num2sdnv/num2sdnv \ |
|
116 apps/num2sdnv/sdnv2num ; do \ |
|
117 ($(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir)) ; \ |
|
118 done |
|
119 |
|
120 [ x$(DTN_USER) = x ] || chown -R $(DTN_USER) $(DESTDIR)$(bindir) |
|
121 |
|
122 installlib: installdirs |
|
123 [ x$(SHLIBS) = x ] || \ |
|
124 for lib in applib/libdtnapi-$(DTN_VERSION).$(SHLIB_EXT) \ |
|
125 applib/libdtnapi++-$(DTN_VERSION).$(SHLIB_EXT) \ |
|
126 applib/tcl/libdtntcl-$(DTN_VERSION).$(SHLIB_EXT) ; do \ |
|
127 ($(INSTALL_PROGRAM) $$lib $(DESTDIR)$(libdir)) ; \ |
|
128 done |
|
129 |
|
130 for lib in libdtnapi libdtnapi++ libdtntcl ; do \ |
|
131 (cd $(DESTDIR)$(libdir) && rm -f $$lib.$(SHLIB_EXT) && \ |
|
132 ln -s $$lib-$(DTN_VERSION).$(SHLIB_EXT) $$lib.$(SHLIB_EXT)) \ |
|
133 done |
|
134 |
|
135 installetc: installdirs |
|
136 [ -d $(DESTDIR)$(sysconfdir) ] || mkdir -p $(DESTDIR)$(sysconfdir) |
|
137 if [ -f $(DESTDIR)$(sysconfdir)/dtn.conf ]; then \ |
|
138 echo "WARNING: $(DESTDIR)$(sysconfdir)/dtn.conf exists -- not overwriting"; \ |
|
139 else \ |
|
140 $(INSTALL_DATA) daemon/dtn.conf $(DESTDIR)$(sysconfdir)/dtn.conf; \ |
|
141 fi |
|
142 |
|
143 $(INSTALL_DATA) servlib/routing/router.xsd $(DESTDIR)$(sysconfdir)/router.xsd |
|
144 $(INSTALL_DATA) servlib/conv_layers/clevent.xsd $(DESTDIR)$(sysconfdir)/clevent.xsd |
|
145 |
|
146 # |
|
147 # Generate the doxygen documentation |
|
148 # |
|
149 doxygen: |
|
150 doxygen doc/doxyfile |
|
151 |
|
152 # |
|
153 # Generate XML schema documentation |
|
154 # Requires: |
|
155 # xsddoc-1.0 (http://xframe.sourceforge.net/xsddoc/) |
|
156 # java |
|
157 # |
|
158 xsddoc: |
|
159 mkdir -p doc/router-xsddoc |
|
160 xsddoc -t "External Router Interface" -o doc/router-xsddoc -q \ |
|
161 servlib/routing/router.xsd |
|
162 mkdir -p doc/cla-xsddoc |
|
163 xsddoc -t "External CLA Interface" -o doc/cla-xsddoc -q \ |
|
164 servlib/conv_layers/clevent.xsd |
|
165 # mkdir -p doc/router-xsddoc |
|
166 # xsddoc -t "External Data Store Interface" -o doc/ds-xsddoc -q \ |
|
167 # oasys/storage/DS.xsd |
|
168 |
|
169 xsdbindings: |
|
170 $(MAKE) -C servlib xsdbindings |
|
171 |
|
172 # |
|
173 # Build a TAGS database. Note this includes all the sources so it gets |
|
174 # header files as well. |
|
175 # |
|
176 .PHONY: TAGS tags |
|
177 tags TAGS: |
|
178 cd $(SRCDIR) && \ |
|
179 find . -name \*.h -or -name \*.c -or -name \*.cc | \ |
|
180 xargs etags -l c++ |
|
181 find . -name \*.h -or -name \*.c -or -name \*.cc | \ |
|
182 xargs ctags |
|
183 |
|
184 # |
|
185 # And a rule to make sure that configure has been run recently enough. |
|
186 # |
|
187 .PHONY: checkconfigure |
|
188 checkconfigure: Rules.make |
|
189 |
|
190 Rules.make: $(SRCDIR)/configure $(OASYS_ETCDIR)/Rules.make.in |
|
191 @[ ! x`echo "$(MAKECMDGOALS)" | grep clean` = x ] || \ |
|
192 (echo "$@ is out of date, need to rerun configure" && \ |
|
193 exit 1) |
|
194 |
|
195 $(SRCDIR)/configure $(OASYS_ETCDIR)/Rules.make.in: |
|
196 @echo SRCDIR: $(SRCDIR) |
|
197 @echo error -- Makefile did not set SRCDIR properly |
|
198 @exit 1 |
|
199 |
|
200 CFGDIRS := oasys/include oasys |
|
201 CFGFILES = Rules.make System.make oasys/share oasys/lib oasys/include/oasys |
|
202 GENFILES = doc/manual/man/*.txt |