141 lines
3.6 KiB
Makefile
141 lines
3.6 KiB
Makefile
#---------------------------------------------------
|
|
# Makefile.PMusr
|
|
#
|
|
# Author: Andreas Suter
|
|
# e-mail: andreas.suter@psi.ch
|
|
#
|
|
# $Id$
|
|
#
|
|
# Comment: If it doesn't work, try
|
|
# make --warning-undefined-variables -f Makefile.PMusr
|
|
# it might be that OSTYPE is not set properly, i.e.
|
|
# OSTYPE being a variable (set), instead of a enviornment
|
|
# variable (printenv). If so, try
|
|
# export OSTYPE=linux-gnu
|
|
# are whatever makes sense on your system.
|
|
#---------------------------------------------------
|
|
|
|
#---------------------------------------------------
|
|
# get compilation and library flags from root-config
|
|
|
|
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
|
|
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs)
|
|
ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
|
|
|
|
#---------------------------------------------------
|
|
# depending on the architecture, choose the compiler,
|
|
# linker, and the flags to use
|
|
#
|
|
|
|
ifeq ($(OSTYPE),linux)
|
|
OS = LINUX
|
|
endif
|
|
ifeq ($(OSTYPE),linux-gnu)
|
|
OS = LINUX
|
|
endif
|
|
ifeq ($(OSTYPE),darwin)
|
|
OS = DARWIN
|
|
endif
|
|
|
|
# -- Linux
|
|
ifeq ($(OS),LINUX)
|
|
CXX = g++
|
|
CXXFLAGS = -g -Wall -Wno-trigraphs -fPIC
|
|
PMUSRPATH = ../include
|
|
MNPATH = $(ROOTSYS)/include
|
|
GSLPATH = /usr/include/gsl
|
|
PSIBINPATH = ../external/MuSR_software/Class_MuSR_PSI
|
|
INCLUDES = -I$(PMUSRPATH) -I$(MNPATH) -I$(GSLPATH) -I$(PSIBINPATH)
|
|
LD = g++
|
|
LDFLAGS = -g
|
|
SOFLAGS = -O -shared
|
|
endif
|
|
|
|
# -- Darwin
|
|
ifeq ($(OS),DARWIN)
|
|
CXX = g++
|
|
CXXFLAGS = -g -Wall -Wno-trigraphs -fPIC
|
|
INCLUDES = -I../include
|
|
LD = g++
|
|
LDFLAGS = -g
|
|
SOFLAGS = -dynamic
|
|
endif
|
|
|
|
# the output from the root-config script:
|
|
CXXFLAGS += $(ROOTCFLAGS)
|
|
LDFLAGS +=
|
|
|
|
# the ROOT libraries (G = graphic)
|
|
LIBS = $(ROOTLIBS) -lXMLParser
|
|
GLIBS = $(ROOTGLIBS) -lXMLParser
|
|
|
|
# PSI libs
|
|
PSILIBS = -lTLemRunHeader
|
|
# Minuit2 lib
|
|
MNLIB = -L$(ROOTSYS)/lib -lMinuit2
|
|
# GSL lib
|
|
GSLLIB = -lgslcblas -lgsl
|
|
|
|
|
|
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
|
|
OBJS =
|
|
OBJS += PStartupHandler.o PStartupHandlerDict.o
|
|
OBJS += PMsrHandler.o
|
|
OBJS += PRunDataHandler.o
|
|
OBJS += PFunctionHandler.o
|
|
OBJS += PFunction.o
|
|
OBJS += PRunBase.o
|
|
OBJS += PRunSingleHisto.o
|
|
OBJS += PRunAsymmetry.o
|
|
OBJS += PRunRRF.o
|
|
OBJS += PRunNonMusr.o
|
|
OBJS += PRunListCollection.o
|
|
OBJS += PTheory.o
|
|
OBJS += PFitterFcn.o
|
|
OBJS += PFitter.o
|
|
OBJS += PMusrCanvas.o PMusrCanvasDict.o
|
|
|
|
EXTOBJS =
|
|
EXTOBJS += MuSR_td_PSI_bin.o
|
|
|
|
SHLIB = libPMusr.so
|
|
|
|
# make the shared lib:
|
|
#
|
|
all: $(SHLIB)
|
|
|
|
$(SHLIB): $(OBJS)
|
|
@echo "---> Building shared library $(SHLIB) ..."
|
|
/bin/rm -f $(SHLIB)
|
|
$(LD) $(OBJS) $(EXTOBJS) $(SOFLAGS) -o $(SHLIB) $(GLIBS) $(PSILIBS) $(MNLIB) $(GSLLIB)
|
|
@echo "done"
|
|
|
|
# clean up: remove all object file (and core files)
|
|
# semicolon needed to tell make there is no source
|
|
# for this target!
|
|
#
|
|
clean:; @rm -f $(OBJS) *Dict* core*
|
|
@echo "---> removing $(OBJS)"
|
|
|
|
#
|
|
$(OBJS): %.o: %.cpp
|
|
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<
|
|
|
|
MuSR_td_PSI_bin.o: ../external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp
|
|
$(CXX) $(INCLUDES) $(CXXFLAGS) -c ../external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp
|
|
|
|
PStartupHandlerDict.cpp: ../include/PStartupHandler.h
|
|
@echo "Generating dictionary $@..."
|
|
rootcint -f $@ -c -p $^
|
|
|
|
PMusrCanvasDict.cpp: ../include/PMusrCanvas.h
|
|
@echo "Generating dictionary $@..."
|
|
rootcint -v -f $@ -c -p $^
|
|
|
|
install: all
|
|
@echo "Installing shared lib: libPMusr.so ( you must be root ;-) )"
|
|
ifeq ($(OS),LINUX)
|
|
cp -pv $(SHLIB) $(ROOTSYS)/lib
|
|
cp -pv $(PMUSRPATH)/*.h $(ROOTSYS)/include
|
|
endif
|