source: trunk/source/GNUmakefile

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 7.0 KB
Line 
1# $Id: GNUmakefile,v 1.96 2010/01/08 15:39:33 gcosmo Exp $
2# -----------------------------------------------------------------
3# "gmake" makes default libraries for each subdomain.
4# "gmake global" makes global libraries for each subdomain.
5#                Composite libraries are built.
6# "gmake includes" places header files .h/.hh in $G4INCLUDE
7# "gmake libmap" forces rebuilding of map-file for granular libraries.
8# "gmake dll" forces building of DLLs global libraries and generates DLLs on WIN32
9# "gmake clean_libs" removes just archive (.a) and shared (.so) libraries
10#                    of current platform installation.
11# "gmake clean" removes installation of current platform.
12# "gmake clean_all" removes all platforms installations.
13#
14# (The .o files(s) are made by implicit rules.)
15
16ifndef G4INSTALL
17  G4INSTALL = ..
18endif
19
20include $(G4INSTALL)/config/architecture.gmk
21
22SUBDIR1 =  global intercoms graphics_reps materials
23SUBDIR2 =  geometry particles track digits_hits processes parameterisations
24SUBDIR2 += tracking event run error_propagation readout physics_lists
25SUBDIR3 =  persistency interfaces visualization
26
27SUBDIR4 =  g3tog4
28
29G4BINDIR := $(G4BIN)/$(G4SYSTEM)
30G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
31G4TMPDIR := $(G4TMP)/$(G4SYSTEM)
32unique := $(shell echo $$$$)
33
34.PHONY: all glob global kernel_global kernel liblist libmap dll win32def includes clean_libs clean clean_lists clean_all
35
36all: banner kernel
37ifdef G4LIB_USE_G3TOG4
38        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
39endif
40        @$(MAKE) libmap
41        @$(ECHO) "Libraries installation completed !"
42
43glob global: banner kernel_global
44ifdef G4LIB_USE_G3TOG4
45        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
46endif
47        @$(MAKE) liblist
48        @$(ECHO) "Libraries installation completed !"
49
50fpe_debug: banner kernel
51        @$(ECHO) Activating FPE debug build ...
52ifneq (,$(findstring Linux-g++,$(G4SYSTEM)))
53        @rm -f $(G4TMPDIR)/G4run/G4RunManagerKernel.*
54        @cd $(G4INSTALL)/source/run; $(MAKE) G4FPE_DEBUG=1;
55        @cd $(G4INSTALL)/source; $(MAKE) libmap;
56        @$(ECHO) "Libraries installation completed !"
57else
58        @$(ECHO) "Build of FPE check is only supported on Linux platforms with gcc !"
59        @$(ECHO) "The system you have currently selected is $(G4SYSTEM)."
60        @$(ECHO) "No actions taken !"
61endif
62
63kernel_global:
64        @for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) global); done;:
65        @for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) global); done;:
66        @for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) global); done;:
67
68kernel:
69        @for dir in $(SUBDIR1); do (cd $$dir && $(MAKE)); done;:
70        @for dir in $(SUBDIR2); do (cd $$dir && $(MAKE)); done;:
71        @for dir in $(SUBDIR3); do (cd $$dir && $(MAKE)); done;:
72
73libmap: liblist
74        @$(ECHO) "Libmap stage. Searching for GNUmakefiles and sorting ..."
75        @$(FIND) . \
76          -name GNUmakefile -exec $(GREP) -l '^ *name *:=' {} \; \
77          | $(SORT) \
78          > /tmp/G4_all_lib_makefiles.$(unique);
79        @$(ECHO) "Weeding out paths and files ..."
80        @for i in `$(CAT) /tmp/G4_all_lib_makefiles.$(unique)`; \
81        do \
82          $(ECHO) $$i | $(GREP) -q -e '/tests\?/' -e 'models/verification' || \
83          $(GREP) -q -e SUBDIR -e G4hepgeometry $$i || \
84          $(ECHO) $$i >> /tmp/G4_granlib_makefiles.$(unique); \
85        done
86        @$(ECHO) "Making libname.map starter file ..."
87        @$(TOUCH) /tmp/G4libname.map.starter.$(unique);
88        @for i in `$(CAT) /tmp/G4_granlib_makefiles.$(unique)`; \
89        do \
90          $(GREP) '^ *name *:=' $$i | $(CUT) -d \  -f 3 \
91          >> /tmp/G4libname.map.starter.$(unique); \
92          $(ECHO) $$i | $(SED) "s/^\\./source/" \
93          >> /tmp/G4libname.map.starter.$(unique); \
94        done
95        @$(ECHO) "Making libname.map ..."
96        @rm -f $(G4LIBDIR)/libname.map;
97        @G4TMP=$(G4TMP); export G4TMP; \
98          $(G4LIBDIR)/liblist -l -d $(G4TMPDIR) \
99          < /tmp/G4libname.map.starter.$(unique) \
100          > $(G4LIBDIR)/libname.map
101        @rm -f /tmp/G4_all_lib_makefiles.$(unique);
102        @rm -f /tmp/G4_granlib_makefiles.$(unique);
103        @rm -f /tmp/G4libname.map.starter.$(unique);
104
105liblist: $(G4LIBDIR)/liblist
106
107$(G4LIBDIR)/liblist: $(G4INSTALL)/config/liblist.c
108        @$(ECHO) "Building library management utility liblist ..."
109        @if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
110        @$(CC) $(CCFLAGS) -o $(G4LIBDIR)/liblist $(G4INSTALL)/config/liblist.c
111
112clean_tmps:
113        @$(ECHO) "Clearing temporary objects ..."
114        @rm -rf $(G4LIBDIR)/*.def $(G4LIBDIR)/*.exp
115        @rm -rf $(G4TMPDIR)/*
116
117dll_build: banner win32def
118ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
119        @$(ECHO) "Verifying existence of global libraries for DLLs ..."
120        @$(MAKE) kernel_global G4LIB_BUILD_DLL=1
121        @$(ECHO) "Building Windows DLL libraries ..."
122        @$(MAKE) kernel_global G4LIB_BUILD_DLL=1 G4LIB_BUILD_SHARED=1
123ifdef G4LIB_USE_G3TOG4
124        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
125        @mv $(G4LIBDIR)/libG3toG4.a $(G4LIBDIR)/libG3toG4.lib
126endif
127        @$(ECHO) "Done !"
128endif
129
130dll:
131ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
132        @$(MAKE) dll_build
133        @$(MAKE) clean_tmps
134else
135        @$(ECHO) "Sorry !"
136endif
137
138win32def: $(G4INSTALL)/config/win32def.c
139ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
140        @$(ECHO) "Building DLL management utility win32def ..."
141        @if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
142        @$(CC) $(CCFLAGS) -o $(G4LIBDIR)/win32def $(G4INSTALL)/config/win32def.c
143else
144        @$(ECHO) "Build of DLLs is only supported on Windows platforms !"
145        @$(ECHO) "The system you have currently selected is $(G4SYSTEM)."
146        @$(ECHO) "No actions taken !"
147endif
148
149includes:
150        @$(ECHO) Installing header files in $(G4INCLUDE) ...
151        @for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) $@); done
152        @for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) $@); done
153        @for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) $@); done
154ifdef G4LIB_USE_G3TOG4
155        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE) $@); done
156endif
157
158banner:
159        @$(ECHO) "*************************************************************"
160        @$(ECHO) " Installation Geant4 version $$Name: geant4-09-04-beta-01 $ "
161        @$(ECHO) " Copyright (C) 1994-2010 Geant4 Collaboration                            "
162        @$(ECHO) "*************************************************************"
163
164clean_libs::
165        @$(ECHO) Removing all libraries ...
166        @for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) clean_libs); done
167        @for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) clean_libs); done
168        @for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) clean_libs); done
169ifdef G4LIB_USE_G3TOG4
170        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE) clean_libs); done
171endif
172        @rm -rf $(G4LIBDIR)/libname.map
173
174clean::
175        @$(ECHO) Removing current $(G4SYSTEM) installation ...
176        @rm -rf $(G4TMPDIR)
177        @rm -rf $(G4LIBDIR)
178        @rm -rf $(G4BINDIR)
179        @rm -rf $(G4INSTALL)/source/interfaces/*/moc
180        @rm -rf $(G4INSTALL)/source/visualization/*/moc
181        @rm -rf $(G4INSTALL)/.config/bin/$(G4SYSTEM)
182ifdef CFRONT
183        @rm -rf $(G4TREP)
184endif
185
186
187# Pay _extremely_ attention before executing the following target !!
188#
189clean_all::
190        @$(ECHO) Removing all installations ...
191        @$(ECHO) Removing $(G4TMP) ...
192        @rm -rf $(G4TMP)
193        @$(ECHO) Removing $(G4LIB) ...
194        @rm -rf $(G4LIB)
195        @$(ECHO) Removing $(G4BIN) ...
196        @rm -rf $(G4BIN)
197        @$(ECHO) Removing $(G4INCLUDE) ...
198        @rm -rf $(G4INCLUDE)
199        @$(ECHO) Removing Qt moc source files ...
200        @rm -rf $(G4INSTALL)/source/interfaces/*/moc
201        @rm -rf $(G4INSTALL)/source/visualization/*/moc
202        @$(ECHO) Removing installation configurations ...
203        @rm -rf $(G4INSTALL)/.config
Note: See TracBrowser for help on using the repository browser.