hp/GNUmakefile

57 lines
1,002 B
Text
Raw Normal View History

2023-06-10 14:13:40 +00:00
.PHONY: veryclean clean force export help test run
F:= ifort
BUILD_DIR := build
HP_LIB := $(BUILD_DIR)/libhp.a
F_OPTS := -fpic -module $(BUILD_DIR)
2023-06-09 20:07:25 +00:00
ifdef debug
2023-06-10 14:13:40 +00:00
F_OPTS += -ggdb -debug-parameters used
2023-06-09 20:07:25 +00:00
endif
2023-06-10 14:13:40 +00:00
SRC := $(wildcard src/*.f90)
OBJ := $(SRC:src/%.f90=$(BUILD_DIR)/%.o)
2023-06-09 20:07:25 +00:00
2023-06-10 14:13:40 +00:00
EXE := $(BUILD_DIR)/hp
2023-06-09 20:07:25 +00:00
2023-06-10 14:13:40 +00:00
$(EXE): $(BUILD_DIR) app/main.f90 $(HP_LIB)
$(F) -o $@ app/main.f90 $(HP_LIB) $(F_OPTS)
2023-06-09 20:07:25 +00:00
2023-06-10 14:13:40 +00:00
$(HP_LIB): $(BUILD_DIR) $(OBJ)
ar crv $@ $(OBJ)
2023-06-09 20:07:25 +00:00
2023-06-10 14:13:40 +00:00
$(OBJ) : $(BUILD_DIR)/%.o : src/%.f90
2023-06-09 20:07:25 +00:00
$(F) -c -o $@ $< $(F_OPTS)
2023-06-10 14:13:40 +00:00
test_amap: test/test_amap.f90 $(BUILD_DIR)/amap.o
$(F) -o $@ $(F_OPTS) test/test_amap.f90 $(BUILD_DIR)/amap.o
test: test_amap
./test_amap
2023-06-09 20:07:25 +00:00
2023-06-10 14:13:40 +00:00
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
2023-06-09 20:07:25 +00:00
clean:
2023-06-10 14:13:40 +00:00
@rm -vf $(OBJ) $(BUILD_DIR)/*.mod $(BUILD_DIR)/*.smod *~
2023-06-09 20:07:25 +00:00
veryclean: clean
@rm -vf hp hp.exe hp.tar
force: veryclean
$(MAKE)
export: hp.tar
2023-06-10 14:13:40 +00:00
run: $(EXE)
./$<
hp.tar: GNUmakefile app/main.f90 $(SRC)
tar cf $@ app/main.f90 $(SRC) GNUmakefile
2023-06-09 20:07:25 +00:00
help:
@echo "SRC = $(SRC)"
@echo "OBJ = $(OBJ)"