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