Tmp = $(HOME)/tmp DESTDIR = $(HOME)/ Bin = $(DESTDIR)bin/wisp model = 1 all: target copy prepare model maxfunwalk cleanup target: @mkdir -p $(Bin) copy: maxfunwalk.c maxfunwalk.h model$(model).c model.h @cp maxfunwalk.c $(Tmp) @cp maxfunwalk.h $(Tmp)/rawHeader @cp model$(model).c $(Tmp)/model.c @cp model.h $(Tmp) prepare: $(Tmp)/rawHeader ifeq ($(model),1) @sed 's/MITIGATION/2/' $(Tmp)/rawHeader > $(Tmp)/maxfunwalk.h endif ifeq ($(model),2) @sed 's/MITIGATION/31/' $(Tmp)/rawHeader > $(Tmp)/maxfunwalk.h endif ifeq ($(model),3) @sed 's/MITIGATION/3/' $(Tmp)/rawHeader > $(Tmp)/maxfunwalk.h endif ifeq ($(model),4) @sed 's/MITIGATION/58/' $(Tmp)/rawHeader > $(Tmp)/maxfunwalk.h endif ifeq ($(model),5) @sed 's/MITIGATION/99/' $(Tmp)/rawHeader > $(Tmp)/maxfunwalk.h endif model: $(Tmp)/model.c $(Tmp)/model.h $(Tmp)/maxfunwalk.h @g++ -c $(Tmp)/model.c -o $(Tmp)/model.o maxfunwalk: $(Tmp)/maxfunwalk.c $(Tmp)/maxfunwalk.h $(Tmp)/model.o $(Bin) @g++ $(Tmp)/maxfunwalk.c $(Tmp)/model.o -o $(Bin)/maxfunwalk @echo "You can run MaxFunWalk from folder $(Bin)." cleanup: $(Tmp)/maxfunwalk.c $(Tmp)/maxfunwalk.h $(Tmp)/model.o $(Tmp)/model.c $(Tmp)/model.h $(Tmp)/rawHeader @rm -rf $(Tmp)/maxfunwalk.c $(Tmp)/maxfunwalk.h $(Tmp)/model.o $(Tmp)/model.c $(Tmp)/model.h $(Tmp)/rawHeader