[1315] | 1 | # $Id: GNUmakefile,v 1.96 2010/01/08 15:39:33 gcosmo Exp $ |
---|
[832] | 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 | |
---|
| 16 | ifndef G4INSTALL |
---|
| 17 | G4INSTALL = .. |
---|
| 18 | endif |
---|
| 19 | |
---|
| 20 | include $(G4INSTALL)/config/architecture.gmk |
---|
| 21 | |
---|
| 22 | SUBDIR1 = global intercoms graphics_reps materials |
---|
| 23 | SUBDIR2 = geometry particles track digits_hits processes parameterisations |
---|
| 24 | SUBDIR2 += tracking event run error_propagation readout physics_lists |
---|
| 25 | SUBDIR3 = persistency interfaces visualization |
---|
| 26 | |
---|
| 27 | SUBDIR4 = g3tog4 |
---|
| 28 | |
---|
| 29 | G4BINDIR := $(G4BIN)/$(G4SYSTEM) |
---|
| 30 | G4LIBDIR := $(G4LIB)/$(G4SYSTEM) |
---|
| 31 | G4TMPDIR := $(G4TMP)/$(G4SYSTEM) |
---|
| 32 | unique := $(shell echo $$$$) |
---|
| 33 | |
---|
| 34 | .PHONY: all glob global kernel_global kernel liblist libmap dll win32def includes clean_libs clean clean_lists clean_all |
---|
| 35 | |
---|
| 36 | all: banner kernel |
---|
| 37 | ifdef G4LIB_USE_G3TOG4 |
---|
| 38 | @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;: |
---|
| 39 | endif |
---|
| 40 | @$(MAKE) libmap |
---|
| 41 | @$(ECHO) "Libraries installation completed !" |
---|
| 42 | |
---|
| 43 | glob global: banner kernel_global |
---|
| 44 | ifdef G4LIB_USE_G3TOG4 |
---|
| 45 | @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;: |
---|
| 46 | endif |
---|
| 47 | @$(MAKE) liblist |
---|
| 48 | @$(ECHO) "Libraries installation completed !" |
---|
| 49 | |
---|
| 50 | fpe_debug: banner kernel |
---|
| 51 | @$(ECHO) Activating FPE debug build ... |
---|
| 52 | ifneq (,$(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 !" |
---|
| 57 | else |
---|
| 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 !" |
---|
| 61 | endif |
---|
| 62 | |
---|
| 63 | kernel_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 | |
---|
| 68 | kernel: |
---|
| 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 | |
---|
| 73 | libmap: liblist |
---|
| 74 | @$(ECHO) "Libmap stage. Searching for GNUmakefiles and sorting ..." |
---|
[1058] | 75 | @$(FIND) . \ |
---|
[832] | 76 | -name GNUmakefile -exec $(GREP) -l '^ *name *:=' {} \; \ |
---|
[1058] | 77 | | $(SORT) \ |
---|
[832] | 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 ..." |
---|
[1058] | 87 | @$(TOUCH) /tmp/G4libname.map.starter.$(unique); |
---|
[832] | 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 | |
---|
| 105 | liblist: $(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 | |
---|
[1228] | 112 | clean_tmps: |
---|
| 113 | @$(ECHO) "Clearing temporary objects ..." |
---|
| 114 | @rm -rf $(G4LIBDIR)/*.def $(G4LIBDIR)/*.exp |
---|
| 115 | @rm -rf $(G4TMPDIR)/* |
---|
| 116 | |
---|
| 117 | dll_build: banner win32def |
---|
[832] | 118 | ifneq (,$(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 |
---|
| 123 | ifdef G4LIB_USE_G3TOG4 |
---|
| 124 | @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;: |
---|
| 125 | @mv $(G4LIBDIR)/libG3toG4.a $(G4LIBDIR)/libG3toG4.lib |
---|
| 126 | endif |
---|
| 127 | @$(ECHO) "Done !" |
---|
[1228] | 128 | endif |
---|
| 129 | |
---|
| 130 | dll: |
---|
| 131 | ifneq (,$(findstring WIN32-VC,$(G4SYSTEM))) |
---|
| 132 | @$(MAKE) dll_build |
---|
| 133 | @$(MAKE) clean_tmps |
---|
[832] | 134 | else |
---|
| 135 | @$(ECHO) "Sorry !" |
---|
| 136 | endif |
---|
| 137 | |
---|
| 138 | win32def: $(G4INSTALL)/config/win32def.c |
---|
| 139 | ifneq (,$(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 |
---|
| 143 | else |
---|
| 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 !" |
---|
| 147 | endif |
---|
| 148 | |
---|
| 149 | includes: |
---|
| 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 |
---|
| 154 | ifdef G4LIB_USE_G3TOG4 |
---|
| 155 | @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE) $@); done |
---|
| 156 | endif |
---|
| 157 | |
---|
| 158 | banner: |
---|
| 159 | @$(ECHO) "*************************************************************" |
---|
[1315] | 160 | @$(ECHO) " Installation Geant4 version $$Name: geant4-09-04-beta-cand-01 $ " |
---|
| 161 | @$(ECHO) " Copyright (C) 1994-2010 Geant4 Collaboration " |
---|
[832] | 162 | @$(ECHO) "*************************************************************" |
---|
| 163 | |
---|
| 164 | clean_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 |
---|
| 169 | ifdef G4LIB_USE_G3TOG4 |
---|
| 170 | @for dir in $(SUBDIR4); do (cd $$dir && $(MAKE) clean_libs); done |
---|
| 171 | endif |
---|
| 172 | @rm -rf $(G4LIBDIR)/libname.map |
---|
| 173 | |
---|
| 174 | clean:: |
---|
| 175 | @$(ECHO) Removing current $(G4SYSTEM) installation ... |
---|
| 176 | @rm -rf $(G4TMPDIR) |
---|
| 177 | @rm -rf $(G4LIBDIR) |
---|
| 178 | @rm -rf $(G4BINDIR) |
---|
[1228] | 179 | @rm -rf $(G4INSTALL)/source/interfaces/*/moc |
---|
| 180 | @rm -rf $(G4INSTALL)/source/visualization/*/moc |
---|
[832] | 181 | @rm -rf $(G4INSTALL)/.config/bin/$(G4SYSTEM) |
---|
| 182 | ifdef CFRONT |
---|
| 183 | @rm -rf $(G4TREP) |
---|
| 184 | endif |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | # Pay _extremely_ attention before executing the following target !! |
---|
| 188 | # |
---|
| 189 | clean_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) |
---|
[1228] | 199 | @$(ECHO) Removing Qt moc source files ... |
---|
| 200 | @rm -rf $(G4INSTALL)/source/interfaces/*/moc |
---|
| 201 | @rm -rf $(G4INSTALL)/source/visualization/*/moc |
---|
[832] | 202 | @$(ECHO) Removing installation configurations ... |
---|
| 203 | @rm -rf $(G4INSTALL)/.config |
---|