forked from amrvac/amrvac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
75 lines (52 loc) · 1.61 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ifndef AMRVAC_DIR
$(error AMRVAC_DIR is not set)
endif
ARCH ?= default
NDIM := 2
# By exporting these can be used when building libamrvac
export ARCH NDIM
SRC_DIR := $(AMRVAC_DIR)/src
LIB_DIR := $(AMRVAC_DIR)/lib/$(NDIM)d_$(ARCH)
LIB_MAKE := $(AMRVAC_DIR)/arch/lib.make
LIB_AMRVAC := $(LIB_DIR)/libamrvac.a
# These are used for compilation
INC_DIRS := $(LIB_DIR)
LIB_DIRS := $(LIB_DIR)
LIBS := amrvac
.PHONY: all clean allclean force hdr
all: | hdr amrvac
# copy amrvac.h (in order to use the std preprocessor in the main code files, e.g. twofl); create the file if it does not exist
hdr:
ifeq ("$(wildcard amrvac.h)","")
touch amrvac.h
endif
@mkdir -p $(LIB_DIR) # Prevent error message
rsync -c amrvac.h $(LIB_DIR)/amrvac.h
# Include architecture and compilation rules
include $(AMRVAC_DIR)/arch/$(ARCH).defs
include $(AMRVAC_DIR)/arch/rules.make
# Optionally include a local user makefile
-include local.make
# Where to find amrvac.t
vpath %.t $(SRC_DIR)
# Keep mod_usr.f for inspection
.PRECIOUS: mod_usr.f
# Intermediate files are removed
.INTERMEDIATE: amrvac.o mod_usr.o mod_usr.mod
# Always try to build/update the amrvac library
$(LIB_AMRVAC): force
@mkdir -p $(LIB_DIR)
$(MAKE) -C $(LIB_DIR) -f $(LIB_MAKE)
clean:
@echo 'Cleaning local objects ("make allclean" cleans libamrvac)'
$(RM) amrvac amrvac.o mod_usr.o mod_usr.mod
# Also clean the library
allclean: clean
@echo 'Cleaning libamrvac'
@mkdir -p $(LIB_DIR) # Prevent error message
$(MAKE) -C $(LIB_DIR) -f $(LIB_MAKE) clean
# Dependencies
amrvac: mod_usr.o amrvac.o
amrvac.o mod_usr.o: $(LIB_AMRVAC)
amrvac.o: mod_usr.o
mod_usr.o: mod_usr.f amrvac.h