Skip to content

Commit

Permalink
Merge pull request #198 from manodeep/makefile
Browse files Browse the repository at this point in the history
Makefile updates
  • Loading branch information
SimonStevenson authored Apr 7, 2020
2 parents 6974f11 + 0c574b4 commit 8a298af
Showing 1 changed file with 61 additions and 44 deletions.
105 changes: 61 additions & 44 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,90 +7,107 @@
# (note uppercase 'CPP' and no whitespace around '=')

CPP = g++
cpp = $(CPP)
BOOST :=


EXE := COMPAS

# build COMPAS
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(info Building $(EXE) with $(CPP))
endif


$(info Building COMPAS with $(CPP))
OPTFLAGS :=
ifneq ($(filter fast,$(MAKECMDGOALS)),)
$(info Adding optimisation flags into the compilation - will take longer to build)
OPTFLAGS += -march=native -O3
endif

CFLAGS = -g
ifneq ($(filter staticfast,$(MAKECMDGOALS)),)
$(info Adding optimisation flags into the (static) compilation - will take longer to build)
OPTFLAGS += -march=native -O3
endif


BOOST =
CFLAGS = -I.
FCFLAGS =
ICFLAGS = -I$(BOOST)/include -Wall -std=c++11
LFLAGS = -L$(BOOST)/lib -lgsl -lgslcblas -lstdc++ -lm -lz -ldl -march=k8 -lboost_filesystem -lboost_program_options -lboost_system -std=c++11 -O3
SOURCES = \
CXXFLAGS := -g -std=c++11 -Wall $(OPTFLAGS)
ICFLAGS := -I$(BOOST)/include -I.
LFLAGS := -L$(BOOST)/lib -lgsl -lgslcblas -lstdc++ -lm -lz -ldl -lboost_filesystem -lboost_program_options -lboost_system -Xlinker -rpath -Xlinker $(BOOST)/lib
SOURCES := \
utils.cpp \
\
\
Options.cpp \
Log.cpp \
Rand.cpp \
Errors.cpp \
\
BaseStar.cpp \
\
\
BaseStar.cpp \
\
Star.cpp \
\
MainSequence.cpp \
MS_lte_07.cpp \
MS_gt_07.cpp \
\
\
MainSequence.cpp \
MS_lte_07.cpp \
MS_gt_07.cpp \
\
CH.cpp \
\
GiantBranch.cpp \
\
GiantBranch.cpp \
HG.cpp \
FGB.cpp \
CHeB.cpp \
EAGB.cpp \
TPAGB.cpp \
\
\
HeMS.cpp \
HeHG.cpp \
HeGB.cpp \
\
\
HeWD.cpp \
COWD.cpp \
ONeWD.cpp \
\
\
NS.cpp \
BH.cpp \
MR.cpp \
\
\
AIS.cpp \
\
BinaryConstituentStar.cpp \
BaseBinaryStar.cpp \
BinaryStar.cpp \
\
\
BinaryConstituentStar.cpp \
BaseBinaryStar.cpp \
BinaryStar.cpp \
\
main.cpp

OBJI = $(SOURCES:.cpp=.o)
OBJI := $(SOURCES:.cpp=.o)

# Create the list of header files, and remove
# main.h from this auto-generated list
INCL := $(SOURCES:.cpp=.h)
INCL := $(filter-out main.h,$(INCL))

all: COMPAS
all: $(EXE)
@echo $(OBJI)

.cpp.o:
$(CPP) -c $(CFLAGS) $(FCFLAGS) $(ICFLAGS) $?


COMPAS: $(OBJI)
$(EXE): $(OBJI)
@echo $(SOURCES)
@echo $(OBJI)
$(CPP) -o COMPAS $(OBJI) $(ICFLAGS) $(LFLAGS)

clean:
rm -f *.o
$(CPP) $(OBJI) $(LFLAGS) -o $@

static: COMPAS_STATIC
@echo $OBJI
static: $(EXE)_STATIC
@echo $(OBJI)

COMPAS_STATIC: $(OBJI)
$(EXE)_STATIC: $(OBJI)
@echo $(SOURCES)
@echo $(OBJI)
$(CPP) -o COMPAS $(OBJI) $(ICFLAGS) $(LFLAGS) -static
$(CPP) $(OBJI) $(LFLAGS) -static -o $@

.cpp.o: $(SOURCES) $(INCL) Makefile
$(CPP) $(CXXFLAGS) $(ICFLAGS) -c $?

.phony: clean static fast staticfast

fast: $(EXE)
staticfast:$(EXE)_STATIC

clean:
rm -f $(OBJI) $(EXE) $(EXE)_STATIC

0 comments on commit 8a298af

Please sign in to comment.