# Top-Level Makefile for G4beamline # (Constructed by configure -- DO NOT EDIT) include .config $(shell echo "G4beamline build begun $(shell date) VERSION=$(VERSION)" >&2) $(shell echo "============= G4beamline build begun $(shell date)" >>build/g4beamline/build.log) #$(shell if test -r lib/.complete; then echo "Building g4beamline Log is $(PWD)/build/g4beamline/build.log" >&2; fi) ### ### User targets ### all: bin/g4beamline $(SOURCE)/source/make-help @echo @( "$(G4BL_DIR)/bin/g4bldata" --check ; exit 0; ) @echo @echo "G4beamline build complete!" `date` @echo "There is no 'make install' -- programs must be run from here." @echo @echo "To run G4beamline do this:" @echo " source $$PWD/bin/g4bl-setup.sh" @echo " cd wherever..." @echo " g4bl input.file [args...]" @echo "(The first can be put into your $$HOME/.bash_profile)" help: @echo "make targets:" @echo " help This help text" @echo " all g4beamline itself, including libraries (default)" @echo " distrib Construct a binary distribution (for this OS)" @echo " clean Remove all g4beamline products; keep libraries" @echo " distclean Remove all products as if configure was never run" @echo " data Install the Geant4 data." clean: rm -f bin/g4beamline* build/g4beamline/* build/g4beamline/.complete distclean: rm -fr Makefile bin build doc examples include lib share test .config data: bin/g4bldata --install distrib: $(SOURCE)/source/make-help $(SOURCE)/source/distrib-$(SYSTEM) $(VERSION) install: @echo "There is no 'make install' -- programs must be run from this directory." @exit 1 ### ### Geant4 options to Cmake ### G4OPTS = ifeq ($(SYSTEM),WIN32) G4OPTS += -G "Unix Makefiles" endif G4OPTS += -DCMAKE_INSTALL_PREFIX="$(G4BL_DIR)" \ -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON \ -DGEANT4_USE_SYSTEM_EXPAT=ON \ -DGEANT4_USE_SYSTEM_CLHEP=ON -DCLHEP_ROOT_DIR=$(G4BL_DIR) ifeq ($(G4BL_DEBUG),y) G4OPTS += -DCMAKE_BUILD_TYPE=Debug endif ifeq ($(G4BL_VISUAL),y) # NOTE the code in BLVisManager.hh must #define the Geant4 Visualization driver # control variables inside a #ifdef G4BL_VISUAL. G4OPTS += -DGEANT4_USE_INVENTOR=ON \ -DINVENTOR_INCLUDE_DIR=$(G4BL_DIR)/include ifeq ($(SYSTEM),WIN32) G4OPTS += -DGEANT4_USE_OPENGL_WIN32=ON \ -DINVENTOR_LIBRARY_RELEASE=$(G4BL_DIR)/lib/libCoin.a \ -DINVENTOR_SOWIN_LIBRARY=$(G4BL_DIR)/lib/sowin.a else ifeq ($(SYSTEM),Darwin) G4OPTS += -DGEANT4_USE_OPENGL_X11=ON \ -DGEANT4_USE_XM=ON \ -DGEANT4_USE_RAYTRACER_X11=ON \ -DINVENTOR_LIBRARY_RELEASE=$(G4BL_DIR)/lib/libCoin.a \ -DINVENTOR_SOXT_LIBRARY=$(G4BL_DIR)/lib/libSoXt.a else G4OPTS += -DGEANT4_USE_OPENGL_X11=ON \ -DGEANT4_USE_XM=ON \ -DGEANT4_USE_RAYTRACER_X11=ON \ -DINVENTOR_LIBRARY_RELEASE=$(G4BL_DIR)/lib/libCoin.a \ -DINVENTOR_SOXT_LIBRARY=$(G4BL_DIR)/lib/libSoXt.a endif endif endif ### ### CPPFLAGS for compiling ### CPPFLAGS += $(shell $(G4BL_DIR)/bin/g4bl-config --include) ### ### general dependencies ### bin/g4beamline: build/g4beamline/.complete # libraries that are always needed build/geant4/.complete: build/clhep/.complete lib/.complete: build/clhep/.complete build/geant4/.complete \ build/gsl/.complete build/fftw/.complete # G4beamline objects G4BLOBJS = $(patsubst $(SOURCE)/source/src/%.cc,build/g4beamline/%.$(OBJEXT),$(wildcard $(SOURCE)/source/src/*.cc)) $(G4BLOBJS): lib/.complete build/g4beamline/.complete: $(G4BLOBJS) ### ### Libraries that depend on configuration options ### ifeq ($(G4BL_VISUAL),y) lib/.complete: build/coin/.complete build/so/.complete build/geant4/.complete: build/coin/.complete build/so/.complete build/so/.complete: build/coin/.complete endif ifeq ($(G4BL_ROOT),y) lib/.complete: build/root/.complete endif ifeq ($(G4BL_ROOT),bin) lib/.complete: build/root/.complete endif lib/.complete: @echo "All required libraries are now complete." @touch lib/.complete @echo "Building g4beamline Log is $(PWD)/build/g4beamline/build.log" build/g4beamline/.complete: @touch build/g4beamline/.complete ### ### G4beamline source dependencies ### G4BLDEPS = $(patsubst %.$(OBJEXT),%.d,$(G4BLOBJS)) -include $(G4BLDEPS) ### ### End of SYSTEM-independent Makefile ### ### ### Makefile for Linux ### build/clhep/.complete: @echo "Building CLHEP... Log is $(PWD)/build/clhep/build.log" @if test ! -d build/clhep; then mkdir build/clhep; fi -@(echo "================= `date`"; set -e -x; cd build/clhep; \ if test ! -r Makefile; then \ $(CLHEP)/CLHEP/configure --disable-shared --prefix=$(G4BL_DIR); \ fi; \ make -j $(NCPU); \ make install; \ ../../test/test40; \ touch .complete; \ cd ../..; rm -f lib/libCLHEP-[A-Z]*.a; \ ) >>build/clhep/build.log 2>&1 @if test -r build/clhep/.complete; then echo Building CLHEP complete.; \ else echo 'Building CLHEP FAILED *****'; exit 1; fi build/geant4/.complete: @echo "Building Geant4... Log is $(PWD)/build/geant4/build.log" @if test ! -d build/geant4; then mkdir build/geant4; fi -@(echo "================= `date`"; set -e -x; cd build/geant4; \ if test ! -r Makefile; then cmake $(G4OPTS) $(GEANT4); fi; \ make -j $(NCPU); \ make install; \ touch .complete; \ ) >>build/geant4/build.log 2>&1 @if test -r build/geant4/.complete; then echo Building Geant4 complete.; \ else echo 'Building Geant4 FAILED *****'; exit 1; fi build/gsl/.complete: @echo "Building GSL... Log is $(PWD)/build/gsl/build.log" @if test ! -d build/gsl; then cp -Rp $(GSL) build/gsl; fi -@(echo "================= `date`"; set -e -x; cd build/gsl; \ ./configure --prefix=$(G4BL_DIR) --disable-shared --enable-static; \ make -j $(NCPU); \ make install; \ touch .complete; \ ) >>build/gsl/build.log 2>&1 @if test -r build/gsl/.complete; then echo Building GSL complete.; \ else echo 'Building GSL FAILED *****'; exit 1; fi build/fftw/.complete: @echo "Building FFTW... Log is $(PWD)/build/fftw/build.log" @if test ! -d build/fftw; then cp -Rp $(FFTW) build/fftw; fi -@(echo "================= `date`"; set -e -x; cd build/fftw; \ ./configure --prefix=$(G4BL_DIR) --disable-shared --enable-static \ --enable-float --disable-dependency-tracking \ --disable-fortran; \ make -j $(NCPU); \ make install; \ touch .complete; \ ) >>build/fftw/build.log 2>&1 @if test -r build/fftw/.complete; then echo Building FFTW complete.; \ else echo 'Building FFTW FAILED *****'; exit 1; fi build/coin/.complete: @echo "Building Coin... Log is $(PWD)/build/coin/build.log" @if test ! -d build/coin; then cp -Rp $(COIN) build/coin; fi -@(echo "================= `date`"; set -e -x; cd build/coin; \ ./configure --prefix=$(G4BL_DIR) --enable-system-expat \ --without-openal --disable-sound --disable-shared \ --enable-static --disable-debug; \ make -j $(NCPU); \ make install; \ touch .complete; \ ) >>build/coin/build.log 2>&1 @if test -r build/coin/.complete; then echo Building Coin complete.; \ else echo 'Building Coin FAILED *****'; exit 1; fi build/so/.complete: @echo "Building SoXt... Log is $(PWD)/build/so/build.log" @if test ! -d build/so; then cp -Rp $(SOXT) build/so; fi -@(echo "================= `date`"; set -e -x; cd build/so; \ if test ! -r Makefile; then \ ./configure --prefix=$(G4BL_DIR) --disable-shared \ --enable-static --disable-debug \ --disable-sound --with-coin=$(G4BL_DIR); \ fi; \ make -j $(NCPU); \ make install; \ touch .complete; \ ) >>build/so/build.log 2>&1 @if test -r build/so/.complete; then echo Building SoXt complete.; \ else echo 'Building SoXt FAILED *****'; exit 1; fi build/root/.complete: @echo "Building Root... Log is $(PWD)/build/root/build.log" @if test ! -d build/root; then cp -Rp $(ROOT) build/root; fi @# make -j 4 may fail, but a second one succeeds, so use 3 of them -@(echo "================= `date`"; set -e -x; cd build/root; \ if test ! -r config.status; then ./configure; fi; \ make -j $(NCPU) || make -j $(NCPU) || make -j 1; \ cp -p lib/libCore.so $(G4BL_DIR)/lib; \ cp -p lib/libCint.so $(G4BL_DIR)/lib; \ cp -p lib/libMathCore.so $(G4BL_DIR)/lib; \ cp -p lib/libNet.so $(G4BL_DIR)/lib; \ cp -p lib/libRIO.so $(G4BL_DIR)/lib; \ cp -p lib/libThread.so $(G4BL_DIR)/lib; \ cp -p lib/libTree.so $(G4BL_DIR)/lib; \ if test ! -d $(G4BL_DIR)/include/root; then \ mkdir $(G4BL_DIR)/include/root; fi; \ cp -Rp include/* $(G4BL_DIR)/include/root; \ touch .complete; \ ) >>build/root/build.log 2>&1 @if test -r build/root/.complete; then echo Building Root complete.; \ else echo 'Building Root FAILED *****'; exit 1; fi # g4bl-config knows which libraries are needed by the configuration LIBS = $(shell $(G4BL_DIR)/bin/g4bl-config --libs) MAIN = $(shell $(G4BL_DIR)/bin/g4bl-config --main) bin/g4beamline: $(G4BLOBJS) $(SOURCE)/source/g4beamline.cc @echo Linking g4beamline @(set -e -x; \ $(CXX) -o bin/g4beamline $(CPPFLAGS) $(MAIN) $(G4BLOBJS) $(LIBS) \ ) >>build/g4beamline/build.log 2>&1 ### ### rule to compile G4beamline source and create its dependency file ### build/g4beamline/%.$(OBJEXT): $(SOURCE)/source/src/%.cc @echo Compiling `basename $<` @(set -e -x; \ $(CXX) $(CPPFLAGS) -c -o $@ $<; \ g++ $(CPPFLAGS) -MM -MP -MT $@ $< >$(patsubst %.$(OBJEXT),%.d,$@) \ ) >>build/g4beamline/build.log 2>&1