[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.gnu 2718 2018-01-02 08:49:38Z thiele $ |
---|
| 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 | # gfortran. |
---|
| 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 = gfortran |
---|
| 51 | FFLAGS = -g -Wall -fdefault-real-8 \ |
---|
| 52 | -ffpe-trap=invalid,zero,underflow,overflow |
---|
| 53 | INCLUDE = -I/home/ekadasch/local/include -I$(SRC_PATH) |
---|
| 54 | LIBRARY = -L/home/ekadasch/local/lib64 -lnetcdff -lutil |
---|
| 55 | |
---|
| 56 | .PHONY: clean test $(PROJECT) |
---|
| 57 | |
---|
| 58 | test: information $(PROJECT) $(TESTS) |
---|
| 59 | |
---|
| 60 | information: |
---|
| 61 | @echo $(TESTS) |
---|
| 62 | |
---|
| 63 | $(PROJECT): |
---|
| 64 | $(MAKE) -C $(PROJECT_PATH) $(PROJECT) |
---|
| 65 | |
---|
| 66 | test-grid: $(OBJECTS) $(MODULES) test-grid.o test-grid.mod util.mod util.o |
---|
| 67 | mkdir -p $(BIN_PATH) |
---|
| 68 | $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ -I$(SRC_PATH) $(LIBRARY) |
---|
| 69 | $(BIN_PATH)/$@ |
---|
| 70 | |
---|
| 71 | # $(TESTS) expands to files of this pattern: |
---|
| 72 | test-%: $(OBJECTS) $(MODULES) test-%.o test-%.mod |
---|
| 73 | mkdir -p $(BIN_PATH) |
---|
| 74 | $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ -I$(SRC_PATH) $(LIBRARY) |
---|
| 75 | $(BIN_PATH)/$@ |
---|
| 76 | |
---|
| 77 | %.o: %.mod |
---|
| 78 | |
---|
| 79 | util.o: util.f90 |
---|
| 80 | $(FC) $(FFLAGS) -c $< -o $@ |
---|
| 81 | |
---|
| 82 | util.mod: util.f90 |
---|
| 83 | $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) |
---|
| 84 | |
---|
| 85 | test-%.o: test-%.f90 |
---|
| 86 | $(FC) $(FFLAGS) -c $< -o $@ $(INCLUDE) |
---|
| 87 | |
---|
| 88 | test-%.mod: test-%.f90 |
---|
| 89 | $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) $(INCLUDE) |
---|
| 90 | |
---|
| 91 | clean: |
---|
| 92 | rm -rf *.mod *.o |
---|
| 93 | rm -rf $(BIN_PATH)/test-* |
---|