# $Id: linux.gmk,v 1.6 2007/11/13 08:04:34 kmura Exp $ # $Name: geant4-09-01 $ # =========================================================== # System specific terms # =========================================================== # compile flags CXX := g++ -m32 ifdef COMPILE_WITH_BOOST CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB CXXFLAGS += -O2 ifndef DEBUG CXXFLAGS += -DNDEBUG endif else CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long CXXFLAFS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe CXXFLAGS += -fPIC CXXFLAGS += -O2 endif ifdef COMPILE_G4PY CXXFLAGS := -fPIC -ansi -pipe CXXFLAGS += -ftemplate-depth-255 -finline-functions CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB CXXFLAGS += -O2 ifndef DEBUG CXXFLAGS += -DNDEBUG endif endif # extention of shared library soext := so modext := so # implicit rules %.o: %.cc ifdef CPPVERBOSE $(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc else @echo Compiling $< ... @$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc endif %.pyc: %.py; python -c 'import py_compile; py_compile.compile( "$<" )' %.pyo: %.py; python -O -c 'import py_compile; py_compile.compile( "$<" )' # building a shared library ifdef Q_BOOST_LIBDIR rpath0 := $(Q_BOOST_LIBDIR) endif ifdef G4PY_EXLIB_LIBDIR rpath1 := $(G4PY_EXLIB_LIBDIR) endif ifdef COMPILE_G4PY #rpath2 := $(Q_G4_LIBDIR):$(Q_CLHEP_LIBDIR) ifneq ($(Q_G4_LIBDIR), $(BOOST_LIBDIR)) rpath2 := $(Q_G4_LIBDIR) endif ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR)) rpath3 := $(Q_CLHEP_LIBDIR) endif ifeq ($(Q_ENABLE_GDML), 1) ifneq ($(Q_GDML_LIBDIR), $(Q_G4_LIBDIR)) rpath3 += :$(Q_GDML_LIBDIR) endif endif rpath4 := $(Q_LIBDIR) endif rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3):$(rpath4) ifdef CPPVERBOSE define build-library $(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) endef else define build-library @echo Building a library $@ ... @$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) endef endif ifdef CPPVERBOSE define build-module $(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT) endef else define build-module @echo Building a module $@ ... @$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT) endef endif