Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -0,0 +1,32 @@
# $Id: G4PEXsetup.gmk,v 1.1 2002/12/04 02:44:27 morita Exp $
# =====================================================================
# FADSsetup.gmk: GNUmakefile variables for FADS
#
# Author: Youhei Morita <youhei.morita@kek.jp>
# =====================================================================
#
ifndef G4PEX_WORKDIR
G4PEX_WORKDIR := $(G4PEX_DIR)
endif
ifndef G4PEX_LIB
G4PEX_LIB := $(G4PEX_WORKDIR)/lib/$(G4SYSTEM)
endif
ifndef G4PEX_BIN
G4PEX_BIN := $(G4PEX_WORKDIR)/bin/$(G4SYSTEM)
endif
ifndef G4PEX_TMP
G4PEX_TMP := $(G4PEX_WORKDIR)/tmp/$(G4SYSTEM)/$(name)
endif
DUMMY := $(shell if [ ! -d $(G4PEX_LIB) ] ; then mkdir -p $(G4PEX_LIB) ;fi)
DUMMY := $(shell if [ ! -d $(G4PEX_BIN) ] ; then mkdir -p $(G4PEX_BIN) ;fi)
DUMMY := $(shell if [ ! -d $(G4PEX_TMP) ] ; then mkdir -p $(G4PEX_TMP) ;fi)
include $(G4INSTALL)/config/architecture.gmk
G4ROOTIO := $(G4PEX_DIR)/config/g4rootio.pl
PROG_ROOTCONFIG = $(ROOTSYS)/bin/root-config
PROG_ROOTCINT = $(ROOTSYS)/bin/rootcint
@@ -0,0 +1,235 @@
# $Id: binmake.gmk,v 1.4 2002/12/04 17:54:25 morita Exp $
# =====================================================================
# binmake.gmk: GNUmakefile variables for creating the binary executable
#
# Author: Youhei Morita <youhei.morita@kek.jp>
# =====================================================================
ifndef TARGET
TARGET := $(name)
endif
# Geant4 variables
include $(G4INSTALL)/config/G4UI_USE.gmk
include $(G4INSTALL)/config/G4VIS_USE.gmk
include $(G4INSTALL)/config/interactivity.gmk
include $(G4INSTALL)/config/analysis.gmk
ifdef G4DEBUG
CXXFLAGS += -g
endif
# dependency option
GPPFLAGS := "-MM"
headers := $(wildcard include/*.hh)
sources := $(wildcard src/*.cc)
objects := $(patsubst src/%.cc,$(G4PEX_TMP)/%.o,$(sources))
dependencies := $(patsubst src/%.cc,$(G4PEX_TMP)/%.d,$(sources))
ifneq ($(G4LIB_BUILD_SHARED),)
library_name := lib$(TARGET).so
endif
ifneq ($(G4LIB_BUILD_STATIC),)
library_name := lib$(TARGET).a
endif
ifneq ($(sources),)
libraries_to_build := $(G4PEX_LIB)/$(library_name)
else
libraries_to_build :=
endif
# linker option (refer to Standard Installation)
ifdef G4LIB_BUILD_SHARED
LDOPTION := -Wl,-rpath $(G4PEX_LIB) \
-Wl,-rpath $(G4LIB)/$(G4SYSTEM) \
-Wl,-rpath $(CLHEP_BASE_DIR)/lib \
-Wl,-rpath $(ROOTSYS)/lib
endif
# libraries path
LDFLAGS := -L$(G4PEX_LIB) \
-L$(G4LIB)/$(G4SYSTEM) \
-L$(CLHEP_BASE_DIR)/lib \
-L$(ROOTSYS)/lib
# extra LDFLAGS
ifneq ($(EXTLDFLAGS),)
LDFLAGS += $(EXTLDFLAGS)
endif
# libraries
LDLIBS := $(libraries_to_build) \
-lG4ROOTIO
g4libs := $(wildcard $(G4LIB)/$(G4SYSTEM)/*.so)
g4libs := $(patsubst $(G4LIB)/$(G4SYSTEM)/lib%.so,-l%,$(g4libs))
g4libs := $(patsubst -lG3toG4,,$(g4libs))
LDLIBS += $(g4libs)
LDLIBS += $(INTYLIBS)
LDLIBS += $(ANALYSISLIBS)
# external packagers
LDLIBS += -lCLHEP
# ROOT
LDLIBS += -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint \
-lPostscript -lMatrix -lPhysics
# etc
LDLIBS += -lm -ldl
.PHONY: all lib bin clean test
all: lib bin
bin: $(G4PEX_BIN)/$(TARGET)
lib: $(libraries_to_build)
# ---------------------------------------------------------------------
CPPFLAGS += $(shell root-config --cflags)
# ROOTCINT LinkDef.h and Dict.cc files
root_def := include/$(name)LinkDef.h
root_dict := $(G4PEX_TMP)/$(name)Dict.cc
root_dict_o := $(root_dict:.cc=.o)
# rootio files
rootio_file := $(wildcard rootio/*.rootio)
rootio_hh := $(patsubst rootio/%.rootio, include/%Root.hh, $(rootio_file))
rootio_hh += $(patsubst rootio/%.rootio, include/%sRoot.hh, $(rootio_file))
rootio_hh += $(patsubst rootio/%.rootio, include/%RootIO.hh, $(rootio_file))
rootio_cc := $(patsubst rootio/%.rootio, src/%Root.cc, $(rootio_file))
rootio_cc += $(patsubst rootio/%.rootio, src/%sRoot.cc, $(rootio_file))
rootio_cc += $(patsubst rootio/%.rootio, src/%RootIO.cc, $(rootio_file))
rootio_d := $(patsubst rootio/%.rootio, $(G4PEX_TMP)/%Root.d, $(rootio_file))
rootio_d += $(patsubst rootio/%.rootio, $(G4PEX_TMP)/%sRoot.d, $(rootio_file))
rootio_d += $(patsubst rootio/%.rootio, $(G4PEX_TMP)/%RootIO.d, $(rootio_file))
ifneq ($(rootio_file),)
root_hh := $(patsubst rootio/%.rootio, include/%Root.hh, $(rootio_file))
root_hh += $(patsubst rootio/%.rootio, include/%sRoot.hh, $(rootio_file))
else
ifneq ($(headers),)
root_hh := $(shell grep 'public.*TObject' include/*.hh|awk -F: '{print $$1}'|sort|uniq)
endif
endif
root_tmp := $(patsubst include/%,%,$(root_hh))
root_tmp += $(patsubst include/%,%,$(root_def))
root_name := $(patsubst include/%.hh,%,$(root_hh))
.PRECIOUS: $(dependencies) $(rootio_hh) $(rootio_cc) $(rootio_d)
ifneq ($(rootio_file),)
objects += $(patsubst rootio/%.rootio,$(G4PEX_TMP)/%Root.o, $(rootio_file))
objects += $(patsubst rootio/%.rootio,$(G4PEX_TMP)/%sRoot.o, $(rootio_file))
objects += $(patsubst rootio/%.rootio,$(G4PEX_TMP)/%RootIO.o, $(rootio_file))
objects += $(root_dict_o)
cleanup_target := $(rootio_hh) $(rootio_cc) $(root_def)
endif
ifneq ($(root_hh),)
include/%Root.hh include/%sRoot.hh include/%RootIO.hh src/%Root.cc src/%sRoot.cc src/%RootIO.cc: rootio/%.rootio
$(G4ROOTIO) $<
$(root_dict): $(root_hh) $(root_def)
ifdef CPPVERBOSE
cp -f $^ $(G4PEX_TMP)/
( cd $(G4PEX_TMP); \
$(PROG_ROOTCINT) -f $@ -c $(CINT_INCLUDES) -p $(root_tmp) )
( cd $(G4PEX_TMP); rm -f $(root_tmp) )
else
@echo "Generating dictionary $(root_dict) ..."
@cp -f $^ $(G4PEX_TMP)/
@( cd $(G4PEX_TMP); \
$(PROG_ROOTCINT) -f $@ -c $(CINT_INCLUDES) -p $(root_tmp) )
@( cd $(G4PEX_TMP); rm -f $(root_tmp) )
endif
$(root_def): $(root_hh)
$(G4PEX_DIR)/config/rootdict.sh "$(root_name)" $(root_def)
endif
$(root_dict_o): $(root_dict)
@echo "Compiling $< with $(CXX) ..."
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
# ---------------------------------------------------------------------
$(G4PEX_BIN)/$(TARGET): $(G4PEX_TMP)/$(TARGET).o $(libraries_to_build)
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $< \
$(LDOPTION) \
$(LDFLAGS) $(LDLIBS)
else
@echo Linking $(TARGET) ...
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $< \
$(LDOPTION) \
$(LDFLAGS) $(LDLIBS)
endif
$(G4PEX_TMP)/$(TARGET).o: $(TARGET).cc $(G4PEX_TMP)/$(TARGET).d
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
else
@echo "Compiling $< with $(CXX) ..."
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
endif
$(G4PEX_TMP)/$(TARGET).d: $(TARGET).cc
@echo "Making dependency file for $< ..."
@($(ECHO) $(G4PEX_TMP)/\\c ; \
g++ $(GPPFLAGS) $(CPPFLAGS) $< ) | sed 's!$(G4PEX_TMP)/$*.o!& $@!' >$@
ifneq ($(dependencies),)
-include $(dependencies)
endif
$(libraries_to_build): $(objects)
ifneq ($(G4LIB_BUILD_SHARED),)
@echo Creating shared library $@
@rm -f $(G4PEX_LIB)/lib$(TARGET).so
@cd $(G4PEX_TMP); \
$(CXX) -Wl,-soname,lib$(TARGET).so \
-shared -o $(G4PEX_LIB)/lib$(TARGET).so *.o \
$(EXTLDFLAGS) $(EXTLIBS)
endif
ifneq ($(G4LIB_BUILD_STATIC),)
@echo Creating static library $@
@rm -f $(G4PEX_LIB)/lib$(TARGET).a
$(AR) $(G4PEX_LIB)/lib$(TARGET).a $(G4PEX_TMP)/*.o
@if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then \
ranlib $(G4PEX_LIB)/lib$(TARGET).a ;fi
endif
$(G4PEX_TMP)/%.o: src/%.cc $(G4PEX_TMP)/%.d
@echo "Compiling $< with $(CXX) ..."
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
$(G4PEX_TMP)/%.d: src/%.cc
@echo "Making dependency file for $< ..."
@($(ECHO) $(G4PEX_TMP)/\\c ; \
g++ $(GPPFLAGS) $(CPPFLAGS) $< ) | sed 's!$(G4PEX_TMP)/$*.o!& $@!' >$@
clean:
ifneq ($(cleanup_target),)
@rm -f $(cleanup_target)
endif
@rm -f $(G4PEX_DIR)/bin/$(G4SYSTEM)/$(TARGET)
ifneq ($(libraries_to_build),)
@rm -f -r $(G4PEX_DIR)/lib/$(G4SYSTEM)/$(libraries_to_build)
endif
@rm -f -r $(G4PEX_DIR)/tmp/$(G4SYSTEM)/$(TARGET)
distclean: clean
@rm -f G4defaultOutput G4run0001.root G4History.macro core* .DAWN*.history g4_*.prim
@@ -0,0 +1,158 @@
# $Id: common.gmk,v 1.2 2002/12/04 09:39:24 morita Exp $
# =====================================================================
# common.gmk: GNUmakefile variables for building the library files.
#
# Author: Youhei Morita <youhei.morita@kek.jp>
# =====================================================================
ifndef TARGET
TARGET := $(name)
endif
ifdef G4DEBUG
CXXFLAGS += -g
endif
GPPFLAGS := "-MM"
CPPFLAGS += -Iinclude \
-I$(G4INSTALL)/include \
-I$(CLHEP_BASE_DIR)/include
sources := $(wildcard src/*.cc)
objects := $(patsubst src/%.cc,$(G4PEX_TMP)/%.o,$(sources))
dependencies := $(patsubst src/%.cc,$(G4PEX_TMP)/%.d,$(sources))
ifneq ($(G4LIB_BUILD_SHARED),)
library_name := lib$(TARGET).so
endif
ifneq ($(G4LIB_BUILD_STATIC),)
library_name := lib$(TARGET).a
endif
libraries_to_build := $(G4PEX_LIB)/$(library_name)
.PHONY: all lib includes clean_lib clean
all: lib
lib: $(libraries_to_build)
# ---------------------------------------------------------------------
# make ROOT I/O files
#include $(G4PEX_DIR)/config/rootio.gmk
# ---------------------------------------------------------------------
CPPFLAGS += $(shell root-config --cflags)
# ROOTCINT LinkDef.h and Dict.cc files
root_def := include/$(name)LinkDef.h
root_dict := $(G4PEX_TMP)/$(name)Dict.cc
root_dict_o := $(root_dict:.cc=.o)
objects += $(root_dict_o)
# rootio files
rootio_file := $(wildcard rootio/*.rootio)
rootio_hh := $(patsubst rootio/%.rootio, include/%Root.hh, $(rootio_file))
rootio_hh += $(patsubst rootio/%.rootio, include/%sRoot.hh, $(rootio_file))
rootio_hh += $(patsubst rootio/%.rootio, include/%RootIO.hh, $(rootio_file))
rootio_cc := $(patsubst rootio/%.rootio, src/%Root.cc, $(rootio_file))
rootio_cc += $(patsubst rootio/%.rootio, src/%sRoot.cc, $(rootio_file))
rootio_cc += $(patsubst rootio/%.rootio, src/%RootIO.cc, $(rootio_file))
# search for TObject inheritance with a regexp 'public.*TObject'
root_hh := $(shell grep 'public.*TObject' include/*.hh|awk -F: '{print $$1}'|sort|uniq)
ifneq ($(rootio_file),)
root_hh += $(patsubst rootio/%.rootio, include/%Root.hh, $(rootio_file))
root_hh += $(patsubst rootio/%.rootio, include/%sRoot.hh, $(rootio_file))
endif
root_tmp := $(patsubst include/%,%,$(root_hh))
root_tmp += $(patsubst include/%,%,$(root_def))
root_name := $(patsubst include/%.hh,%,$(root_hh))
.PRECIOUS: $(dependencies) $(rootio_hh) $(rootio_cc)
ifneq ($(rootio_file),)
objects += $(patsubst rootio/%.rootio,$(G4PEX_TMP)/%Root.o, $(rootio_file))
objects += $(patsubst rootio/%.rootio,$(G4PEX_TMP)/%sRoot.o, $(rootio_file))
objects += $(patsubst rootio/%.rootio,$(G4PEX_TMP)/%RootIO.o, $(rootio_file))
objects += $(root_dict_o)
cleanup_target := $(rootio_hh) $(rootio_cc) $(root_def)
endif
ifneq ($(root_hh),)
include/%Root.hh include/%sRoot.hh include/%RootIO.hh src/%Root.cc src/%sRoot.cc src/%RootIO.cc: rootio/%.rootio
$(G4ROOTIO) $<
$(root_dict): $(root_hh) $(root_def)
ifdef CPPVERBOSE
cp -f $^ $(G4PEX_TMP)/
( cd $(G4PEX_TMP); \
$(PROG_ROOTCINT) -f $@ -c $(CINT_INCLUDES) -p $(root_tmp) )
( cd $(G4PEX_TMP); rm -f $(root_tmp) )
else
@echo "Generating dictionary $(root_dict) ..."
@cp -f $^ $(G4PEX_TMP)/
@( cd $(G4PEX_TMP); \
$(PROG_ROOTCINT) -f $@ -c $(CINT_INCLUDES) -p $(root_tmp) )
@( cd $(G4PEX_TMP); rm -f $(root_tmp) )
endif
$(root_def): $(root_hh)
$(G4PEX_DIR)/config/rootdict.sh "$(root_name)" $(root_def)
endif
$(root_dict_o): $(root_dict)
@echo "Compiling $< with $(CXX) ..."
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
# ---------------------------------------------------------------------
$(libraries_to_build): $(objects)
ifneq ($(G4LIB_BUILD_SHARED),)
@echo Creating shared library $@
@rm -f $(G4PEX_LIB)/lib$(TARGET).so
@cd $(G4PEX_TMP); \
$(CXX) -Wl,-soname,lib$(TARGET).so \
-shared -o $(G4PEX_LIB)/lib$(TARGET).so *.o \
$(EXTLDFLAGS) $(EXTLIBS)
endif
ifneq ($(G4LIB_BUILD_STATIC),)
@echo Creating static library $@
@rm -f $(G4PEX_LIB)/lib$(TARGET).a
$(AR) $(G4PEX_LIB)/lib$(TARGET).a $(G4PEX_TMP)/*.o
@if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then \
ranlib $(G4PEX_LIB)/lib$(TARGET).a ;fi
endif
$(G4PEX_TMP)/%.o: src/%.cc $(G4PEX_TMP)/%.d
@echo "Compiling $< with $(CXX) ..."
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
$(G4PEX_TMP)/%.d: src/%.cc
@echo "Making dependency file for $< ..."
@($(ECHO) $(G4PEX_TMP)/\\c ; \
g++ $(GPPFLAGS) $(CPPFLAGS) $< ) | sed 's!$(G4PEX_TMP)/$*.o!& $@!' >$@
ifneq ($(dependencies),)
-include $(dependencies)
endif
clean:
ifneq ($(cleanup_target),)
@rm -f $(cleanup_target)
endif
@rm -f -r $(G4PEX_DIR)/lib/$(G4SYSTEM)/$(libraries_to_build)
@rm -f -r $(G4PEX_DIR)/tmp/$(G4SYSTEM)/$(TARGET)
test:
@echo "objects = $(objects)"
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
#! /bin/csh -f
mkdir -p $G4PEX_DIR/tmp/$G4SYSTEM/.hepmc
set test_src = $G4PEX_DIR/tmp/$G4SYSTEM/.hepmc/qhepmc.cc
set test_obj = $G4PEX_DIR/tmp/$G4SYSTEM/.hepmc/qhepmc.o
cat > $test_src << +EOF
#include "HepMC/GenVertex.h"
int main()
{
HepMC::GenVertex av;
av.barcode();
}
+EOF
g++ -c -I$HEPMC_DIR -I$CLHEP_BASE_DIR/include $test_src \
-o $test_obj >& /dev/null
set qbar=$status
\rm -r $G4PEX_DIR/tmp/$G4SYSTEM/.hepmc
if ( $qbar == 0 ) then
echo true
else
echo false
endif
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
class="$1"
dict="$2"
if [ "$class" = "" ]; then
echo "Usage: `basename $0` 'class names' [ dict_file ]"
exit 1
fi
if [ "$dict" = "" ]; then
dict="DefaultLinkDef.h"
fi
echo "Creating ROOTCINT LinkDef $2 for classes $1"
echo "#ifdef __CINT__" > $dict
echo "" >> $dict
echo "#pragma link off all globals;" >> $dict
echo "#pragma link off all classes;" >> $dict
echo "#pragma link off all functions;" >> $dict
echo "" >> $dict
for name in $class ; do
echo "#pragma link C++ class ${name};" >> $dict
done
echo "" >> $dict
echo "#endif" >> $dict
@@ -0,0 +1,37 @@
# $Id: rootio.gmk,v 1.1 2002/12/04 02:44:27 morita Exp $
# =====================================================================
# rootio.gmk: GNUmakefile variables for building the ROOT I/O files.
#
# Author: Youhei Morita <youhei.morita@kek.jp>
# =====================================================================
CPPFLAGS += $(shell root-config --cflags)
CINT_INCLUDES := \
-Iinclude \
-I$(G4INSTALL)/include \
-I$(ROOTSYS)/include
# ROOTCINT LinkDef.h and Dict.cc files
root_def := include/$(name)LinkDef.h
root_dict := $(G4PEX_TMP)/$(name)Dict.cc
root_dict_o := $(patsubst %.cc,%.o,$(root_dict))
# search for TObject inheritance with a regexp 'public.*TObject'
root_hh := $(shell grep 'public.*TObject' include/*.hh|awk -F: '{print $$1}'|sort|uniq)
root_tmp := $(patsubst include/%,%,$(root_hh))
root_tmp += $(patsubst include/%,%,$(root_def))
root_name := $(patsubst include/%.hh,%,$(root_hh))
$(root_dict): $(root_hh) $(root_def)
@echo "Generating dictionary $(root_dict) ..."
@(cp $^ $(G4PEX_TMP)/ ; \
cd $(G4PEX_TMP) ; \
rootcint -f $@ -c $(CINT_INCLUDES) $(root_tmp) ; \
rm -f $(root_tmp) )
$(root_def): $(root_hh)
@$(G4PEX_DIR)/config/rootdict.sh "$(root_name)" $(root_def)