-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
77 lines (55 loc) · 1.92 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
76
77
#Edit Makefile_compiler to change compiler options
FORUTILS_SRC_DIR ?= .
ifeq ($(HASINCLUDED),)
include $(FORUTILS_SRC_DIR)/Makefile_compiler
HASINCLUDED=T
endif
ifeq ($(MPIF90C),)
all: Release Debug
else
all: Release Debug ReleaseMPI DebugMPI
endif
# export all variables to the sub-make below
export
SRCS = MiscUtils.f90 MpiUtils.f90 StringUtils.f90 ArrayUtils.f90 FileUtils.f90 \
IniObjects.f90 RandUtils.f90 ObjectLists.f90 MatrixUtils.f90 RangeUtils.f90 \
Interpolation.f90
OBJS = $(patsubst %.f90,%.o,$(SRCS))
Release:
@$(MAKE) OUTPUT_DIR=Release F90FLAGS="$(F90RELEASEFLAGS)" $(MAKEOPT) directories
Releaselib:
@$(MAKE) OUTPUT_DIR=Releaselib $(MAKEOPT) directories
ReleaseMPI:
@$(MAKE) OUTPUT_DIR=ReleaseMPI F90C="$(MPIF90C)" F90FLAGS="$(F90RELEASEFLAGS) -DMPI" $(MAKEOPT) directories
Debug:
@$(MAKE) OUTPUT_DIR=Debug F90FLAGS="$(F90DEBUGFLAGS)" $(MAKEOPT) directories
Debuglib:
@$(MAKE) OUTPUT_DIR=Debuglib $(MAKEOPT) directories
DebugMPI:
@$(MAKE) OUTPUT_DIR=DebugMPI F90C="$(MPIF90C)" F90FLAGS="$(F90DEBUGFLAGS) -DMPI" $(MAKEOPT) directories
cur_ver := $(shell cat compiler.ver 2>&1 || echo "")
ifneq ($(cur_ver),$(compiler_ver))
$(shell rm -f compiler.ver *.d)
endif
compiler.ver:
@echo $(compiler_ver) > compiler.ver
@rm -f *.d
%.o: $(FORUTILS_SRC_DIR)/%.f90 compiler.ver
$(F90C) $(F90COMMONFLAGS) $(F90FLAGS) -o $*.o -c $<
libforutils.a: $(OBJS) | silent
$(AREXE) -r libforutils.a $(OBJS)
clean:
-rm -fr Debug* Release*
silent:
@:
# Build in output dir to get file dependencies correctly and make use
# of delta builds, where only changed files and their dependents are
# rebuild.
directories:
@mkdir -p $(OUTPUT_DIR)
$(MAKE) -C $(OUTPUT_DIR) $(MAKEOPT) -f../Makefile FORUTILS_SRC_DIR=.. libforutils.a
# Include dependency files generated by a previous run of make
-include $(SRCS:.f90=.d)
.PHONY: directories clean Release Debug ReleaseMPI DebugMPI Releaselib Debuglib
#Avoid problems with intel gen-dep
%.h: ;