hp/GNUmakefile

68 lines
1.1 KiB
Text
Raw Permalink Normal View History

.PHONY: veryclean clean force export help test run
2023-06-13 19:38:52 +00:00
F := ifort
BUILD_DIR := build
HP_LIB := $(BUILD_DIR)/libhp.a
2023-06-13 19:38:52 +00:00
# Untested NAG support
ifeq ($(F),nagfor)
F_OPTS := -fpic -I $(BUILD_DIR)
2023-06-13 19:41:32 +00:00
2023-06-13 19:38:52 +00:00
else
F_OPTS := -fpic -module $(BUILD_DIR)
2023-06-14 19:42:02 +00:00
ifdef debug
2023-06-14 19:42:02 +00:00
ifeq ($(F),ifx)
F_OPTS += -g
else
F_OPTS += -ggdb
endif
2023-06-14 19:42:02 +00:00
endif
2023-06-13 19:41:32 +00:00
endif
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)
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
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
clean:
@rm -vf $(OBJ) $(BUILD_DIR)/*.mod $(BUILD_DIR)/*.smod *~
veryclean: clean
@rm -vf $(EXE) hp.tar
force: veryclean
$(MAKE)
export: hp.tar
run: $(EXE)
./$<
hp.tar: GNUmakefile app/main.f90 $(SRC)
tar cf $@ app/main.f90 $(SRC) GNUmakefile
help:
@echo "SRC = $(SRC)"
@echo "OBJ = $(OBJ)"