generated from noaa-nwfsc/NWFSC-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (57 loc) · 2.43 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
BUILD_TYPE ?= release
#CCEXE = /usr/local/opt/llvm/clang++
CCEXE = g++
#CFLAGS = -Wall -g -std=c++11
CFLAGS = -Wall -Wextra -std=c++11
ifeq ($(BUILD_TYPE),debug)
CFLAGS += -g -O0 -fno-inline -fstack-protector-all
else ifeq ($(BUILD_TYPE),release)
CFLAGS += -O2 -ffast-math -DNDEBUG -march=native
else
$(error Invalid BUILD_TYPE. Use 'debug' or 'release')
endif
CC = $(CCEXE) $(CFLAGS)
WXFLAGS = $(shell wx-config --cxxflags)
WXLIBS = $(shell wx-config --libs)
RAPIDJSON = -Irapidjson/include
NETCDF = -Ilocal/netcdf-cxx4/include -Ilocal/netcdf-c/include -Ilocal/hdf5/include
ABSLIB_NCCPP = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))local/netcdf-cxx4/lib
ABSLIB_NCC = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))local/netcdf-c/lib
ifeq ($(shell uname -s), Darwin)
DL_EXT = dylib
else
DL_EXT = so
endif
LINKFLAGS = -v -Llocal/netcdf-cxx4/lib -Llocal/netcdf-c/lib -lnetcdf_c++4 -lnetcdf -lpthread -pthread -Wl,-rpath,$(ABSLIB_NCCPP) -Wl,-rpath,$(ABSLIB_NCC) local/netcdf-cxx4/lib/libnetcdf_c++4.$(DL_EXT) local/netcdf-c/lib/libnetcdf.$(DL_EXT)
OBJ = $(addprefix build/, model.o hydro.o load.o fish.o map.o util.o env_sim.o map_gen.o)
headless: $(OBJ) build/headless.o bin
$(CC) $(OBJ) build/headless.o -o bin/headless $(LINKFLAGS)
gui: $(OBJ) build/gui.o bin
$(CC) $(WXLIBS) $(OBJ) build/gui.o -o bin/gui $(LINKFLAGS)
build/gui.o: src/gui.cpp src/model.h src/fish.h build
$(CC) $(WXFLAGS) -c src/gui.cpp -o build/gui.o
bin:
mkdir bin
build:
mkdir build
build/headless.o: src/headless.cpp src/model.h build
$(CC) -c src/headless.cpp -o build/headless.o
build/model.o: src/model.cpp src/model.h src/load.h src/fish.h src/map.h build
$(CC) $(RAPIDJSON) $(NETCDF) -c src/model.cpp -o build/model.o
build/hydro.o: src/hydro.cpp src/hydro.h src/map.h build
$(CC) -c src/hydro.cpp -o build/hydro.o
build/load.o: src/load.cpp src/load.h src/map.h build
$(CC) $(NETCDF) -c src/load.cpp -o build/load.o
build/fish.o: src/fish.cpp src/fish.h src/model.h src/map.h src/util.h build
$(CC) -c src/fish.cpp -o build/fish.o
build/map.o: src/map.cpp src/map.h build
$(CC) -c src/map.cpp -o build/map.o
build/util.o: src/util.cpp src/util.h build
$(CC) -c src/util.cpp -o build/util.o
build/env_sim.o: src/env_sim.cpp src/env_sim.h src/map.h build
$(CC) -c src/env_sim.cpp -o build/env_sim.o
build/map_gen.o: src/map_gen.cpp src/map_gen.h src/map.h build
$(CC) -c src/map_gen.cpp -o build/map_gen.o
all: headless
clean:
rm -rdf bin/* build/*