root/branches/Dirk_CPtr/Common/commonTopLevel.mk

Revision 2, 19.1 kB (checked in by vossg, 2 years ago)

created : basic import

  • Property svn:eol-style set to native
Line 
1
2 .SUFFIXES:      .src .prj
3
4 SUB_JOB := admin
5
6 INSTLINK := cp
7
8 #########################################################################
9 # Parallel Settings
10 #########################################################################
11
12 $(PROJ)TOPMAKEPAR :=
13
14 ifdef $(PROJ)TOPPARJOBS
15 ifneq ($($(PROJ)TOPPARJOBS), 0)
16 $(PROJ)TOPMAKEPAR = -j $($(PROJ)TOPPARJOBS)
17 endif
18 endif
19
20 $(PROJ)SUBMAKEPAR :=
21
22 ifneq ($($(PROJ)SUBPARJOBS),)
23 ifneq ($($(PROJ)SUBPARJOBS),0)
24 $(PROJ)SUBMAKEPAR = -j $($(PROJ)SUBPARJOBS)
25 endif
26 endif
27
28
29 SUB_MAKE      := $(MAKE) -r -k $($(PROJ)SUBMAKEPAR)
30
31 SUB_MAKEFILE  := Makefile
32
33 #########################################################################
34 # Normal lib Targets
35 #########################################################################
36
37 SUB_LIBTARGETS   := $(addsuffix .src, $(SUB_LIBS))
38 SUB_TESTTARGETS  := $(addsuffix .src, $(SUB_TESTS))
39
40 dbg:
41         @$(MAKE) -k -r $($(PROJ)TOPMAKEPAR) -f Makefile dbg_internal
42
43 dbg_internal: SUB_TARGET := dbg
44 dbg_internal: SUB_JOB := build
45 dbg_internal: $(SUB_LIBTARGETS)
46
47 dbgLnk:
48         @$(MAKE) -k -r $($(PROJ)TOPMAKEPAR) -f Makefile dbg_internalLnk
49
50 dbg_internalLnk: SUB_TARGET := dbgLnk
51 dbg_internalLnk: SUB_JOB := build
52 dbg_internalLnk: $(SUB_LIBTARGETS)
53
54 opt:
55         @$(MAKE) -k -r $($(PROJ)TOPMAKEPAR) -f Makefile opt_internal
56
57
58 opt_internal: SUB_TARGET := opt
59 opt_internal: SUB_JOB := build
60 opt_internal: $(SUB_LIBTARGETS)
61
62 optLnk:
63         @$(MAKE) -k -r $($(PROJ)TOPMAKEPAR) -f Makefile opt_internalLnk
64
65
66 opt_internalLnk: SUB_TARGET := optLnk
67 opt_internalLnk: SUB_JOB := build
68 opt_internalLnk: $(SUB_LIBTARGETS)
69
70 #########################################################################
71 # test
72 #########################################################################
73
74 tests: SUB_TARGET := dbg
75 tests: SUB_JOB := build
76 tests: $(SUB_TESTTARGETS)
77
78 testsOpt: SUB_TARGET := opt
79 testsOpt: SUB_JOB := build
80 testsOpt: $(SUB_TESTTARGETS)
81
82 testsLnk: SUB_TARGET := TestLnk
83 testsLnk: SUB_JOB := build
84 testsLnk: $(SUB_TESTTARGETS)
85
86 #########################################################################
87 # clean
88 #########################################################################
89
90 dbgclean: SUB_TARGET := dbgclean
91 dbgclean: $(SUB_LIBTARGETS)
92
93 optclean: SUB_TARGET := optclean
94 optclean: $(SUB_LIBTARGETS)
95
96 clean: SUB_TARGET := clean
97 clean: $(SUB_LIBTARGETS)
98
99 dbgcleanLnk: SUB_TARGET := dbgcleanLnk
100 dbgcleanLnk: $(SUB_LIBTARGETS)
101
102 optcleanLnk: SUB_TARGET := optcleanLnk
103 optcleanLnk: $(SUB_LIBTARGETS)
104
105 cleanLnk: SUB_TARGET := cleanLnk
106 cleanLnk: $(SUB_LIBTARGETS) $(SUB_TESTTARGETS)
107
108 allclean: dbgclean optclean
109
110 dbgClean: SUB_TARGET := dbgClean
111 dbgClean: $(SUB_LIBTARGETS)
112
113 optClean: SUB_TARGET := optClean
114 optClean: $(SUB_LIBTARGETS)
115
116 Clean: SUB_TARGET := Clean
117 Clean: $(SUB_LIBTARGETS)
118
119 CleanLnk: SUB_TARGET := CleanLnk
120 CleanLnk: $(SUB_LIBTARGETS) $(SUB_TESTTARGETS)
121
122 LibClean: SUB_TARGET := LibClean
123 LibClean: $(SUB_LIBTARGETS)
124
125 DepClean: SUB_TARGET := DepClean
126 DepClean: $(SUB_LIBTARGETS)
127
128 distclean: SUB_TARGET := distclean
129 distclean: $(SUB_LIBTARGETS)
130
131 testsclean: SUB_TARGET := clean
132 testsclean: SUB_JOB := build
133 testsclean: $(SUB_TESTTARGETS)
134
135 testsoptclean: SUB_TARGET := optclean
136 testsoptclean: SUB_JOB := build
137 testsoptclean: $(SUB_TESTTARGETS)
138
139 testsdbgclean: SUB_TARGET := dbgclean
140 testsdbgclean: SUB_JOB := build
141 testsdbgclean: $(SUB_TESTTARGETS)
142
143 testsClean: SUB_TARGET := Clean
144 testsClean: SUB_JOB := build
145 testsClean: $(SUB_TESTTARGETS)
146
147 testsoptClean: SUB_TARGET := optClean
148 testsoptClean: SUB_JOB := build
149 testsoptClean: $(SUB_TESTTARGETS)
150
151 testsdbgClean: SUB_TARGET := dbgClean
152 testsdbgClean: SUB_JOB := build
153 testsdbgClean: $(SUB_TESTTARGETS)
154
155 #########################################################################
156 # depend
157 #########################################################################
158
159 depend: SUB_TARGET := depend
160 depend: $(SUB_LIBTARGETS)
161
162 #########################################################################
163 # fcdToBase
164 #########################################################################
165
166 fcdToBase: SUB_TARGET := fcdToBase
167 fcdToBase: $(SUB_LIBTARGETS)
168
169 fcdToBaseCompat: SUB_TARGET := fcdToBaseCompat
170 fcdToBaseCompat: $(SUB_LIBTARGETS)
171
172 #########################################################################
173 # dsp
174 #########################################################################
175
176 dsp: SUB_TARGET := dsp
177 dsp: $(SUB_LIBTARGETS)
178         @cp Base/OSGConfigured.h $(OSGPOOL)/VSBuild/VS6
179         @cp Base/unistd.h $(OSGPOOL)/VSBuild/VS6
180
181 dsp7: SUB_TARGET := dsp7
182 dsp7: $(SUB_LIBTARGETS)
183         @cp Base/OSGConfigured.h $(OSGPOOL)/VSBuild/VS7
184         @cp Base/unistd.h $(OSGPOOL)/VSBuild/VS7
185
186 #########################################################################
187 # install
188 #########################################################################
189
190 INSTALL_EXISTS := $(shell if test ! -d $(INSTALL_DIR) ; then echo "not"; fi  )
191 INSTALL_WRITABLE := $(shell if test ! -w $(INSTALL_DIR) ; then echo "not"; fi  )
192
193 install-test:
194 ifeq ($(INSTALL_EXISTS),not)
195         $(error Install dir $(INSTALL_DIR) doesn't exist! I can't install there)
196 endif
197 ifeq ($(INSTALL_WRITABLE),not)
198         $(error Install dir $(INSTALL_DIR) exists but is not writable! I can't install there)
199 endif
200
201 ifeq ($(CONFIGURED_GVBETA),0)
202 GV_EXCLUDE  := -o -name Gerrit
203 GV_ADD_PATH :=
204 else
205 GV_EXCLUDE := -o -name tmp_gv
206 GV_ADD_PATH :=
207 endif
208
209 GV_EXCLUDE := -o -name Experimental -o -name Contrib -o -name Foo -o -name Impl
210
211 install-xxx:
212         CURRDIR=`pwd`;                                                          \
213         find $$CURRDIR/Base -follow                                             \
214             \( -type d \( -name CVS -o -name '*Test' -o -name include  -o       \
215                -name Tools -o -name tmp \) -prune \)                            \
216             -o -type f                                                          \
217         -exec $($(PROJ)POOL)/Common/sedIncBuild {} $(INSTALL_DIR)/include/OpenSG \; ; \
218
219
220 install-includes_sub: SUB_TARGET := install-includes
221 install-includes_sub: $(SUB_LIBTARGETS)
222
223 update-includes_sub: SUB_TARGET := update-includes
224 update-includes_sub: $(SUB_LIBTARGETS)
225
226 INST_PACKAGE_NAME := OpenSG
227
228 install-prep:
229         @if [ ! -w $(INSTALL_DIR)/include ]; then                               \
230             mkdir $(INSTALL_DIR)/include;                                   \
231      fi;
232         @if [ ! -w $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME) ]; then          \
233             mkdir $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME);              \
234          else                                                                                                                                   \
235                 rm -f $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME)/*.hpp;                \
236                 rm -f $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME)/*.h;                  \
237                 rm -f $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME)/*.inl;                \
238                 rm -f $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME)/*.ins;                \
239      fi;
240
241 install-includes_loc:
242         @find Base -type f -exec cp {} $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME) \; -print
243
244 update-includes_loc:
245         @find Base -type f -exec $($(PROJ)POOL)/Common/sedIncU {} $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME) \; -print
246
247 install-includes_chmod:
248         @find $(INSTALL_DIR)/include/$(INST_PACKAGE_NAME) -type f               \
249      -exec chmod 444 {} \;  ;
250
251
252 install-includes: install-test install-prep install-includes_sub install-includes_loc install-includes_chmod
253
254 update-includes: install-test update-includes_sub update-includes_loc install-includes_chmod
255
256 install-libs: install-test
257         @echo $(SO_SEARCH_SUFFIX)
258         @if [ ! -w $(INSTALL_DIR)/lib ]; then mkdir $(INSTALL_DIR)/lib; fi
259         @if [ ! -w $(INSTALL_DIR)/lib/dbg ]; then mkdir $(INSTALL_DIR)/lib/dbg; fi
260         @if [ ! -w $(INSTALL_DIR)/lib/opt ]; then mkdir $(INSTALL_DIR)/lib/opt; fi
261         @CURRDIR=`pwd`;                                                         \
262         BUILDLIBS=`find $$CURRDIR -follow -name 'lib-dbg'                       \
263                  -exec find {} -name '*\$(SO_SEARCH_SUFFIX)' -print \;` ;   \
264         cd $(INSTALL_DIR)/lib/dbg;                                              \
265         rm -f *$(SO_SEARCH_SUFFIX);                                             \
266         for t in $$BUILDLIBS;                                                   \
267         do                                                                      \
268             echo $$t;                                                           \
269             $(INSTLINK) $$t .;                                                  \
270         done;                                                                   \
271         cd $$CURRDIR;
272         @CURRDIR=`pwd`;                                                         \
273         BUILDLIBS=`find $$CURRDIR -follow -name 'lib-opt'                       \
274                  -exec find {} -name '*\$(SO_SEARCH_SUFFIX)' -print \;` ;   \
275         cd $(INSTALL_DIR)/lib/opt;                                              \
276         rm -f *$(SO_SEARCH_SUFFIX);                                             \
277         for t in $$BUILDLIBS;                                                   \
278         do                                                                      \
279             echo $$t;                                                           \
280             $(INSTLINK) $$t .;                                                  \
281         done;                                                                   \
282         cd $$CURRDIR;
283         @CURRDIR=`pwd`;                                                         \
284         BUILDLIBS=`find $$CURRDIR -follow -name 'lib-dbglnk'                    \
285                         -exec find {} -name '*\$(LNK_LIB_SUFFIX)' -print \;` ;  \
286         cd $(INSTALL_DIR)/lib/dbg;                                              \
287         rm -f *$(LNK_LIB_SUFFIX);                                               \
288         for t in $$BUILDLIBS;                                                   \
289         do                                                                      \
290             echo $$t;                                                           \
291             $(INSTLINK) $$t .;                                                  \
292         done;                                                                   \
293         cd $$CURRDIR;
294         @CURRDIR=`pwd`;                                                         \
295         BUILDLIBS=`find $$CURRDIR -follow -name 'lib-optlnk'                    \
296                         -exec find {} -name '*\$(LNK_LIB_SUFFIX)' -print \;` ;  \
297         cd $(INSTALL_DIR)/lib/opt;                                              \
298         rm -f *$(LNK_LIB_SUFFIX);                                               \
299         for t in $$BUILDLIBS;                                                   \
300         do                                                                      \
301             echo $$t;                                                           \
302             $(INSTLINK) $$t .;                                                  \
303         done;                                                                   \
304         cd $$CURRDIR;
305 ifeq ($(OS_BASE),cygwin)
306         @CURRDIR=`pwd`;                                                         \
307         BUILDLIBS=`find $$CURRDIR -follow -name 'lib-dbg'                       \
308                      -exec find {} -name '*\$(LIB_SEARCH_SUFFIX)' -print \;` ;  \
309         cd $(INSTALL_DIR)/lib/dbg;                                              \
310         for t in $$BUILDLIBS;                                                   \
311         do                                                                      \
312             echo  $$t;                                                          \
313             $(INSTLINK) $$t .;                                                  \
314         done;                                                                   \
315         cd $$CURRDIR;
316         @CURRDIR=`pwd`;                                                         \
317         BUILDLIBS=`find $$CURRDIR -follow -name 'lib-opt'                       \
318                      -exec find {} -name '*\$(LIB_SEARCH_SUFFIX)' -print \;` ;  \
319         cd $(INSTALL_DIR)/lib/opt;                                              \
320         for t in $$BUILDLIBS;                                                   \
321         do                                                                      \
322             echo  $$t;                                                          \
323             $(INSTLINK) $$t .;                                                  \
324         done;                                                                   \
325         cd $$CURRDIR;
326 endif
327
328
329 fcdToBase_old:
330         @FCDEDIT=$($(PROJ)POOL)/Tools/fcdEdit/fcdEdit;                          \
331         CURRDIRBASE=`pwd` ;                                                     \
332         echo "Collecting .fcd files...";                                        \
333         cd $($(PROJ)POOL) ;                                                     \
334         for i in `find . -follow                                                \
335             \( -type d \( -name CVS -o -name Test -o -name Builds -o            \
336                -name Tools -o -name Examples -o -name '*/.*' \) -prune \)       \
337             -o -type f -name '*\.fcd' -print` ;                                 \
338         do                                                                      \
339             echo $$i ;                                                          \
340             CURRDIR=`pwd` ;                                                     \
341             cd `dirname $$i` ;                                                  \
342             $$FCDEDIT -b `basename $$i`;                                        \
343             cd $$CURRDIR ;                                                      \
344         done;                                                                   \
345         cd $$CURRDIRBASE
346
347 INSTALL_DIR_SED  := $(shell echo $(INSTALL_DIR)  | sed -e 's/\//\\\//g')
348 LD_SED           := $(shell echo $(LD)           | sed -e 's/\//\\\//g')
349 LD_FLAGS_EXT_SED := $(shell echo $(LD_FLAGS_EXT) | sed -e 's/\//\\\//g')
350
351 install-bin: install-test
352         @if [ ! -w $(INSTALL_DIR)/bin ]; then mkdir $(INSTALL_DIR)/bin; fi
353         @echo "installing $(INSTALL_DIR)/bin/osg-config from CommonPackages/osg-config"
354         @VERSION=`cat $($(PROJ)POOL)/VERSION`;                                  \
355         ICOMP=`echo $(CC) | sed -e 's|^[ ]*||' -e 's|[ ]*$$||'`;                \
356         cat CommonPackages/osg-config |                                         \
357         $(SED) -e 's/@am_gdz_system_flags@/\"$(CCFLAGS_EXT)\"/g'                \
358                -e 's/@am_gdz_system_flags_opt@/\"$(CCFLAGS_EXT_OPT)\"/g'        \
359                -e 's/@am_gdz_system_flags_dbg@/\"$(CCFLAGS_EXT_DBG)\"/g'        \
360                -e 's|@am_gdz_base_libs@|\"$(LIBS_$(OS_BASE))\"|g'                               \
361                -e 's|@am_gdz_add_inc@|%%%$(subst \,\\,$(ADD_INCL_$(OS_BASE)))%%%|g'             \
362                -e 's|@am_gdz_add_link@|%%%$(subst \,\\,$(ADD_LIBPATHS_$(OS_BASE)))%%%|g'\
363            -e "s|%%%|'|g"                                                                                                        \
364                -e 's/@am_gdz_link_flags@/\"$(LD_FLAGS_EXT_SED)\"/g'             \
365                -e 's/@am_gdz_link_flags_opt@/\"$(LD_FLAGS_EXT_OPT)\"/g'         \
366                -e 's/@am_gdz_link_flags_dbg@/\"$(LD_FLAGS_EXT_DBG)\"/g'         \
367                -e 's/@am_gdz_install_dir@/"$(INSTALL_DIR_SED)\"/g'              \
368                -e "s|@am_gdz_compiler@|\"$$ICOMP\"|g"                           \
369                -e "s/@am_gdz_version@/$$VERSION/g"                              \
370                -e 's/@am_gdz_qt_cflags@/\"$(QT_PLATTFORMDEF_EXT)\"/g'           \
371                -e 's/@am_gdz_exe_linker@/\"$(LD_SED)\"/g'                       \
372                -e "s/@am_gdz_compiler_id@/$(OS_CMPLR)/g"                        \
373                    -e "s/MSVCPRTD/MSVCPRT\$$\{dbg_char\}/g"                                                     \
374                    -e "s/MSVCRTD/MSVCRT\$$\{dbg_char\}/g"                                                       \
375             > $(INSTALL_DIR)/bin/osg-config
376         @chmod 755 $(INSTALL_DIR)/bin/osg-config
377
378 install-libs-ln: INSTLINK := $(LINK)
379 install-libs-ln: install-libs
380
381 install-libs-cp: INSTLINK := cp
382 install-libs-cp: install-libs
383
384 install-ln: install-includes install-libs-ln install-bin
385 install-cp: install-includes install-libs-cp install-bin
386 install: install-includes install-libs-cp install-bin
387
388 install-gabe: INSTLINK := cp
389 install-gabe: install-includes-gabe install-libs-cp
390
391 update-ln: update-includes install-libs-ln install-bin
392 update: update-includes install-libs-cp install-bin
393
394 %.src:
395         @if [ -d $* ]; then                                                     \
396             cd $*;                                                              \
397             $(SUB_MAKE) -f $(SUB_MAKEFILE) $(SUB_TARGET) SUB_JOB=$(SUB_JOB);    \
398             cd ..;                                                              \
399         fi
400
401 #########################################################################
402 # Collection Targets
403 #########################################################################
404
405 dbgall: dbg tests
406
407 optall: opt testsOpt
408
409 all:    dbgall optall
410
411 #########################################################################
412 # Help Target
413 #########################################################################
414
415 help:
416         @echo
417         @echo "Targets supported on this level (Top):"
418         @echo "======================================"
419         @echo
420         @echo "Creation targets"
421         @echo
422         @echo "<default>  compile the same versions of the configured libraries as last time"
423         @echo "dbg        compile the debug versions of the configured libraries"
424         @echo "opt        compile the optimized versions of the configured libraries"
425         @echo "dbgLnk     compile the debug versions of the configured libraries (static libs)"
426         @echo "optLnk     compile the optimized versions of the configured libraries (static libs)"
427         @echo "depend     explicitly create the dependency information"
428         @echo
429         @echo "dsp        create dsp files in VSBuild/* from the current config"
430         @echo
431         @echo "tests      build dbg tests"
432         @echo "testsOpt   build opt tests"
433         @echo
434         @echo "dbgall     make dbg ; make tests"
435         @echo "optall     make opt ; make testsOpt"
436         @echo "all        make dbgall ; make optall"
437         @echo
438         @echo "Cleanup targets"
439         @echo
440         @echo "remove temporary result files: object files, flex/bison/moc output etc.,"
441         @echo "dbgclean    for the debugging libraries only"
442         @echo "optclean    for the optimized libraries only"
443         @echo "clean       for the same libraries as last time"
444         @echo "allclean    dbgclean and optclean"
445         @echo
446         @echo "remove dependency files"
447         @echo "dbgDepClean    for the debugging libraries only"
448         @echo "optDepClean    for the optimized libraries only"
449         @echo "DepClean       for the same libraries as last time"
450         @echo
451         @echo "same as clean + dependencies + results (libs/programs)"
452         @echo "dbgClean    for the debugging libraries only"
453         @echo "optClean    for the optimized libraries only"
454         @echo "Clean       for the same libraries as last time"
455         @echo "distclean   dbgClean and optClean"
456         @echo
457         @echo "LibClean   remove libraries"
458         @echo "ExeClean   remove executables"
459         @echo
460         @echo "Installation targets"
461         @echo
462         @echo "The installation base directory is the one given to configure as --prefix,"
463         @echo "but it can be set on the make line with INSTALL_DIR=<dir>"
464         @echo "install the libraries into INSTALL_DIR/lib/{dbg,opt}"
465         @echo "install-libs-ln   using links"
466         @echo "install-libs-cp   copying them"
467         @echo "install-libs      linking or copying them, the same as last time"
468         @echo "install-includes  install the include files into INSTALL_DIR/include"
469         @echo "update-includes   install the include files into INSTALL_DIR/include iff the source is newer"
470         @echo "install-bin       install osg-config into INSTALL_DIR/bin"
471         @echo "install-ln        install-includes + install-libs-ln + install-bin"
472         @echo "install-cp        install-includes + install-libs-cp + install-bin"
473         @echo "install           install-includes + install-libs-cp + install-bin"
474         @echo "update-ln         update-includes  + install-libs-ln + install-bin"
475         @echo "update            update-includes  + install-libs-cp + install-bin"
476         @echo
477         @echo "Other targets"
478         @echo
479         @echo "fcdToBase    run through the tree and regenerate all the Base sources"
480         @echo
481         @echo "Useful Environment Variables"
482         @echo
483         @echo "OSGSUBPARJOBS       number of parallel compiler jobs to run"
484         @echo "OSGNODEPS=1         do not evaluate the dependencies"
485         @echo "OSGNODEPSREBUILD=1  do not rebuld the dependency files"
486
Note: See TracBrowser for help on using the browser.