[1337] | 1 | # $Id: linux.gmk,v 1.9 2008/12/01 10:14:36 kmura Exp $ |
---|
| 2 | # $Name: geant4-09-04-beta-01 $ |
---|
| 3 | # =========================================================== |
---|
| 4 | # System specific terms |
---|
| 5 | # =========================================================== |
---|
| 6 | |
---|
| 7 | # compile flags |
---|
| 8 | CXX := g++ -m32 |
---|
| 9 | |
---|
| 10 | ifdef COMPILE_WITH_BOOST |
---|
| 11 | CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline |
---|
| 12 | CXXFLAGS += -fpermissive |
---|
| 13 | CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB |
---|
| 14 | CXXFLAGS += -O2 |
---|
| 15 | ifndef DEBUG |
---|
| 16 | CXXFLAGS += -DNDEBUG |
---|
| 17 | endif |
---|
| 18 | else |
---|
| 19 | CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long |
---|
| 20 | CXXFLAFS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe |
---|
| 21 | CXXFLAGS += -fPIC |
---|
| 22 | CXXFLAGS += -O2 |
---|
| 23 | endif |
---|
| 24 | |
---|
| 25 | ifdef COMPILE_G4PY |
---|
| 26 | CXXFLAGS := -fPIC -ansi -pipe |
---|
| 27 | CXXFLAGS += -ftemplate-depth-255 -finline-functions |
---|
| 28 | CXXFLAGS += -fpermissive |
---|
| 29 | CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB |
---|
| 30 | CXXFLAGS += -O2 |
---|
| 31 | ifndef DEBUG |
---|
| 32 | CXXFLAGS += -DNDEBUG |
---|
| 33 | endif |
---|
| 34 | endif |
---|
| 35 | |
---|
| 36 | # extention of shared library |
---|
| 37 | soext := so |
---|
| 38 | modext := so |
---|
| 39 | |
---|
| 40 | # implicit rules |
---|
| 41 | %.o: %.cc |
---|
| 42 | ifdef CPPVERBOSE |
---|
| 43 | $(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc |
---|
| 44 | else |
---|
| 45 | @echo Compiling $< ... |
---|
| 46 | @$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc |
---|
| 47 | endif |
---|
| 48 | |
---|
| 49 | %.pyc: %.py; python -c 'import py_compile; py_compile.compile( "$<" )' |
---|
| 50 | %.pyo: %.py; python -O -c 'import py_compile; py_compile.compile( "$<" )' |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | # building a shared library |
---|
| 54 | ifdef Q_BOOST_LIBDIR |
---|
| 55 | rpath0 := $(Q_BOOST_LIBDIR) |
---|
| 56 | endif |
---|
| 57 | |
---|
| 58 | ifdef COMPILE_G4PY |
---|
| 59 | rpath1 := $(Q_G4_LIBDIR) |
---|
| 60 | ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR)) |
---|
| 61 | rpath2 := $(Q_CLHEP_LIBDIR) |
---|
| 62 | endif |
---|
| 63 | endif |
---|
| 64 | |
---|
| 65 | ifdef G4PY_EXLIB_LIBDIR |
---|
| 66 | rpath3 := $(G4PY_EXLIB_LIBDIR) |
---|
| 67 | endif |
---|
| 68 | |
---|
| 69 | rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3) |
---|
| 70 | |
---|
| 71 | ifdef CPPVERBOSE |
---|
| 72 | define build-library |
---|
| 73 | $(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) |
---|
| 74 | endef |
---|
| 75 | else |
---|
| 76 | define build-library |
---|
| 77 | @echo Building a library $@ ... |
---|
| 78 | @$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) |
---|
| 79 | endef |
---|
| 80 | endif |
---|
| 81 | |
---|
| 82 | ifdef CPPVERBOSE |
---|
| 83 | define build-module |
---|
| 84 | $(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT) |
---|
| 85 | endef |
---|
| 86 | else |
---|
| 87 | define build-module |
---|
| 88 | @echo Building a module $@ ... |
---|
| 89 | @$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT) |
---|
| 90 | endef |
---|
| 91 | endif |
---|
| 92 | |
---|