1 | #------------------------------------------------------------------------------# |
---|
2 | # This file is part of the PALM model system. |
---|
3 | # |
---|
4 | # PALM is free software: you can redistribute it and/or modify it under the |
---|
5 | # terms of the GNU General Public License as published by the Free Software |
---|
6 | # Foundation, either version 3 of the License, or (at your option) any later |
---|
7 | # version. |
---|
8 | # |
---|
9 | # PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
10 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
11 | # A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
12 | # |
---|
13 | # You should have received a copy of the GNU General Public License along with |
---|
14 | # PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | # |
---|
16 | # Copyright 2017-2019 Leibniz Universitaet Hannover |
---|
17 | # Copyright 2017-2019 Deutscher Wetterdienst Offenbach |
---|
18 | #------------------------------------------------------------------------------# |
---|
19 | # |
---|
20 | # Current revisions: |
---|
21 | # ----------------- |
---|
22 | # |
---|
23 | # |
---|
24 | # Former revisions: |
---|
25 | # ----------------- |
---|
26 | # $Id: Makefile.gnu 3785 2019-03-06 10:41:14Z eckhard $ |
---|
27 | # Updated copyright note |
---|
28 | # |
---|
29 | # |
---|
30 | # 3618 2018-12-10 13:25:22Z eckhard |
---|
31 | # Prefixed INIFOR modules with inifor_ |
---|
32 | # |
---|
33 | # |
---|
34 | # 2718 2018-01-02 08:49:38Z maronga |
---|
35 | # Initial revision |
---|
36 | # |
---|
37 | # |
---|
38 | # |
---|
39 | # Authors: |
---|
40 | # -------- |
---|
41 | # @author Eckhard Kadasch |
---|
42 | # |
---|
43 | # Description: |
---|
44 | # ------------ |
---|
45 | # This file serves as a templete makefile for compiling INIFOR tests with |
---|
46 | # gfortran. |
---|
47 | #------------------------------------------------------------------------------! |
---|
48 | PROJECT = inifor |
---|
49 | PROJECT_PATH = .. |
---|
50 | BIN_PATH = $(PROJECT_PATH)/bin |
---|
51 | SRC_PATH = $(PROJECT_PATH)/src |
---|
52 | TESTS = $(patsubst %.f90,%,$(wildcard test-*.f90)) |
---|
53 | |
---|
54 | MODULES = util.mod $(SRC_PATH)/inifor_defs.mod $(SRC_PATH)/inifor_control.mod $(SRC_PATH)/inifor_util.mod $(SRC_PATH)/inifor_types.mod $(SRC_PATH)/inifor_transform.mod $(SRC_PATH)/inifor_io.mod $(SRC_PATH)/inifor_grid.mod |
---|
55 | SOURCES = $(MODULES:%.mod=%.f90) |
---|
56 | OBJECTS = $(SOURCES:%.f90=%.o) |
---|
57 | |
---|
58 | FC = gfortran |
---|
59 | FFLAGS = -g -Wall -fdefault-real-8 \ |
---|
60 | -ffpe-trap=invalid,zero,underflow,overflow |
---|
61 | INCLUDE = -I/home/ekadasch/local/include -I$(SRC_PATH) |
---|
62 | LIBRARY = -L/home/ekadasch/local/lib64 -lnetcdff -lutil |
---|
63 | |
---|
64 | .PHONY: clean test $(PROJECT) |
---|
65 | |
---|
66 | test: information $(PROJECT) $(TESTS) |
---|
67 | |
---|
68 | information: |
---|
69 | @echo $(TESTS) |
---|
70 | |
---|
71 | $(PROJECT): |
---|
72 | $(MAKE) -C $(PROJECT_PATH) $(PROJECT) |
---|
73 | |
---|
74 | test-grid: $(OBJECTS) $(MODULES) test-grid.o test-grid.mod util.mod util.o |
---|
75 | mkdir -p $(BIN_PATH) |
---|
76 | $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ -I$(SRC_PATH) $(LIBRARY) |
---|
77 | $(BIN_PATH)/$@ |
---|
78 | |
---|
79 | # $(TESTS) expands to files of this pattern: |
---|
80 | test-%: $(OBJECTS) $(MODULES) test-%.o test-%.mod |
---|
81 | mkdir -p $(BIN_PATH) |
---|
82 | $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ -I$(SRC_PATH) $(LIBRARY) |
---|
83 | $(BIN_PATH)/$@ |
---|
84 | |
---|
85 | %.o: %.mod |
---|
86 | |
---|
87 | util.o: util.f90 |
---|
88 | $(FC) $(FFLAGS) -c $< -o $@ |
---|
89 | |
---|
90 | util.mod: util.f90 |
---|
91 | $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) |
---|
92 | |
---|
93 | test-%.o: test-%.f90 |
---|
94 | $(FC) $(FFLAGS) -c $< -o $@ $(INCLUDE) |
---|
95 | |
---|
96 | test-%.mod: test-%.f90 |
---|
97 | $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) $(INCLUDE) |
---|
98 | |
---|
99 | clean: |
---|
100 | rm -rf *.mod *.o |
---|
101 | rm -rf $(BIN_PATH)/test-* |
---|