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 ../models/model$(model).c model.h @cp tool.c $(Tmp) @cp tool.h $(Tmp)/rawHeader @cp ../models/model$(model).c $(Tmp)/model.c @cp model.h $(Tmp) 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 ifeq ($(model),2_1) @sed 's/MITIGATION/31/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),2_2) @sed 's/MITIGATION/62/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),2_4) @sed 's/MITIGATION/124/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),2_8) @sed 's/MITIGATION/248/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),2_16) @sed 's/MITIGATION/496/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),3_1) @sed 's/MITIGATION/3/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),3_2) @sed 's/MITIGATION/6/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),3_4) @sed 's/MITIGATION/12/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),3_8) @sed 's/MITIGATION/24/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),3_16) @sed 's/MITIGATION/48/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),4_1) @sed 's/MITIGATION/58/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),4_2) @sed 's/MITIGATION/116/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),4_4) @sed 's/MITIGATION/232/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),4_8) @sed 's/MITIGATION/464/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),4_16) @sed 's/MITIGATION/928/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),5_1) @sed 's/MITIGATION/99/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),5_2) @sed 's/MITIGATION/198/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),5_4) @sed 's/MITIGATION/396/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),5_8) @sed 's/MITIGATION/792/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif ifeq ($(model),5_16) @sed 's/MITIGATION/1584/' $(Tmp)/rawHeader > $(Tmp)/tool.h endif model: $(Tmp)/model.c $(Tmp)/model.h $(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)/v1tool @echo "You can run v1tool from folder $(Bin)." cleanup: $(Tmp)/tool.c $(Tmp)/tool.h $(Tmp)/model.o $(Tmp)/model.c $(Tmp)/model.h $(Tmp)/rawHeader @rm -rf $(Tmp)/tool.c $(Tmp)/tool.h $(Tmp)/model.o $(Tmp)/model.c $(Tmp)/model.h $(Tmp)/rawHeader