Warning, /geant4/config/binmake.gmk is written in an unsupported language. File is not indexed.
0001 # ----------------------------------------------------------
0002 # Script defining rules and paths for making binaries.
0003 # First implementation: Gabriele Cosmo, 25/06/1998.
0004 # ----------------------------------------------------------
0005
0006 ifndef G4DUMMY_VARIABLE
0007 include $(G4INSTALL)/config/architecture.gmk
0008 endif
0009
0010 G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
0011
0012 # Define variable checking for existence of centrally installed headers.
0013 # If check will be true, avoid explicit definition of paths to INCFLAGS.
0014 #
0015 G4INCLUDE_EXEC := $(shell [ -r $(G4INCLUDE)/globals.hh ] && echo 1)
0016
0017 include $(G4INSTALL)/config/G4UI_USE.gmk
0018 include $(G4INSTALL)/config/G4VIS_USE.gmk
0019 include $(G4INSTALL)/config/interactivity.gmk
0020 include $(G4INSTALL)/config/analysis.gmk
0021
0022 # Verify the existance of the global static libraries first.
0023 # if not verify the existance of global shared libraries (Unix only).
0024 #
0025 ifndef G4LIB_USE_GRANULAR
0026 GLOBALLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.a && echo yes)
0027 ifndef GLOBALLIBS
0028 GLOBALLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.$(SHEXT) && echo yes)
0029 SHAREDLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.$(SHEXT) && echo yes)
0030 endif
0031 endif
0032
0033 # Verify the existance of granular shared libraries (Unix) or global DLLs (Windows)
0034 #
0035 ifndef SHAREDLIBS
0036 SHAREDLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4globman.$(SHEXT) && echo yes)
0037 endif
0038 ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
0039 SHAREDLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/G4global.$(SHEXT) && echo yes)
0040 endif
0041
0042 ifndef INCFLAGS
0043 ifeq ($(G4INCLUDE_EXEC),1)
0044 INCFLAGS := -I$(G4INCLUDE)
0045 else
0046 INCFLAGS := \
0047 -I$(G4BASE)/externals/g4tools/include \
0048 -I$(G4BASE)/analysis/management/include \
0049 -I$(G4BASE)/analysis/hntools/include \
0050 -I$(G4BASE)/analysis/csv/include \
0051 -I$(G4BASE)/analysis/root/include \
0052 -I$(G4BASE)/analysis/xml/include \
0053 -I$(G4BASE)/analysis/factory/include \
0054 -I$(G4BASE)/analysis/accumulables/include \
0055 -I$(G4BASE)/global/management/include \
0056 -I$(G4BASE)/global/HEPRandom/include \
0057 -I$(G4BASE)/global/HEPGeometry/include \
0058 -I$(G4BASE)/global/HEPNumerics/include \
0059 -I$(G4BASE)/run/include \
0060 -I$(G4BASE)/materials/include \
0061 -I$(G4BASE)/parameterisations/gflash/include \
0062 -I$(G4BASE)/particles/management/include \
0063 -I$(G4BASE)/particles/adjoint/include \
0064 -I$(G4BASE)/particles/bosons/include \
0065 -I$(G4BASE)/particles/leptons/include \
0066 -I$(G4BASE)/particles/hadrons/barions/include \
0067 -I$(G4BASE)/particles/hadrons/ions/include \
0068 -I$(G4BASE)/particles/hadrons/mesons/include \
0069 -I$(G4BASE)/particles/shortlived/include \
0070 -I$(G4BASE)/physics_lists/lists/include \
0071 -I$(G4BASE)/physics_lists/builders/include \
0072 -I$(G4BASE)/physics_lists/constructors/decay/include \
0073 -I$(G4BASE)/physics_lists/constructors/electromagnetic/include \
0074 -I$(G4BASE)/physics_lists/constructors/factory/include \
0075 -I$(G4BASE)/physics_lists/constructors/gamma_lepto_nuclear/include \
0076 -I$(G4BASE)/physics_lists/constructors/hadron_elastic/include \
0077 -I$(G4BASE)/physics_lists/constructors/hadron_inelastic/include \
0078 -I$(G4BASE)/physics_lists/constructors/ions/include \
0079 -I$(G4BASE)/physics_lists/constructors/limiters/include \
0080 -I$(G4BASE)/physics_lists/constructors/stopping/include \
0081 -I$(G4BASE)/physics_lists/util/include \
0082 -I$(G4BASE)/processes/management/include \
0083 -I$(G4BASE)/processes/cuts/include \
0084 -I$(G4BASE)/processes/biasing/generic/include \
0085 -I$(G4BASE)/processes/biasing/importance/include \
0086 -I$(G4BASE)/processes/biasing/management/include \
0087 -I$(G4BASE)/processes/scoring/include \
0088 -I$(G4BASE)/processes/decay/include \
0089 -I$(G4BASE)/processes/optical/include \
0090 -I$(G4BASE)/processes/solidstate/channeling/include \
0091 -I$(G4BASE)/processes/solidstate/phonon/include \
0092 -I$(G4BASE)/processes/transportation/include \
0093 -I$(G4BASE)/processes/parameterisation/include \
0094 -I$(G4BASE)/processes/electromagnetic/adjoint/include \
0095 -I$(G4BASE)/processes/electromagnetic/standard/include \
0096 -I$(G4BASE)/processes/electromagnetic/muons/include \
0097 -I$(G4BASE)/processes/electromagnetic/utils/include \
0098 -I$(G4BASE)/processes/electromagnetic/xrays/include \
0099 -I$(G4BASE)/processes/electromagnetic/lowenergy/include \
0100 -I$(G4BASE)/processes/electromagnetic/highenergy/include \
0101 -I$(G4BASE)/processes/electromagnetic/dna/processes/include \
0102 -I$(G4BASE)/processes/electromagnetic/dna/models/include \
0103 -I$(G4BASE)/processes/electromagnetic/dna/utils/include \
0104 -I$(G4BASE)/processes/electromagnetic/dna/management/include \
0105 -I$(G4BASE)/processes/electromagnetic/dna/molecules/management/include \
0106 -I$(G4BASE)/processes/electromagnetic/dna/molecules/types/include \
0107 -I$(G4BASE)/processes/electromagnetic/pii/include \
0108 -I$(G4BASE)/processes/electromagnetic/polarisation/include \
0109 -I$(G4BASE)/processes/hadronic/cross_sections/include \
0110 -I$(G4BASE)/processes/hadronic/management/include \
0111 -I$(G4BASE)/processes/hadronic/models/abla/include \
0112 -I$(G4BASE)/processes/hadronic/models/abrasion/include \
0113 -I$(G4BASE)/processes/hadronic/models/binary_cascade/include \
0114 -I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
0115 -I$(G4BASE)/processes/hadronic/models/coherent_elastic/include \
0116 -I$(G4BASE)/processes/hadronic/models/de_excitation/ablation/include \
0117 -I$(G4BASE)/processes/hadronic/models/de_excitation/evaporation/include \
0118 -I$(G4BASE)/processes/hadronic/models/de_excitation/fermi_breakup/include \
0119 -I$(G4BASE)/processes/hadronic/models/de_excitation/fission/include \
0120 -I$(G4BASE)/processes/hadronic/models/de_excitation/gem_evaporation/include \
0121 -I$(G4BASE)/processes/hadronic/models/de_excitation/handler/include \
0122 -I$(G4BASE)/processes/hadronic/models/de_excitation/management/include \
0123 -I$(G4BASE)/processes/hadronic/models/de_excitation/multifragmentation/include \
0124 -I$(G4BASE)/processes/hadronic/models/de_excitation/photon_evaporation/include \
0125 -I$(G4BASE)/processes/hadronic/models/de_excitation/util/include \
0126 -I$(G4BASE)/processes/hadronic/models/em_dissociation/include \
0127 -I$(G4BASE)/processes/hadronic/models/fission/include \
0128 -I$(G4BASE)/processes/hadronic/models/gamma_nuclear/include \
0129 -I$(G4BASE)/processes/hadronic/models/im_r_matrix/include \
0130 -I$(G4BASE)/processes/hadronic/models/inclxx/interface/include \
0131 -I$(G4BASE)/processes/hadronic/models/inclxx/utils/include \
0132 -I$(G4BASE)/processes/hadronic/models/inclxx/incl_physics/include \
0133 -I$(G4BASE)/processes/hadronic/models/lend/include \
0134 -I$(G4BASE)/processes/hadronic/models/lepto_nuclear/include \
0135 -I$(G4BASE)/processes/hadronic/models/particle_hp/include \
0136 -I$(G4BASE)/processes/hadronic/models/parton_string/diffraction/include \
0137 -I$(G4BASE)/processes/hadronic/models/parton_string/hadronization/include \
0138 -I$(G4BASE)/processes/hadronic/models/parton_string/management/include \
0139 -I$(G4BASE)/processes/hadronic/models/parton_string/qgsm/include \
0140 -I$(G4BASE)/processes/hadronic/models/pre_equilibrium/exciton_model/include \
0141 -I$(G4BASE)/processes/hadronic/models/qmd/include \
0142 -I$(G4BASE)/processes/hadronic/models/quasi_elastic/include \
0143 -I$(G4BASE)/processes/hadronic/models/radioactive_decay/include \
0144 -I$(G4BASE)/processes/hadronic/models/theo_high_energy/include \
0145 -I$(G4BASE)/processes/hadronic/processes/include \
0146 -I$(G4BASE)/processes/hadronic/stopping/include \
0147 -I$(G4BASE)/processes/hadronic/util/include \
0148 -I$(G4BASE)/geometry/management/include \
0149 -I$(G4BASE)/geometry/solids/CSG/include \
0150 -I$(G4BASE)/geometry/solids/specific/include \
0151 -I$(G4BASE)/geometry/solids/Boolean/include \
0152 -I$(G4BASE)/geometry/divisions/include \
0153 -I$(G4BASE)/geometry/volumes/include \
0154 -I$(G4BASE)/geometry/navigation/include \
0155 -I$(G4BASE)/geometry/magneticfield/include \
0156 -I$(G4BASE)/geometry/biasing/include \
0157 -I$(G4BASE)/track/include \
0158 -I$(G4BASE)/tracking/include \
0159 -I$(G4BASE)/digits_hits/detector/include \
0160 -I$(G4BASE)/digits_hits/hits/include \
0161 -I$(G4BASE)/digits_hits/digits/include \
0162 -I$(G4BASE)/digits_hits/scorer/include \
0163 -I$(G4BASE)/digits_hits/utils/include \
0164 -I$(G4BASE)/persistency/ascii/include \
0165 -I$(G4BASE)/persistency/gdml/include \
0166 -I$(G4BASE)/persistency/mctruth/include \
0167 -I$(G4BASE)/readout/include \
0168 -I$(G4BASE)/event/include \
0169 -I$(G4BASE)/error_propagation/include \
0170 -I$(G4BASE)/graphics_reps/include \
0171 -I$(G4BASE)/intercoms/include
0172 ifdef G4LIB_USE_G3TOG4
0173 INCFLAGS += -I$(G4BASE)/g3tog4/include
0174 endif
0175 endif
0176 endif
0177
0178 CPPFLAGS += $(INCFLAGS)
0179 LDFLAGS += -L$(G4LIBDIR)
0180
0181 G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(G4TARGET)
0182 G4BINDIR := $(G4BIN)/$(G4SYSTEM)
0183
0184 ifdef G4EXLIB
0185 # Redefine G4LIBDIR here to switch to local path for generation of app library
0186 G4LIBDIR := $(G4TMPDIR)
0187 LDFLAGS += -L$(G4TMPDIR)
0188 ifdef SHAREDLIBS
0189 ifdef G4RUNPATHOPTION
0190 # For the example dependent directory, keep the
0191 # path to the shared lib in the executable.
0192 LDFLAGS += $(G4RUNPATHOPTION)$(G4TMPDIR)
0193 LDFLAGS += $(G4RUNPATHOPTION)$(G4LIB)/$(G4SYSTEM)
0194 endif
0195 endif
0196 include $(G4INSTALL)/config/common.gmk
0197 endif
0198
0199 ifdef LDLIBS
0200 USER_DEFINED_LDLIBS := 1
0201 endif
0202
0203 # Because of the script for granular libraries which replaces part of LDLIBS
0204 # and because of the way user defined LDLIBS was augmented historically I
0205 # have split LDLIBS into 4 parts...
0206 #
0207 ifndef USER_DEFINED_LDLIBS
0208
0209 # TARGETLIB is the library generated for the final user application;
0210 # TARGOBJEXT defines the target object extension
0211 #
0212 ifdef G4EXLIB
0213 ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
0214 # Unix
0215 TARGETLIB := -l$(G4TARGET)
0216 else
0217 # Windows
0218 TARGETLIB := lib$(G4TARGET).a
0219 endif
0220 endif
0221
0222 # LDLIBS1 contains the very high level libraries...
0223 #
0224 LDLIBS1 := $(EXTRALIBS)
0225
0226 # VISLIBS (and UILIBS?) is handled by the granular library script...
0227 #
0228 ifdef GLOBALLIBS
0229 LDLIBS2 := $(VISLIBS) -lG4interfaces -lG4mctruth -lG4geomtext
0230
0231 ifdef G4LIB_USE_GDML
0232 LDLIBS2 += -lG4gdml
0233 endif
0234
0235 ifdef G4LIB_USE_G3TOG4
0236 LDLIBS2 += -lG3toG4
0237 endif
0238
0239 LDLIBS2 += -lG4error_propagation \
0240 -lG4readout \
0241 -lG4physicslists \
0242 -lG4run \
0243 -lG4event \
0244 -lG4tracking \
0245 -lG4parmodels \
0246 -lG4processes \
0247 -lG4digits_hits \
0248 -lG4track \
0249 -lG4particles \
0250 -lG4geometry \
0251 -lG4materials \
0252 -lG4graphics_reps \
0253 -lG4analysis \
0254 -lG4intercoms \
0255 -lG4global
0256
0257 ifdef G4LIB_USE_CLHEP
0258 LDLIBS2 += -lG4clhep
0259 endif
0260
0261 ifdef G4LIB_USE_PTL
0262 LDLIBS2 += -lG4ptl
0263 endif
0264
0265 ifdef G4LIB_USE_EXPAT
0266 LDLIBS2 += -lG4expat
0267 endif
0268
0269 LDLIBS += -lG4tools
0270
0271 ifdef G4LIB_USE_ZLIB
0272 LDLIBS2 += -lG4zlib
0273 endif
0274
0275 # Bring all symbols in for libraries which requires this (templated factories).
0276 #
0277 ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
0278 ifndef SHAREDLIBS
0279 LDFLAGS += $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4physicslists.a $(G4NOSTATIC_MODE)
0280 endif
0281 endif
0282
0283 else
0284 # The next lines specifically should read LDLIBS2 = , not LDLIBS2 :=, so
0285 # that it is not expanded until the directory G4TMPDIR is created.
0286 ifeq ($(G4INCLUDE_EXEC),1)
0287 LDLIBS2 = $(shell \
0288 G4TMP=$(G4TMP); export G4TMP; \
0289 if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
0290 -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
0291 $(G4LIB)/$(G4SYSTEM)/liblist \
0292 -m $(G4LIB)/$(G4SYSTEM) \
0293 < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
0294 else
0295 LDLIBS2 = $(shell \
0296 G4TMP=$(G4TMP); export G4TMP; \
0297 if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
0298 -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
0299 $(G4LIB)/$(G4SYSTEM)/liblist \
0300 -d $(G4TMPDIR) \
0301 < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
0302 # Warning: do not add to LDLIBS2 with += because this causes it to be
0303 # expanded too soon. Hence extra libraries must have a different name...
0304 # Extra libraries to resolve remaining circular dependencies...
0305 # LDLIBS2EXTRA =
0306 endif
0307 # Bring all symbols in for libraries which requires this (templated factories).
0308 #
0309 # ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
0310 # ifndef SHAREDLIBS
0311 # LDFLAGS += $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_lists.a $(G4NOSTATIC_MODE) \
0312 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_decay.a $(G4NOSTATIC_MODE) \
0313 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_em.a $(G4NOSTATIC_MODE) \
0314 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_glnuclear.a $(G4NOSTATIC_MODE) \
0315 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_helastic.a $(G4NOSTATIC_MODE) \
0316 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_hinelastic.a $(G4NOSTATIC_MODE) \
0317 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_ions.a $(G4NOSTATIC_MODE) \
0318 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_limiters.a $(G4NOSTATIC_MODE) \
0319 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_stopping.a $(G4NOSTATIC_MODE) \
0320 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_builders.a $(G4NOSTATIC_MODE) \
0321 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_factory.a $(G4NOSTATIC_MODE) \
0322 # $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4physlist_util.a $(G4NOSTATIC_MODE)
0323 # endif
0324 # endif
0325 endif
0326
0327 # LDLIBS3 contains the first set of low level libraries...
0328 #
0329 ifdef G4LIB_USE_GDML
0330 LDLIBS3 += $(GDMLLIBS)
0331 endif
0332 LDLIBS3 += $(INTYLIBS)
0333 LDLIBS3 += $(ANALYSISLIBS)
0334
0335 endif # ifndef USER_DEFINED_LDLIBS
0336
0337 # LDLIBS4 contains the next set of low level libraries which historically
0338 # (why?) the user is not supposed to be able to define...
0339 #
0340 LDLIBS4 += $(LOADLIBS)
0341
0342 # Finally assemble libraries...
0343 #
0344 ifdef USER_DEFINED_LDLIBS
0345 LDLIBS_PREFINAL := $(LDLIBS)
0346 LDLIBS_KERNEL := $(LDLIBS)
0347 else
0348 # Again, do not use := or +=. See note on LDLIBS2 above.
0349 LDLIBS_PREFINAL = $(LDLIBS1) $(LDLIBS2) $(LDLIBS2EXTRA) $(LDLIBS3)
0350 # Version leaving out EXTRALIBS
0351 LDLIBS_KERNEL = $(LDLIBS2) $(LDLIBS2EXTRA) $(LDLIBS3)
0352 endif
0353 LDLIBS_PREFINAL += $(LDLIBS4)
0354 LDLIBS_KERNEL += $(LDLIBS4)
0355
0356 ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
0357 # Windows
0358 WIN32TMP := $(patsubst -L%,$(LIB_PATH)%,$(LDFLAGS))
0359 LDFLAGS = $(patsubst /,$(PATH_DEL),$(WIN32TMP))
0360 WIN32TMP2 := $(patsubst -L%,$(LIB_PATH)%,$(LDLIBS_PREFINAL))
0361 WIN32TMP3 := $(patsubst -L%,$(LIB_PATH)%,$(LDLIBS1))
0362 WIN32TMP4 := $(patsubst -L%,$(LIB_PATH)%,$(LDLIBS_KERNEL))
0363 ifdef SHAREDLIBS
0364 ifdef G4LIB_USE_DLL
0365 LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP3)) $(patsubst -l%,lib%.lib,$(WIN32TMP4))
0366 else
0367 LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.lib,$(WIN32TMP2))
0368 endif
0369 else
0370 LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP2))
0371 endif
0372 OUT := /Fe
0373 TARGOBJEXT := OBJ
0374 else
0375 # Unix
0376 LDLIBS = $(TARGETLIB) $(LDLIBS_PREFINAL)
0377 OUT := -o
0378 TARGOBJEXT := o
0379 endif
0380
0381 ifdef transform-RPath
0382 # Invoke system specific transformation of
0383 include $(G4INSTALL)/config/sys/$(G4SYSTEM)-runpath.gmk
0384 endif
0385
0386 sources := $(wildcard $(G4TARGET).cc)
0387 objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.$(TARGOBJEXT),$(sources))
0388 dependencies := $(patsubst %.cc,$(G4TMPDIR)/exe/%.d,$(sources))
0389
0390 LINK_DEPENDENCIES := $(G4TMPDIR)/exe/obj.last $(EXTRA_LINK_DEPENDENCIES)
0391
0392 .PHONY: bin clean clean_bin debug
0393
0394 # Make $(G4TARGET) executable.
0395
0396 bin: $(G4BINDIR)/$(G4TARGET)
0397
0398 $(G4BINDIR)/$(G4TARGET): $(LINK_DEPENDENCIES)
0399 ifndef USER_DEFINED_LDLIBS
0400 ifndef GLOBALLIBS
0401 @echo "Using granular libraries ..."
0402 @if [ ! \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
0403 -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
0404 echo "ERROR: No liblist program or library map file."; \
0405 echo " These are needed for building with granular"; \
0406 echo " libraries."; \
0407 echo ' cd $$G4INSTALL/source'; \
0408 echo " gmake"; \
0409 echo " or if you are sure you have already made all the"; \
0410 echo " granular libraries:"; \
0411 echo " gmake libmap"; \
0412 exit 1; fi
0413 else
0414 @echo "Using global libraries ..."
0415 endif
0416 endif
0417 @if [ ! -d $(G4BINDIR) ] ; then mkdir $(G4BINDIR) ;fi
0418 ifdef CPPVERBOSE
0419 $(CXX) $(CXXFLAGS) $(CPPFLAGS) \
0420 $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
0421 $(LDLIBS)
0422 else
0423 @echo Linking $(G4TARGET)
0424 @$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
0425 $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
0426 $(LDLIBS)
0427 @if [ \( -f $(G4BINDIR)/$(G4TARGET) \) ]; then \
0428 echo "... Done!"; fi
0429 endif
0430
0431 # Touch the versioning file
0432 ifdef G4EXLIB
0433 $(G4TMPDIR)/exe/obj.last: lib $(objects)
0434 else
0435 $(G4TMPDIR)/exe/obj.last: $(objects)
0436 endif
0437 @$(TOUCH) $@
0438
0439 # Make the $(G4TARGET).$(TARGOBJEXT) file.
0440 $(G4TMPDIR)/exe/$(G4TARGET).$(TARGOBJEXT) : $(G4TARGET).cc
0441 ifdef CPPVERBOSE
0442 $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(APPFLAGS) \
0443 -c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).$(TARGOBJEXT) $(G4TARGET).cc
0444 else
0445 @echo Compiling $(G4TARGET).cc ...
0446 @$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(APPFLAGS) \
0447 -c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).$(TARGOBJEXT) $(G4TARGET).cc
0448 endif
0449
0450 GPPFLAGS := "-M"
0451
0452 # Make the $(G4TARGET).d file and include it.
0453
0454 # The ideas for this come from the GNU Make Manual, Section 4.12,
0455 # Generating Prerequisites Automatically. The g++ compiler has an
0456 # option -M or -MM to write to standard output a list of dependencies
0457 # based on the #include statements. The "sed" adds the dependency
0458 # file itself as a second target. The result is a mini-makefile which
0459 # specifies the .o and .d files as targets which depend on all the
0460 # files found through the #include statements. This file is then
0461 # included, causing GNU Make to honour these dependencies.
0462
0463 # The "set -e" causes the shell to exit with an error when the "g++"
0464 # fails (otherwise it would only notice the last command in the
0465 # pipeline, namely "sed"). GNU Make notices the error and exits
0466 # sooner than it otherwise would (still not as soon as I expect,
0467 # though!). Even then, an empty file is made, so "[ -s $@ ] || rm -f
0468 # $@" removes it ([ -s filename ] gives zero exit code only if file
0469 # exists and has a size greater than zero). This avoids making
0470 # corrupt .d files which would play havoc with your next build.
0471
0472 $(G4TMPDIR)/exe/$(G4TARGET).d: $(G4TARGET).cc
0473 @if [ ! -d $(G4TMP)/$(G4SYSTEM) ] ; then mkdir $(G4TMP)/$(G4SYSTEM) ;fi
0474 @if [ ! -d $(G4TMPDIR) ] ; then mkdir $(G4TMPDIR) ;fi
0475 @if [ ! -d $(G4TMPDIR)/exe ] ; then mkdir $(G4TMPDIR)/exe ;fi
0476 @echo Making dependency for file $< ...
0477 @set -e;\
0478 g++ $(GPPFLAGS) $(CPPFLAGS) -w $< |\
0479 sed 's!$(G4TARGET)\.$(TARGOBJEXT)!$(G4TMPDIR)/exe/& $@!' >$@;\
0480 [ -s $@ ] || rm -f $@
0481 ifneq ($(dependencies),)
0482 ifneq ($(MAKECMDGOALS),clean)
0483 ifneq ($(MAKECMDGOALS),setup)
0484 ifneq ($(MAKECMDGOALS),clean_setup)
0485 -include $(dependencies)
0486 endif
0487 endif
0488 endif
0489 endif
0490
0491 clean::
0492 @echo Cleaning up ...
0493 @rm -f ./core
0494 @rm -rf $(G4TMPDIR)
0495 @rm -f $(G4LIBDIR)/lib$(G4TARGET).a
0496 @rm -f $(G4BINDIR)/$(G4TARGET)
0497 ifdef CFRONT
0498 @rm -rf $(G4TREP)/exec
0499 endif
0500
0501 clean_bin::
0502 @echo Removing application $(G4TARGET) ...
0503 @rm -f ./core
0504 @rm -f $(G4BINDIR)/$(G4TARGET)