#--------------------------------------------------- # 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 # OSTYPE = linux 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 = -O -Wall -Wno-trigraphs -fPIC MNPATH = $(ROOTSYS)/include INCLUDES = -I $(PMUSRPATH) -I $(MNPATH) LD = g++ LDFLAGS = -O endif # -- Darwin ifeq ($(OS),DARWIN) CXX = g++ CXXFLAGS = -O -Wall -fPIC INCLUDES = -I../include LD = g++ LDFLAGS = -O endif # the output from the root-config script: CXXFLAGS += $(ROOTCFLAGS) LDFLAGS += # the ROOT libraries (G = graphic) LIBS = $(ROOTLIBS) GLIBS = $(ROOTGLIBS) # Minuit2 lib MNLIB = -L$(ROOTSYS)/lib/ -lMinuit2 # MathMore lib MMLIB = -L$(ROOTSYS)/lib/ -lMathMore EXEC = minuit2test_Gradients # some definitions: headers, sources, objects,... OBJS = OBJS += $(EXEC).o # make the executable: # all: $(EXEC) $(EXEC): $(OBJS) @echo "---> Building $(EXEC) ..." /bin/rm -f $(SHLIB) $(LD) $(OBJS) -o $(EXEC) $(GLIBS) $(MNLIB) $(MMLIB) @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) @echo "---> removing $(OBJS)" # $(OBJS): %.o: %.cpp $(CXX) $(INCLUDES) $(CXXFLAGS) -c $<