Warning, /geant4/config/globlib.gmk is written in an unsupported language. File is not indexed.
0001 # --------------------------------------------------------------
0002 # Script for compound libraries. Gabriele Cosmo, 25/6/98.
0003 # --------------------------------------------------------------
0004
0005 ifndef G4INSTALL
0006 G4INSTALL = ..
0007 endif
0008
0009 include $(G4INSTALL)/config/architecture.gmk
0010
0011 G4LIBDIR = $(G4LIB)/$(G4SYSTEM)
0012
0013 .PHONY : all glob global obj objs includes clean clean_libs wipe_libs
0014
0015 all: makesub
0016
0017 makesub:
0018 @for dir in $(SUBDIRS); do (cd $$dir && $(MAKE)); done
0019
0020 g4libraries_to_build:=
0021
0022 ifeq ($(G4LIB_NO_SHARED),)
0023 ifneq ($(G4LIB_BUILD_SHARED),)
0024 SHARED_LIB=$(G4LIBDIR)/lib$(name).$(SHEXT)
0025 g4libraries_to_build += $(SHARED_LIB)
0026 else
0027 SHARED_LIB=
0028 endif
0029 endif
0030
0031 ifneq ($(G4LIB_BUILD_STATIC),)
0032 g4libraries_to_build += $(G4LIBDIR)/lib$(name).a
0033 endif
0034
0035 glob global: objs wipe_libs $(g4libraries_to_build)
0036
0037 ##
0038 ## make static libraries
0039 ##
0040 ifneq ($(G4LIB_BUILD_STATIC),)
0041 $(G4LIBDIR)/lib$(name).a: \
0042 $(foreach dir,$(SUBLIBS),$(G4TMP)/$(G4SYSTEM)/$(dir)/obj.last)
0043 @if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ; fi
0044 @echo Merging object files in $(G4LIBDIR)/lib$(name).a ...
0045 @$(RM) $(G4LIBDIR)/lib$(name).a
0046 #
0047 #
0048 #
0049 @if [ X$(G4SYSTEM) = XWIN32-VC ] ; \
0050 then \
0051 i=NO; \
0052 (( for lib in $(SUBLIBS); \
0053 do ( if [ $$i = NO ]; \
0054 then \
0055 $(AR) $(OUT_LIB)$(G4LIBDIR)/lib$(name).lib \
0056 $(G4TMP)/$(G4SYSTEM)/$$lib/*.o ; \
0057 else \
0058 $(AR) $(G4LIBDIR)/lib$(name).lib $(G4TMP)/$(G4SYSTEM)/$$lib/*.o; \
0059 fi ); \
0060 i=YES; \
0061 done ) ; \
0062 mv $(G4LIBDIR)/lib$(name).lib $(G4LIBDIR)/lib$(name).a); \
0063 else \
0064 (for lib in $(SUBLIBS); \
0065 do ($(AR) $(OUT_LIB)$(G4LIBDIR)/lib$(name).a \
0066 $(G4TMP)/$(G4SYSTEM)/$$lib/*.o); \
0067 done);\
0068 fi
0069 #
0070 #
0071 #
0072 @if [ X$(G4SYSTEM) != XWIN32-VC ] ; then \
0073 if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then \
0074 ranlib $(G4LIBDIR)/lib$(name).a ; fi ; fi
0075 endif
0076
0077
0078 ##
0079 ## make shared libraries
0080 ##
0081 ifeq ($(G4LIB_NO_SHARED),)
0082 ifneq ($(G4LIB_BUILD_SHARED),)
0083 $(SHARED_LIB): $(foreach dir,$(SUBLIBS),$(G4TMP)/$(G4SYSTEM)/$(dir)/obj.last)
0084 @if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ; fi
0085 @echo Creating global shared library $@ ...
0086 @$(RM) $@
0087 # use system specific commands to build the library
0088 $(build-global-shared-lib)
0089 endif
0090 endif
0091
0092 obj:
0093 @for dir in $(SUBDIRS); \
0094 do (cd $$dir; $(MAKE) -q obj && ok=yes; \
0095 if [ $$ok ]; \
0096 then echo Nothing to be done for lib$(name) in $$dir/.; \
0097 else $(MAKE) obj; \
0098 fi; ) \
0099 done
0100
0101 objs:
0102 @for dir in $(SUBDIRS); \
0103 do (cd $$dir; $(MAKE) -q obj && ok=yes; \
0104 if [ $$ok ]; \
0105 then echo Nothing to be done for lib$(name) in $$dir/.; \
0106 else $(MAKE) clean_libs; $(MAKE) obj; \
0107 fi; ) \
0108 done
0109
0110 includes::
0111 @for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $@ ); done
0112
0113 wipe_libs:
0114 @for lib in $(SUBLIBS); do (rm -f $(G4LIBDIR)/lib$$lib.a); done
0115 @for lib in $(SUBLIBS); do (rm -f $(G4LIBDIR)/lib$$lib.$(SHEXT)); done
0116
0117 clean::
0118 @echo Cleaning up ...
0119 @for lib in $(SUBLIBS); do ( \
0120 rm -rf $(G4TMP)/$(G4SYSTEM)/$$lib;\
0121 rm -f $(G4LIBDIR)/*$$lib.a;\
0122 rm -f $(G4LIBDIR)/*$$lib.lib;\
0123 rm -f $(G4LIBDIR)/*$$lib.exp;\
0124 rm -f $(G4LIBDIR)/*$$lib.$(SHEXT) );\
0125 done
0126 @for dir in $(SUBDIRS); do (rm -rf $$dir/moc); done
0127 @rm -f $(G4LIBDIR)/*$(name).a
0128 @rm -f $(G4LIBDIR)/*$(name).lib
0129 @rm -f $(G4LIBDIR)/*$(name).exp
0130 @rm -f $(G4LIBDIR)/*$(name).$(SHEXT)
0131
0132 clean_libs::
0133 @echo Removing lib$(name).a/.$(SHEXT) and sub-libraries ...
0134 @for lib in $(SUBLIBS); do ( \
0135 rm -f $(G4LIBDIR)/*$$lib.a;\
0136 rm -f $(G4LIBDIR)/*$$lib.lib;\
0137 rm -f $(G4LIBDIR)/*$$lib.exp;\
0138 rm -f $(G4LIBDIR)/*$$lib.$(SHEXT) );\
0139 done
0140 @rm -f $(G4LIBDIR)/*$(name).a
0141 @rm -f $(G4LIBDIR)/*$(name).lib
0142 @rm -f $(G4LIBDIR)/*$(name).exp
0143 @rm -f $(G4LIBDIR)/*$(name).$(SHEXT)