Advanced Computing Platform for Theoretical Physics

Commit 802a08ab authored by ralfulrich's avatar ralfulrich
Browse files

more robust Makefile

parent 6127b71c
SYSTEM=$(shell uname)
SYSTEM2=$(shell uname -m)
m32=$(shell if [ "$(SYSTEM2)" = "i686" ]; then echo "-m32"; fi)
SYSTEM := $(shell uname)
SYSTEM2 := $(shell uname -m)
m32 := $(shell if [ "$(SYSTEM2)" = "i686" ]; then echo "-m32"; fi)
SOURCE_DIR=src/
......@@ -19,28 +19,32 @@ ifndef CC
CC = gcc
endif
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs) -lEG
ROOTCFLAGS := $(shell root-config --cflags)
ROOTLIBS := $(shell root-config --libs) -lEG
HEPCFLAGS = $(shell HepMC3-config --cflags)
HEPLIBS = $(HepMC3-config --ldflags)
BOOSTLIBS = -lboost_iostreams -lboost_system
HEPCFLAGS := $(shell HepMC3-config --cflags)
HEPLIBS := $(shell HepMC3-config --ldflags)
BOOSTLIBS := -lboost_iostreams -lboost_system
CFLAGS = $(ROOTCFLAGS) $(HEPCFLAGS)
LIBS = $(ROOTLIBS) $(HEPLIBS) $(BOOSTLIBS)
CFLAGS := $(ROOTCFLAGS) $(HEPCFLAGS)
LIBS := $(ROOTLIBS) $(HEPLIBS) $(BOOSTLIBS)
CXXFILES=analysis.cc
CXXFILES := analysis.cc
OBJS=$(FILES:%.f=$(LIBDIR)%.o)
CXXOBJS=$(CXXFILES:%.cc=$(LIBDIR)%.o)
OBJS := $(FILES:%.f=$(LIBDIR)%.o)
CXXOBJS := $(CXXFILES:%.cc=$(LIBDIR)%.o)
checkROOT := $(if $(shell which root-config), "ROOT available (try 'make analysisROOT')", "root-config not found. Cannot compile with ROOT.")
checkHepMC3 := $(if $(shell which HepMC3-config), "HepMC3 available", "HepMC3-config not found. Cannot compile with HepMC3.")
all: dirs bin_dir bin/analysis
.PHONY : check
all: check dirs bin_dir bin/analysis
.PHONY : check analysisROOT
check:
@if [ -z "$(HepMC3_ROOT)" ]; then echo "Please set HepMC3_ROOT to the root directory of HepMC3"; exit 1; fi
@if [ -z "$(ROOTSYS)" ]; then echo "Please set ROOTSYS to the root directory of root"; exit 1; fi
@(echo $(checkROOT))
@(echo $(checkHepMC3))
bin/analysis: $(OBJS) $(CXXOBJS)
$(CXX) $(CXXFLAGS) $(OBJS) $(CXXOBJS) -o $@ $(LIBS)
......@@ -49,6 +53,7 @@ bin/analysis: $(OBJS) $(CXXOBJS)
@(echo "==> type bin/analysis")
@(echo "")
analysisROOT: bin/analysisROOT
bin/analysisROOT: $(LIBDIR)/analysisROOT.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
@(echo "")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment