-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
129 lines (97 loc) · 2.89 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
MODULE = qdtools
SPEC = smartmet-qdtools
REQUIRES = gdal fmt
include $(shell echo $${PREFIX-/usr})/share/smartmet/devel/makefile.inc
# mdsplib does not declare things correctly
MAINFLAGS += -fpermissive
# Default compiler flags
DEFINES = -DUNIX
# gdal 32 from pgdg
INCLUDES += \
-isystem $(includedir)/netcdf-3 \
-isystem $(includedir)/bufr \
-isystem $(includedir)/libecbufr \
-isystem $(includedir)/ecbufr \
-I$(includedir)/smartmet
LIBS += $(PREFIX_LDFLAGS) \
-lsmartmet-calculator \
-lsmartmet-smarttools \
-lsmartmet-newbase \
-lsmartmet-macgyver \
-lsmartmet-gis \
-lsmartmet-imagine \
-lboost_regex \
-lboost_program_options \
-lboost_iostreams \
-lboost_thread \
-lboost_system \
$(REQUIRED_LIBS) \
-lmetar \
-ljasper \
-leccodes \
-lnetcdf_c++ -lnetcdf \
-lMXADataModel -lhdf5 \
-lbufr \
-lecbufr \
-lbz2 -ljpeg -lpng -lz -lrt \
-lpthread
# Compilation directories
vpath %.cpp source main
vpath %.h include
vpath %.o $(objdir)
vpath %.d $(objdir)
# The files to be compiled
HDRS = $(patsubst include/%,%,$(wildcard *.h include/*.h))
MAINSRCS = $(patsubst main/%,%,$(wildcard main/*.cpp))
MAINPROGS = $(MAINSRCS:%.cpp=%)
MAINOBJS = $(MAINSRCS:%.cpp=%.o)
MAINOBJFILES = $(MAINOBJS:%.o=obj/%.o)
SRCS = $(patsubst source/%,%,$(wildcard source/*.cpp))
OBJS = $(SRCS:%.cpp=%.o)
OBJFILES = $(OBJS:%.o=obj/%.o)
INCLUDES := -Iinclude $(INCLUDES)
# For make depend:
ALLSRCS = $(wildcard main/*.cpp source/*.cpp)
.PHONY: test rpm
# The rules
all: objdir $(MAINPROGS)
debug: objdir $(MAINPROGS)
release: objdir $(MAINPROGS)
profile: objdir $(MAINPROGS)
.SECONDEXPANSION:
$(MAINPROGS): % : obj/%.o $(OBJFILES)
$(CXX) $(LDFLAGS) -o $@ obj/[email protected] $(OBJFILES) $(LIBS)
clean:
rm -f $(MAINPROGS) source/*~ include/*~
rm -rf obj
$(MAKE) -C test $@
format:
clang-format -i -style=file include/*.h source/*.cpp main/*.cpp
install:
mkdir -p $(bindir)
@list='$(MAINPROGS)'; \
for prog in $$list; do \
echo $(INSTALL_PROG) $$prog $(bindir)/$$prog; \
$(INSTALL_PROG) $$prog $(bindir)/$$prog; \
done
mkdir -p $(datadir)/smartmet/dictionaries
$(INSTALL_DATA) cnf/en.conf $(datadir)/smartmet/dictionaries
mkdir -p $(datadir)/smartmet/formats
$(INSTALL_DATA) cnf/netcdf.conf $(datadir)/smartmet/formats/
$(INSTALL_DATA) cnf/grib.conf $(datadir)/smartmet/formats/
$(INSTALL_DATA) cnf/bufr.conf $(datadir)/smartmet/formats/
$(INSTALL_DATA) cnf/stations.csv $(datadir)/smartmet/
$(INSTALL_DATA) cnf/parameters.csv $(datadir)/smartmet/
test:
cd test && make test
objdir:
@mkdir -p $(objdir)
rpm: clean $(SPEC).spec
rm -f $(SPEC).tar.gz # Clean a possible leftover from previous attempt
tar -czvf $(SPEC).tar.gz --exclude test --exclude-vcs --transform "s,^,$(SPEC)/," *
rpmbuild -tb $(SPEC).tar.gz
rm -f $(SPEC).tar.gz
.SUFFIXES: $(SUFFIXES) .cpp
obj/%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -c -MD -MF $(patsubst obj/%.o, obj/%.d, $@) -MT $@ -o $@ $<
-include obj/*.d