Skip to content

Commit

Permalink
Merge pull request #166 from JeffersonLab/fedora32_rebased
Browse files Browse the repository at this point in the history
Fedora32 rebased
  • Loading branch information
rjones30 authored Jul 31, 2020
2 parents 79b02bc + 72f922a commit 68cfc90
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
21 changes: 18 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------

include python_version.mk

name := hdgeant4
G4TARGET := $(name)
G4EXLIB := true
Expand Down Expand Up @@ -81,15 +83,21 @@ DANALIBS += -L$(ETROOT)/lib -let -let_remote
endif

G4shared_libs := $(wildcard $(G4ROOT)/lib64/*.so)
ifeq ($(PYTHON_GE_3), true)
BOOST_PYTHON_LIB = boost_python$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION)
else
BOOST_PYTHON_LIB = boost_python
endif

INTYLIBS += -Wl,--whole-archive $(DANALIBS) -Wl,--no-whole-archive
INTYLIBS += -fPIC -I$(HDDS_HOME) -I$(XERCESCROOT)/include
INTYLIBS += -L${XERCESCROOT}/lib -lxerces-c
INTYLIBS += -L$(G4TMPDIR) -lhdds
INTYLIBS += -lboost_python -L$(shell python-config --prefix)/lib $(shell python-config --ldflags)
INTYLIBS += -l$(BOOST_PYTHON_LIB) -L$(shell python-config --prefix)/lib $(shell python-config --ldflags)
INTYLIBS += -L$(G4ROOT)/lib64 $(patsubst $(G4ROOT)/lib64/lib%.so, -l%, $(G4shared_libs))
INTYLIBS += -lgfortran
INTYLIBS += -L/usr/lib64
INTYLIBS += -ltirpc

EXTRALIBS += -lG4fixes

Expand All @@ -115,7 +123,7 @@ G4fixes_symlink:

$(G4TMPDIR)/libcobrems.so: $(Cobrems_sources)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -Wl,--export-dynamic -Wl,-soname,libcobrems.so \
-shared -o $@ $^ $(G4shared_libs) -lboost_python
-shared -o $@ $^ $(G4shared_libs) -l$(BOOST_PYTHON_LIB)

hdgeant4_objects := $(patsubst src/%.cc, $(G4TMPDIR)/%.o, $(hdgeant4_sources))
G4fixes_objects := $(patsubst src/G4fixes/%.cc, $(G4FIXESDIR)/%.o, $(G4fixes_sources))
Expand All @@ -126,7 +134,7 @@ $(G4TMPDIR)/libhdgeant4.so: $(hdgeant4_objects)

$(G4TMPDIR)/libG4fixes.so: $(G4FIXESDIR)/G4fixes.o $(G4fixes_objects) $(G4debug_objects)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -Wl,--export-dynamic -Wl,-soname,libG4fixes.so \
-shared -o $@ $^ $(G4shared_libs) -lboost_python
-shared -o $@ $^ $(G4shared_libs) -l$(BOOST_PYTHON_LIB)

$(G4FIXESDIR)/G4fixes.o: src/G4fixes.cc
@mkdir -p $(G4FIXESDIR)
Expand Down Expand Up @@ -196,3 +204,10 @@ $(G4BINDIR)/genBH: src/utils/genBH.cc

$(G4BINDIR)/adapt: src/utils/adapt.cc
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ -L$(G4LIBDIR) -lhdgeant4 $(DANALIBS) $(ROOTLIBS) -Wl,-rpath=$(G4LIBDIR)

show_env:
@echo PYTHON_VERSION = $(PYTHON_VERSION)
@echo PYTHON_MAJOR_VERSION = $(PYTHON_MAJOR_VERSION)
@echo PYTHON_MINOR_VERSION = $(PYTHON_MINOR_VERSION)
@echo PYTHON_SUBMINOR_VERSION = $(PYTHON_SUBMINOR_VERSION)
@echo PYTHON_GE_3 = $(PYTHON_GE_3)
5 changes: 5 additions & 0 deletions python_version.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PYTHON_VERSION := $(shell python --version 2>&1 | head -1 | awk '{print $$2}')
PYTHON_MAJOR_VERSION := $(shell echo $(PYTHON_VERSION) | awk -F. '{print $$1}')
PYTHON_MINOR_VERSION := $(shell echo $(PYTHON_VERSION) | awk -F. '{print $$2}')
PYTHON_SUBMINOR_VERSION := $(shell echo $(PYTHON_VERSION) | awk -F. '{print $$3}')
PYTHON_GE_3 := $(shell if [ $(PYTHON_MAJOR_VERSION) -ge 3 ]; then echo true; else echo false; fi)

0 comments on commit 68cfc90

Please sign in to comment.