source: trunk/source/GNUmakefile @ 1058

Last change on this file since 1058 was 1058, checked in by garnier, 15 years ago

file release beta

File size: 6.7 KB
Line 
1# $Id: GNUmakefile,v 1.90 2009/01/23 11:06:13 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
112dll: banner win32def
113ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
114        @$(ECHO) "Verifying existence of global libraries for DLLs ..."
115        @$(MAKE) kernel_global G4LIB_BUILD_DLL=1
116        @$(ECHO) "Building Windows DLL libraries ..."
117        @$(MAKE) kernel_global G4LIB_BUILD_DLL=1 G4LIB_BUILD_SHARED=1
118        @$(ECHO) "Clearing temporary DLL objects and temporaries ..."
119        @rm -rf $(G4LIBDIR)/*.def $(G4LIBDIR)/*.exp
120        @rm -rf $(G4TMPDIR)/*
121ifdef G4LIB_USE_G3TOG4
122        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
123        @mv $(G4LIBDIR)/libG3toG4.a $(G4LIBDIR)/libG3toG4.lib
124endif
125        @$(ECHO) "Done !"
126else
127        @$(ECHO) "Sorry !"
128endif
129
130win32def: $(G4INSTALL)/config/win32def.c
131ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
132        @$(ECHO) "Building DLL management utility win32def ..."
133        @if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
134        @$(CC) $(CCFLAGS) -o $(G4LIBDIR)/win32def $(G4INSTALL)/config/win32def.c
135else
136        @$(ECHO) "Build of DLLs is only supported on Windows platforms !"
137        @$(ECHO) "The system you have currently selected is $(G4SYSTEM)."
138        @$(ECHO) "No actions taken !"
139endif
140
141includes:
142        @$(ECHO) Installing header files in $(G4INCLUDE) ...
143        @for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) $@); done
144        @for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) $@); done
145        @for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) $@); done
146ifdef G4LIB_USE_G3TOG4
147        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE) $@); done
148endif
149
150banner:
151        @$(ECHO) "*************************************************************"
152        @$(ECHO) " Installation Geant4 version $$Name: geant4-09-02-ref-02 $ "
153        @$(ECHO) " Copyright (C) 1994-2009 Geant4 Collaboration                            "
154        @$(ECHO) "*************************************************************"
155
156clean_libs::
157        @$(ECHO) Removing all libraries ...
158        @for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) clean_libs); done
159        @for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) clean_libs); done
160        @for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) clean_libs); done
161ifdef G4LIB_USE_G3TOG4
162        @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE) clean_libs); done
163endif
164        @rm -rf $(G4LIBDIR)/libname.map
165
166clean::
167        @$(ECHO) Removing current $(G4SYSTEM) installation ...
168        @rm -rf $(G4TMPDIR)
169        @rm -rf $(G4LIBDIR)
170        @rm -rf $(G4BINDIR)
171        @rm -rf $(G4INSTALL)/.config/bin/$(G4SYSTEM)
172ifdef CFRONT
173        @rm -rf $(G4TREP)
174endif
175
176
177# Pay _extremely_ attention before executing the following target !!
178#
179clean_all::
180        @$(ECHO) Removing all installations ...
181        @$(ECHO) Removing $(G4TMP) ...
182        @rm -rf $(G4TMP)
183        @$(ECHO) Removing $(G4LIB) ...
184        @rm -rf $(G4LIB)
185        @$(ECHO) Removing $(G4BIN) ...
186        @rm -rf $(G4BIN)
187        @$(ECHO) Removing $(G4INCLUDE) ...
188        @rm -rf $(G4INCLUDE)
189        @$(ECHO) Removing installation configurations ...
190        @rm -rf $(G4INSTALL)/.config
Note: See TracBrowser for help on using the repository browser.