Skip to content

Commit 2f88e7c

Browse files
author
RolfAndreassen
committed
Add Makefile
1 parent 1749279 commit 2f88e7c

3 files changed

Lines changed: 43 additions & 44 deletions

File tree

Makefile

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,32 @@ LD=g++
44
OutPutOpt = -o
55
CXXFLAGS = -O3 -arch=sm_20
66

7-
CUDALOCATION = /usr/local/cuda/5.0.35/
8-
CUDAHEADERS = $(CUDALOCATION)/include/
9-
SRCDIR = $(PWD)/FPOINTER
10-
INCLUDES += -I$(CUDAHEADERS) -I$(SRCDIR) -I$(PWD) -I$(PWD)/rootstuff
11-
LIBS += -L$(CUDALOCATION)/lib64 -lcudart -L$(PWD)/rootstuff -lRootUtils
7+
CUDALIBDIR=lib64
8+
UNAME=$(shell uname)
9+
ifeq ($(UNAME), Darwin)
10+
CXXFLAGS+=-m64
11+
CUDALIBDIR=lib
12+
endif
1213

13-
# These are for user-level programs that want access to the ROOT plotting stuff,
14-
# not just the fitting stuff included in the GooFit-local ripped library.
15-
ROOT_INCLUDES = -I$(ROOTSYS)/include/
16-
ROOT_LIBS = -L$(ROOTSYS)/lib/ -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lMatrix -lPhysics -lMathCore -pthread -lThread -lMinuit2 -lMinuit -rdynamic -lFoam
17-
18-
THRUSTO = wrkdir/Variable.o wrkdir/PdfBuilder.o wrkdir/ThrustPdfFunctorCUDA.o wrkdir/Faddeeva.o wrkdir/FitControl.o wrkdir/FunctorBase.o wrkdir/DataSet.o wrkdir/BinnedDataSet.o wrkdir/UnbinnedDataSet.o wrkdir/FunctorWriter.o
14+
GOODIR = $(PWD)/release_16Jan2013
15+
EXLIST = example2 example3a example3b example3c example4a example4b example4c example4d example4e
1916

2017
.SUFFIXES:
2118

22-
all: example4b
19+
examples: $(EXLIST)
20+
21+
include $(GOODIR)/Makefile.goofit
2322

2423
%.o: %.cu
2524
$(CXX) $(INCLUDES) $(ROOT_INCLUDES) $(CXXFLAGS) -c -o $@ $<
2625

27-
example%: example%.o
28-
$(LD) $(LDFLAGS) $^ $(THRUSTO) $(LIBS) $(ROOT_LIBS) $(OutPutOpt) $@
26+
example%: example%.o $(THRUSTO) $(ROOTUTILLIB)
27+
$(LD) $(LDFLAGS) $< $(THRUSTO) $(LIBS) $(ROOT_LIBS) $(OutPutOpt) $@
2928
@echo "$@ done"
3029

31-
exercise%: exercise%.o
32-
$(LD) $(LDFLAGS) $^ $(THRUSTO) $(LIBS) $(ROOT_LIBS) $(OutPutOpt) $@
30+
exercise%: exercise%.o $(THRUSTO) $(ROOTUTILLIB)
31+
$(LD) $(LDFLAGS) $< $(THRUSTO) $(LIBS) $(ROOT_LIBS) $(OutPutOpt) $@
3332
@echo "$@ done"
3433

35-
clean:
36-
@rm -f *.o core
37-
cd rootstuff; $(MAKE) clean
34+
exclean:
35+
@rm -f *.o $(EXLIST)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22

3-
wrkdir/%.cu: $(SRCDIR)/%.cu $(SRCDIR)/%.hh
4-
@echo "#line 0 \"$<\"" > wrkdir/%.tmp
5-
@cat wrkdir/%.tmp $< > $@
6-
@rm wrkdir/%.tmp
3+
$(WRKDIR)/%.cu: $(SRCDIR)/%.cu $(SRCDIR)/%.hh
4+
@echo "#line 0 \"$<\"" > $(WRKDIR)/%.tmp
5+
@cat $(WRKDIR)/%.tmp $< > $@
6+
@rm $(WRKDIR)/%.tmp
77
@echo "Created $@"
88

9-
wrkdir/CUDAglob.cu: $(WRKFUNCTORLIST) $(HEADERLIST)
9+
$(WRKDIR)/CUDAglob.cu: $(WRKFUNCTORLIST) $(HEADERLIST)
1010
@rm -f $@
1111
@cat $(WRKFUNCTORLIST) > $@

release_16Jan2013/Makefile.goofit

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ CXX=nvcc
33
LD=g++
44
OutPutOpt = -o
55

6-
7-
CXXFLAGS = -O3 -arch=sm_20 #--ptxas-options=-v
8-
#CXXFLAGS = -g -G -arch=sm_20
6+
CXXFLAGS = -O3 -arch=sm_20
97
DEFINEFLAGS=-DDUMMY=dummy
108

119
ifneq ($(CUDAPRINT),)
@@ -19,10 +17,14 @@ endif
1917
CUDALOCATION = /usr/local/cuda/5.0.35/
2018
CUDAHEADERS = $(CUDALOCATION)/include/
2119

22-
SRCDIR = $(PWD)/FPOINTER
20+
ifeq ($(GOODIR),)
21+
GOODIR = $(CURDIR)
22+
endif
23+
24+
SRCDIR = $(GOODIR)/FPOINTER
2325

