-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathGNUmakefile
More file actions
114 lines (85 loc) · 3.24 KB
/
GNUmakefile
File metadata and controls
114 lines (85 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# --------------------------------------------------------------
# GNUmakefile for ACTARSIM module. Hector Alvarez Pol, 01/06/05.
# Following the examples module GNUMakefile.
# ACTARSIM
# --------------------------------------------------------------
name := actarsim
G4TARGET := $(name)
G4EXLIB := true
G4TMPDIR = $(G4TMP)/$(G4SYSTEM)/$(name)
ifndef G4INSTALL
G4INSTALL = ../../..
endif
#Checking OS
UNAME_S := $(shell uname -s)
.PHONY: all
all: lib bin sharedlib
include $(G4INSTALL)/config/binmake.gmk
####### ROOT includes and libs (in case G4UIROOT is not defined) ########
ifndef INC_ROOT
CPPFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags)
endif
ifndef LOAD_ROOT
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs) -lMinuit -lHtml
ROOTLIBS := $(filter-out -lNew,$(ROOTLIBS))
# ROOTLIBS := $(filter-out -lThread,$(ROOTLIBS))
ROOTLIBS := $(filter-out -lpthread,$(ROOTLIBS))
INTYLIBS += $(ROOTLIBS)
endif
##########################################################################
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
outclean:
rm -f *~ *.rndm simFile.root
######################## ROOT dictionary ################################
#Inspired in Isidro Gonzalez GNUmakefile in his G4UIROOT interface!!
# Root Headers
ROOTHDRS := ActarSimData.hh ActarSimTrack.hh ActarSimSimpleTrack.hh ActarSimSciHit.hh ActarSimSilHit.hh ActarSimPrimaryInfo.hh ActarSimBeamInfo.hh
ROOTHDRSWITHPATH := $(patsubst %.hh,include/%.hh,$(ROOTHDRS))
# Make library depend on the root dictionary object file also
$(G4LIBDIR)/lib$(name).$(SHEXT): $(G4TMPDIR)/obj.last \
$(G4TMPDIR)/ActarSimDict.o
$(G4TMPDIR)/ActarSimDict.o: src/ActarSimDict.cc $(G4TMPDIR)/ActarSimDict.d
# Produce the dictionary file
src/ActarSimDict.cc: $(ROOTHDRSWITHPATH) \
src/ActarSimLinkDef.hh \
$(ROOTSYS)/include/RVersion.h
@echo Making Root Dictionary...
ifdef CPPVERBOSE
cd src; rootcint -f ActarSimDict.cc -c -p -I../include $(ROOTHDRS) ActarSimLinkDef.hh
else
@cd src; rootcint -f ActarSimDict.cc -c -p -I../include $(ROOTHDRS) ActarSimLinkDef.hh
endif
# Clean up root dictionary
cleandict: src/ActarSimDict.cc
@echo Removing Root dictionary and shared library...
@rm -f src/ActarSimDict.*
@rm -f $(G4TMPDIR)/ActarSimDict.*
@rm -f actarsim.sl
# Make clean target clean de dictionary files...
#clean: cleandict
################ A SHARED LIBRARY WITH THE DATA DEFINITION FOR ROOT ######
#Hector Alvarez GNUmakefile: TESTING A SHARED LIBRARY ONLY FOR ROOT
CXXSHAREDFLAGS = -g -I$(ROOTSYS)/include
ifeq ($(UNAME_S),Linux)
LDSHAREDFLAGS= -Wl,-soname, -shared -o
endif
ifeq ($(UNAME_S),Darwin)
LDSHAREDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -o
endif
#LDSHAREDFLAGS = -g
LDSHARED = g++
SHAREDLIB = actarsim.sl
SHAREDLIBHDRS = $(ROOTHDRS) ActarSimDict.hh
SHAREDSRCS = $(SHAREDLIBHDRS:.hh=.cc)
SHAREDOBJS = $(SHAREDSRCS:.cc=.o)
SHAREDOBJSWITHPATH := $(patsubst %.o,$(G4TMP)/$(G4SYSTEM)/$(name)/%.o,$(SHAREDOBJS))
sharedlib: $(SHAREDLIB)
$(SHAREDLIB):
echo "Linking $(SHAREDLIB)"
/bin/rm -f $(SHAREDLIB)
$(LDSHARED) $(LDSHAREDFLAGS) $(SHAREDLIB) $(SHAREDOBJSWITHPATH)
##$(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) *.o
chmod 555 $(SHAREDLIB)
echo "done for $(UNAME_S)"