source: palm/trunk/UTIL/inifor/tests/Makefile @ 4807

Last change on this file since 4807 was 4567, checked in by eckhard, 4 years ago

Don't let 'clean' remove code files if BIN_PATH is set to tests directory

  • Property svn:keywords set to Id
File size: 3.0 KB
RevLine 
[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#
[4481]16# Copyright 2017-2020 Leibniz Universitaet Hannover
17# Copyright 2017-2020 Deutscher Wetterdienst Offenbach
[2718]18#------------------------------------------------------------------------------#
[2696]19#
20# Current revisions:
21# -----------------
22#
23#
24# Former revisions:
25# -----------------
26# $Id: Makefile 4567 2020-06-19 09:30:03Z gronemeier $
[4567]27# Don't let 'clean' remove code files if BIN_PATH is set to tests directory
28#
29#
30# 4481 2020-03-31 18:55:54Z maronga
[3785]31# Updated copyright note
32#
33#
34# 3618 2018-12-10 13:25:22Z eckhard
[3618]35# Prefixed INIFOR modules with inifor_
36#
37#
38# 2718 2018-01-02 08:49:38Z maronga
[2696]39# Initial revision
40#
41#
42#
43# Authors:
44# --------
45# @author Eckhard Kadasch
46#
47# Description:
48# ------------
49# This makefile is called from INIFOR's main makefile to compile and run tests.
50#------------------------------------------------------------------------------!
51PROJECT = inifor
52PROJECT_PATH = ..
53BIN_PATH = $(PROJECT_PATH)/bin
54SRC_PATH = $(PROJECT_PATH)/src
55TESTS    = $(patsubst %.f90,%,$(wildcard test-*.f90))
56
[3618]57MODULES = 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]58SOURCES = $(MODULES:%.mod=%.f90)
59OBJECTS = $(SOURCES:%.f90=%.o)
60
61FC      = gfortran
62FFLAGS  = -g -Wall -fdefault-real-8 \
63                  -ffpe-trap=invalid,zero,underflow,overflow
64INCLUDE = -I$(SRC_PATH)
65LIBRARY = -L/home/ekadasch/local/lib64 -lnetcdff -lutil
66                 
67.PHONY: clean test $(PROJECT)
68
69test: information $(PROJECT) $(TESTS)
70
71information:
72        @echo $(TESTS)
73
74$(PROJECT):
75        $(MAKE) -C $(PROJECT_PATH) $(PROJECT)
76
77test-grid: $(OBJECTS) $(MODULES) test-grid.o test-grid.mod util.mod util.o
78        mkdir -p $(BIN_PATH)
79        $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ $(INCLUDE) $(LIBRARY)
80        $(BIN_PATH)/$@
81
82# $(TESTS) expands to files of this pattern:
83test-%: $(OBJECTS) $(MODULES) test-%.o test-%.mod
84        mkdir -p $(BIN_PATH)
85        $(FC) $(FFLAGS) $(OBJECTS) $@.o -o $(BIN_PATH)/$@ $(INCLUDE) $(LIBRARY)
86        $(BIN_PATH)/$@
87
88%.o: %.mod
89
90util.o: util.f90
[4567]91        $(FC) $(FFLAGS) -c $< -o $@ $(INCLUDE)
[2696]92
93util.mod: util.f90
[4567]94        $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) $(INCLUDE)
[2696]95
96test-%.o: test-%.f90
97        $(FC) $(FFLAGS) -c $< -o $@ $(INCLUDE)
98
99test-%.mod: test-%.f90
100        $(FC) $(FFLAGS) -c $< -o $(@:%.mod=%.o) $(INCLUDE)
101
102clean:
103        rm -rf *.mod *.o
[4567]104        for FILE in $(BIN_PATH)/test-*.f90; do rm -f $${FILE%.*}; done
Note: See TracBrowser for help on using the repository browser.