-
Notifications
You must be signed in to change notification settings - Fork 385
/
Makefile
167 lines (137 loc) · 4.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
##############################################################################
# @section DESCRIPTION
#
# VIC Image Driver Makefile
#
# @section LICENSE
#
# The Variable Infiltration Capacity (VIC) macroscale hydrological model
# Copyright (C) 2016 The Computational Hydrology Group, Department of Civil
# and Environmental Engineering, University of Washington.
#
# The VIC model is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##############################################################################
# -----------------------------------------------------------------------
# SET ENVIRONMENT-SPECIFIC OPTIONS HERE
# -----------------------------------------------------------------------
# VIC DRIVER PATH (include and src are subdirs of this)
DRIVERPATH = .
# VIC RUN PATH
SHAREDPATH = ../shared_all
SHAREDIMAGEPATH = ../shared_image
# VIC RUN PATH
VICPATH = ../../vic_run
# VIC EXTENTIONS PATH
EXTPATH = ../../extensions
# Set the routing model extension
# | Level | Value |
# |---------- |--------------------------------- |
# | rout_stub | Stub routing model (no routing) |
# | rout_rvic | Use RVIC routing scheme |
ROUT=rout_stub
include ${EXTPATH}/${ROUT}/rout.mk
ifndef NC_LIBS
NC_LIBS = $(shell nc-config --libs)
endif
$(info $$NC_LIBS is [${NC_LIBS}])
ifndef NC_CFLAGS
NC_CFLAGS = $(shell nc-config --cflags)
endif
$(info $$NC_CFLAGS is [${NC_CFLAGS}])
ifndef MPICC
MPICC = mpicc
endif
$(info $$MPICC is [${MPICC}])
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
UNAME_S := $(shell uname -s)
HOSTNAME := $(shell uname -n)
# Set the log level
# To turn off warning statements, set LOG_LVL >= 30
# | Level | Numeric value |
# |--------- |--------------- |
# | ERROR | Always Active |
# | WARNING | < 30 |
# | INFO | < 20 |
# | DEBUG | < 10 |
LOG_LVL = 5
# set includes
INCLUDES = -I ${DRIVERPATH}/include \
-I ${VICPATH}/include \
-I ${SHAREDPATH}/include \
-I ${SHAREDIMAGEPATH}/include \
-I ${EXTPATH}/${ROUT}/include
# Uncomment to include debugging information
CFLAGS = ${INCLUDES} ${NC_CFLAGS} -ggdb -O0 -Wall -Wextra -std=c99 \
-fopenmp \
-DLOG_LVL=$(LOG_LVL) \
-DGIT_VERSION=\"$(GIT_VERSION)\" \
-DUSERNAME=\"$(USER)\" \
-DHOSTNAME=\"$(HOSTNAME)\"
ifeq (true, ${TRAVIS})
# Add extra debugging for builds on travis
CFLAGS += -rdynamic -Wl,-export-dynamic
endif
LIBRARY = -lm ${NC_LIBS}
COMPEXE = vic_image
EXT = .exe
# -----------------------------------------------------------------------
# MOST USERS DO NOT NEED TO MODIFY BELOW THIS LINE
# -----------------------------------------------------------------------
HDRS = \
$(wildcard ${VICPATH}/include/*.h) \
$(wildcard ${DRIVERPATH}/include/*.h) \
$(wildcard ${SHAREDPATH}/include/*.h) \
$(wildcard ${SHAREDIMAGEPATH}/include/*.h) \
$(wildcard ${EXTPATH}/${ROUT}/include/*.h)
SRCS = \
$(wildcard ${VICPATH}/src/*.c) \
$(wildcard ${DRIVERPATH}/src/*.c) \
$(wildcard ${SHAREDPATH}/src/*.c) \
$(wildcard ${SHAREDIMAGEPATH}/src/*.c) \
$(wildcard ${EXTPATH}/${ROUT}/src/*.c)
OBJS = $(SRCS:%.o=%.c)
all:
make depend
make model
default:
make depend
make model
full:
make clean
make depend
make tags
make model
clean::
\rm -f core log
\rm -rf ${COMPEXE}${EXT} ${COMPEXE}${EXT}.dSYM
model: $(OBJS)
$(MPICC) -o ${COMPEXE}${EXT} $(OBJS) $(CFLAGS) $(LIBRARY)
# -------------------------------------------------------------
# tags
# so we can find our way around
# -------------------------------------------------------------
tags: TAGS
TAGS: $(SRCS) $(HDRS)
etags $(SRCS) $(HDRS)
clean::
\rm -f TAGS
# -------------------------------------------------------------
# depend
# -------------------------------------------------------------
depend: .depend
.depend: $(SRCS) $(HDRS)
$(MPICC) $(CFLAGS) -M $(SRCS) > $@
clean::
\rm -f .depend