-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
128 lines (103 loc) · 4.14 KB
/
Makefile
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
ifdef DEBUG
DEBUG_SUFFIX = _d
FCOPTS += -g
endif
OStype = $(shell uname)
CC = g++
COPTS = -g -D_REENTRANT
ifeq ($(OStype),OSF1)
COPTS = -g -D_REENTRANT -DBASENAME_USE_BUILTIN
endif
ifeq ($(OStype),SunOS)
CC = CC
COPTS = -D_REENTRANT -DBASENAME_IN_LIBGEN
endif
ifeq ($(OStype),Darwin)
CC = c++
COPTS = -D_REENTRANT -DBASENAME_IN_LIBGEN
endif
ifndef BUILDS
BUILDS = $(HALLD_HOME)/src/programs/Simulation
endif
BINDIR = bin/$(BMS_OSNAME)
LIBDIR = lib/$(BMS_OSNAME)
OBJDIR = obj$(DEBUG_SUFFIX)/$(BMS_OSNAME)
SRCDIR = src
ifndef NO_COMPILER_MOD
include Makefile.compilers
endif
WHICH_FC := $(shell which $(FC))
XML_SOURCE = BarrelEMcal_HDDS.xml BeamLine_HDDS.xml CentralDC_HDDS.xml\
CerenkovCntr_HDDS.xml ForwardDC_HDDS.xml ForwardEMcal_HDDS.xml\
ForwardTOF_HDDS.xml Material_HDDS.xml Solenoid_HDDS.xml \
StartCntr_HDDS.xml Target_HDDS.xml UpstreamEMveto_HDDS.xml \
Regions_HDDS.xml PairSpect_HDDS.xml main_HDDS.xml
all: bms_osname_check fortran_compiler_check make_dirs $(SRCDIR)/hddsroot.C $(SRCDIR)/hddsroot.h $(LIBDIR)/libhddsGeant3$(DEBUG_SUFFIX).a $(BINDIR)/hdds-md5
bms_osname_check:
ifdef BMS_OSNAME
@echo BMS_OSNAME = $(BMS_OSNAME)
else
@echo BMS_OSNAME not set; exit 1
endif
fortran_compiler_check:
@echo FORTRAN compiler = $(FC)
ifeq ($(strip $(WHICH_FC)),)
@echo Make cannot find FORTRAN compiler.; \
echo Invoke make with compiler definition, turning off Makefile compiler guessing in command line, e. g.,; \
echo; \
echo " make FC=gfortran NO_COMPILER_MOD=1"; \
echo; \
exit 1
endif
make_dirs:
mkdir -p $(BINDIR) $(LIBDIR) $(OBJDIR) $(SRCDIR)
$(SRCDIR)/hddsMCfast.db: $(BINDIR)/hdds-mcfast $(XML_SOURCE)
ln -sf $(MCFAST_DIR)/db db
$(BINDIR)/hdds-mcfast main_HDDS.xml >$@
rm db
$(SRCDIR)/hddsGeant3.F: $(BINDIR)/hdds-geant $(XML_SOURCE)
$(BINDIR)/hdds-geant main_HDDS.xml >$@
$(SRCDIR)/hddsroot.C: $(BINDIR)/hdds-root $(XML_SOURCE)
$(BINDIR)/hdds-root main_HDDS.xml >$@
$(SRCDIR)/hddsroot.h: $(BINDIR)/hdds-root_h $(XML_SOURCE)
$(BINDIR)/hdds-root_h main_HDDS.xml >$@
$(BINDIR)/hdds-geant: hdds-geant.cpp XParsers.cpp XParsers.hpp md5.c md5.h \
XString.cpp XString.hpp hddsCommon.cpp hddsCommon.hpp
$(CC) $(COPTS) -I$(XERCESCROOT)/include -o $@ $< \
hddsCommon.cpp XParsers.cpp XString.cpp md5.c \
-L$(XERCESCROOT)/lib -lxerces-c
$(BINDIR)/hdds-root: hdds-root.cpp hdds-root.hpp XParsers.cpp XParsers.hpp md5.c md5.h \
XString.cpp XString.hpp hddsCommon.cpp hddsCommon.hpp
$(CC) $(COPTS) -I$(XERCESCROOT)/include -o $@ $< \
hddsCommon.cpp XParsers.cpp XString.cpp md5.c \
-L$(XERCESCROOT)/lib -lxerces-c
$(BINDIR)/hdds-root_h: hdds-root_h.cpp hdds-root.hpp XParsers.cpp XParsers.hpp md5.c md5.h \
XString.cpp XString.hpp hddsCommon.cpp hddsCommon.hpp
$(CC) $(COPTS) -I$(XERCESCROOT)/include -o $@ $< \
hddsCommon.cpp XParsers.cpp XString.cpp md5.c \
-L$(XERCESCROOT)/lib -lxerces-c
$(BINDIR)/hdds-md5: hdds-md5.cpp XParsers.cpp XParsers.hpp md5.c md5.h \
XString.cpp XString.hpp hddsCommon.cpp hddsCommon.hpp
$(CC) $(COPTS) -I$(XERCESCROOT)/include -o $@ $< \
hddsCommon.cpp XParsers.cpp XString.cpp md5.c \
-L$(XERCESCROOT)/lib -lxerces-c
$(BINDIR)/hdds-mcfast: hdds-mcfast.cpp XParsers.cpp XParsers.hpp md5.c md5.h \
XString.cpp XString.hpp
$(CC) $(COPTS) -I$(XERCESCROOT)/include -o $@ $< \
XParsers.cpp XString.cpp md5.c -L$(XERCESCROOT)/lib -lxerces-c
$(BINDIR)/findall: findall.cpp XParsers.cpp XParsers.hpp md5.c md5.h hddsCommon.hpp hddsCommon.cpp \
XString.cpp XString.hpp hddsBrowser.hpp hddsBrowser.cpp
$(CC) $(COPTS) -I$(XERCESCROOT)/include -o $@ $< \
hddsBrowser.cpp hddsCommon.cpp XParsers.cpp XString.cpp md5.c \
-L$(XERCESCROOT)/lib -lxerces-c
$(BINDIR)/xpath-example: xpath-example.cpp
$(CC) $(COPTS) -I$(XALANCROOT)/include -I$(XERCESCROOT)/include \
-o $@ xpath-example.cpp \
-L$(XALANCROOT)/lib -lxalan-c -L$(XERCESCROOT)/lib -lxerces-c
$(OBJDIR)/hddsGeant3.o: $(SRCDIR)/hddsGeant3.F
$(FC) $(FCOPTS) -c -o $(OBJDIR)/hddsGeant3.o $(SRCDIR)/hddsGeant3.F
$(LIBDIR)/libhddsGeant3$(DEBUG_SUFFIX).a: $(OBJDIR)/hddsGeant3.o
$(AR) rv $@ $<
clean:
rm -rfv $(BINDIR) $(SRCDIR) $(OBJDIR) $(LIBDIR)
pristine: clean