24-
INCLUDES += -I$(CUDAHEADERS) -I$(SRCDIR) -I$(PWD) -I$(PWD)/rootstuff
25-
LIBS += -L$(CUDALOCATION)/lib64 -lcudart -L$(PWD)/rootstuff -lRootUtils
26+
INCLUDES += -I$(CUDAHEADERS) -I$(SRCDIR) -I$(GOODIR) -I$(GOODIR)/rootstuff
27+
LIBS += -L$(CUDALOCATION)/lib64 -lcudart -L$(GOODIR)/rootstuff -lRootUtils
2628

2729
# These are for user-level programs that want access to the ROOT plotting stuff,
2830
# not just the fitting stuff included in the GooFit-local ripped library.
@@ -33,21 +35,21 @@ FUNCTORLIST = $(SRCDIR)/ThrustPdfFunctor.cu
3335
FUNCTORLIST += $(wildcard $(SRCDIR)/*ThrustFunctor.cu)
3436
FUNCTORLIST += $(wildcard $(SRCDIR)/*Aux.cu)
3537
HEADERLIST = $(patsubst %.cu,%.hh,$(FUNCTORLIST))
36-
WRKFUNCTORLIST = $(patsubst $(SRCDIR)/%.cu,wrkdir/%.cu,$(FUNCTORLIST))
38+
WRKDIR = $(GOODIR)/wrkdir
39+
WRKFUNCTORLIST = $(patsubst $(SRCDIR)/%.cu,$(WRKDIR)/%.cu,$(FUNCTORLIST))
3740

38-
THRUSTO = wrkdir/Variable.o wrkdir/PdfBuilder.o wrkdir/ThrustPdfFunctorCUDA.o wrkdir/Faddeeva.o wrkdir/FitControl.o wrkdir/FunctorBase.o wrkdir/DataSet.o wrkdir/BinnedDataSet.o wrkdir/UnbinnedDataSet.o wrkdir/FunctorWriter.o
39-
ROOTRIPDIR = $(PWD)/rootstuff
41+
THRUSTO = $(WRKDIR)/Variable.o $(WRKDIR)/PdfBuilder.o $(WRKDIR)/ThrustPdfFunctorCUDA.o $(WRKDIR)/Faddeeva.o $(WRKDIR)/FitControl.o $(WRKDIR)/FunctorBase.o $(WRKDIR)/DataSet.o $(WRKDIR)/BinnedDataSet.o $(WRKDIR)/UnbinnedDataSet.o $(WRKDIR)/FunctorWriter.o
42+
ROOTRIPDIR = $(GOODIR)/rootstuff
4043
ROOTRIPOBJS = $(ROOTRIPDIR)/TMinuit.o $(ROOTRIPDIR)/TRandom.o $(ROOTRIPDIR)/TRandom3.o
4144
ROOTUTILLIB = $(ROOTRIPDIR)/libRootUtils.so
42-
PROGRAMS =
4345

4446
.SUFFIXES:
4547

4648
all: goofit
4749

4850
# One rule for GooFit objects.
49-
wrkdir/%.o: %.cc %.hh
50-
@mkdir -p wrkdir
51+
$(WRKDIR)/%.o: $(GOODIR)/%.cc $(GOODIR)/%.hh
52+
@mkdir -p $(WRKDIR)
5153
$(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFINEFLAGS) -c -o $@ $<
5254

5355
# A different rule for user-level objects. Notice ROOT_INCLUDES.
@@ -57,23 +59,22 @@ wrkdir/%.o: %.cc %.hh
5759
# Still a third rule for the ROOT objects - these have their own Makefile.
5860
$(ROOTRIPDIR)/%.o: $(ROOTRIPDIR)/%.cc
5961
rm -f $@
60-
@echo "Postponing $@ for separate Makefile"
62+
@cd $(ROOTRIPDIR); $(MAKE)
6163

6264
$(ROOTUTILLIB): $(ROOTRIPOBJS)
63-
@cd rootstuff; $(MAKE)
65+
@cd $(ROOTRIPDIR); $(MAKE)
6466

6567
include $(SRCDIR)/Makefile
6668

67-
PdfBuilder.o: PdfBuilder.cc PdfBuilder.hh wrkdir/ThrustPdfFunctorCUDA.o Variable.o
69+
PdfBuilder.o: PdfBuilder.cc PdfBuilder.hh $(WRKDIR)/ThrustPdfFunctorCUDA.o Variable.o
6870
$(CXX) $(DEFINEFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
6971

70-
wrkdir/ThrustPdfFunctorCUDA.o: wrkdir/CUDAglob.cu FunctorBase.cu
71-
nvcc $(CXXFLAGS) $(INCLUDES) -I. $(DEFINEFLAGS) -c $< -o $@
72-
@echo "$@ done"
72+
$(WRKDIR)/ThrustPdfFunctorCUDA.o: $(WRKDIR)/CUDAglob.cu $(GOODIR)/FunctorBase.cu
73+
nvcc $(CXXFLAGS) $(INCLUDES) -I. $(DEFINEFLAGS) -c $< -o $@
74+
@echo "$@ done"
7375

7476
goofit: $(THRUSTO)
7577
@echo "Compiled GooFit objects"
7678

7779
clean:
78-
@rm -f *.o core $(PROGRAMS) wrkdir/*
79-
cd rootstuff; $(MAKE) clean
80+
@rm -f *.o core $(PROGRAMS) $(WRKDIR)/* $(ROOTRIPOBJS) $(ROOTUTILLIB)

0 commit comments

Comments
 (0)