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