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-2018 Leibniz Universitaet Hannover |
---|
17 | # Copyright 2017-2018 Deutscher Wetterdienst Offenbach |
---|
18 | #------------------------------------------------------------------------------# |
---|
19 | # |
---|
20 | # Current revisions: |
---|
21 | # ----------------- |
---|
22 | # |
---|
23 | # |
---|
24 | # Former revisions: |
---|
25 | # ----------------- |
---|
26 | # $Id: Makefile.ifort 2718 2018-01-02 08:49:38Z raasch $ |
---|
27 | # Initial revision |
---|
28 | # |
---|
29 | # |
---|
30 | # |
---|
31 | # Authors: |
---|
32 | # -------- |
---|
33 | # @author Eckhard Kadasch |
---|
34 | # |
---|
35 | # Description: |
---|
36 | # ------------ |
---|
37 | # This file serves as a templete makefile for compiling INIFOR tests with |
---|
38 | # ifort. |
---|
39 | #------------------------------------------------------------------------------! |
---|
40 | PROJECT = inifor |
---|
41 | PROJECT_PATH = .. |
---|
42 | BIN_PATH = $(PROJECT_PATH)/bin |
---|
43 | SRC_PATH = $(PROJECT_PATH)/src |
---|
44 | TESTS = $(patsubst %.f90,%,$(wildcard test-*.f90)) |
---|
45 | |
---|
46 | MODULES = util.mod $(SRC_PATH)/defs.mod $(SRC_PATH)/control.mod $(SRC_PATH)/util.mod $(SRC_PATH)/types.mod $(SRC_PATH)/transform.mod $(SRC_PATH)/io.mod $(SRC_PATH)/grid.mod |
---|
47 | SOURCES = $(MODULES:%.mod=%.f90) |
---|
48 | OBJECTS = $(SOURCES:%.f90=%.o) |
---|
49 | |
---|
50 | FC = ifort |
---|
51 | FFLAGS = -g -real-size 64 -no-wrap-margin |
---|
52 | INCLUDE = -I$(SRC_PATH) |
---|
53 | LIBRARY = -L/usr/local/pkg/netcdf/4.3.2/lib -lnetcdff -lutil |
---|
54 | |
---|
55 | .PHONY: clean test $(PROJECT) |
---|
56 | |
---|
57 | test: information $(PROJECT) $(TESTS) |
---|
58 | |
---|
59 | information: |
---|
60 | @echo $(TESTS) |
---|
61 | |
---|
62 | $(PROJECT): |
---|
63 | $(MAKE) -C $(PROJECT_PATH) $(PROJECT) |
---|
64 | |
---|
65 | test-grid: $(OBJECTS) $(MODULES) test-grid.o test-grid.mod util.mod util.o |
---|
66 | mkdir -p $(BIN_PATH) |
---|
67 | $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ $(INCLUDE) $(LIBRARY) |
---|
68 | $(BIN_PATH)/$@ |
---|
69 | |
---|
70 | # $(TESTS) expands to files of this pattern: |
---|
71 | test-%: $(OBJECTS) $(MODULES) test-%.o test-%.mod |
---|
72 | mkdir -p $(BIN_PATH) |
---|
73 | $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ $(INCLUDE) $(LIBRARY) |
---|
74 | $(BIN_PATH)/$@ |
---|
75 | |
---|
76 | %.o: %.mod |
---|
77 | |
---|
78 | util.o: util.f90 |
---|
79 | $(FC) $(FFLAGS) -c $< -o $@ |
---|
80 | |
---|
81 | util.mod: util.f90 |
---|
82 | $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) |
---|
83 | |
---|
84 | test-%.o: test-%.f90 |
---|
85 | $(FC) $(FFLAGS) -c $< -o $@ $(INCLUDE) |
---|
86 | |
---|
87 | test-%.mod: test-%.f90 |
---|
88 | $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) $(INCLUDE) |
---|
89 | |
---|
90 | clean: |
---|
91 | rm -rf *.mod *.o |
---|
92 | rm -rf $(BIN_PATH)/test-* |
---|