Update makefile for the new layout

This commit is contained in:
sgeard 2023-06-10 15:13:40 +01:00
parent ba42578276
commit 8897d8328e

View file

@ -1,37 +1,41 @@
.PHONY: veryclean clean force export help .PHONY: veryclean clean force export help test run
ifdef debug
F_OPTS := -ggdb
endif
F:= ifort F:= ifort
BUILD_DIR := build
SRC := rpn_stack.f90 rpn_stack_sm.f90 linked_list.f90 amap.f90 HP_LIB := $(BUILD_DIR)/libhp.a
OBJ := $(SRC:%.f90=%.o)
hp: ../app/main.f90 $(OBJ) F_OPTS := -fpic -module $(BUILD_DIR)
$(F) -o $@ ../app/main.f90 $(OBJ) $(F_OPTS)
hp.exe: /app/main.f90 GNUmakefile ifdef debug
$(F) -o $@ $< $(F_OPTS) F_OPTS += -ggdb -debug-parameters used
endif
rpn_stack_sm.o: rpn_stack_sm.f90 SRC := $(wildcard src/*.f90)
OBJ := $(SRC:src/%.f90=$(BUILD_DIR)/%.o)
EXE := $(BUILD_DIR)/hp
$(EXE): $(BUILD_DIR) app/main.f90 $(HP_LIB)
$(F) -o $@ app/main.f90 $(HP_LIB) $(F_OPTS)
$(HP_LIB): $(BUILD_DIR) $(OBJ)
ar crv $@ $(OBJ)
$(OBJ) : $(BUILD_DIR)/%.o : src/%.f90
$(F) -c -o $@ $< $(F_OPTS) $(F) -c -o $@ $< $(F_OPTS)
rpn_stack.o: rpn_stack.f90 test_amap: test/test_amap.f90 $(BUILD_DIR)/amap.o
$(F) -c -o $@ $< $(F_OPTS) $(F) -o $@ $(F_OPTS) test/test_amap.f90 $(BUILD_DIR)/amap.o
linked_list.o: linked_list.f90 test: test_amap
$(F) -c -o $@ $< $(F_OPTS) ./test_amap
amap.o: amap.f90 $(BUILD_DIR):
$(F) -c -o $@ $< $(F_OPTS) mkdir -p $(BUILD_DIR)
test_amap: ../test/test_amap.f90 amap.o
$(F) -o $@ ../test/test_amap.f90 amap.o
clean: clean:
@rm -vf *.o *.mod *.smod *~ @rm -vf $(OBJ) $(BUILD_DIR)/*.mod $(BUILD_DIR)/*.smod *~
veryclean: clean veryclean: clean
@rm -vf hp hp.exe hp.tar @rm -vf hp hp.exe hp.tar
@ -41,8 +45,11 @@ force: veryclean
export: hp.tar export: hp.tar
hp.tar: GNUmakefile ../app/hp.f90 $(SRC) run: $(EXE)
tar cf $@ ../app/hp.f90 $(SRC) GNUmakefile ./$<
hp.tar: GNUmakefile app/main.f90 $(SRC)
tar cf $@ app/main.f90 $(SRC) GNUmakefile
help: help:
@echo "SRC = $(SRC)" @echo "SRC = $(SRC)"