-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (72 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
SUBNAME = download
SPEC = smartmet-plugin-$(SUBNAME)
INCDIR = smartmet/plugins/$(SUBNAME)
REQUIRES = gdal jsoncpp configpp
include $(shell echo $${PREFIX-/usr})/share/smartmet/devel/makefile.inc
FLAGS += -Wno-vla -Wno-variadic-macros -Wno-deprecated-declarations -Wno-unknown-pragmas
# Compiler options
DEFINES = -DUNIX -D_REENTRANT
CORBA_INCLUDE = -isystem /usr/include/smartmet/grid-content/contentServer/corba/stubs \
-isystem /usr/include/smartmet/grid-content/dataServer/corba/stubs \
-isystem /usr/include/smartmet/grid-content/queryServer/corba/stubs
CORBA_LIBS = -lomniORB4 -lomnithread
INCLUDES += $(CORBA_INCLUDE)
LIBS += $(PREFIX_LDFLAGS) \
-lsmartmet-spine \
-lsmartmet-newbase \
-lsmartmet-macgyver \
$(REQUIRED_LIBS) \
$(CORBA_LIBS) \
-lboost_thread \
-lboost_iostreams \
-lboost_system \
-lbz2 -lz \
-leccodes -leccodes_memfs \
-lnetcdf_c++
# What to install
LIBFILE = $(SUBNAME).so
# Compilation directories
vpath %.cpp $(SUBNAME)
vpath %.h $(SUBNAME)
# The files to be compiled
SRCS = $(wildcard $(SUBNAME)/*.cpp)
HDRS = $(wildcard $(SUBNAME)/*.h)
OBJS = $(patsubst %.cpp, obj/%.o, $(notdir $(SRCS)))
INCLUDES := -I$(SUBNAME) $(INCLUDES)
.PHONY: test test-qd test-grid rpm
# The rules
all: objdir $(LIBFILE)
debug: all
release: all
profile: all
$(LIBFILE): $(OBJS)
$(CXX) $(LDFLAGS) -shared -rdynamic -o $(LIBFILE) $(OBJS) $(LIBS)
#@echo Checking $(LIBFILE) for unresolved references
#@if ldd -r $(LIBFILE) 2>&1 | c++filt | grep ^undefined\ symbol | grep -v SmartMet::Engine:: ; \
# then rm -v $(LIBFILE); \
# exit 1; \
#fi
clean:
rm -f $(LIBFILE) *~ $(SUBNAME)/*~
rm -rf obj
$(MAKE) -C test $@
format:
clang-format -i -style=file $(SUBNAME)/*.h $(SUBNAME)/*.cpp
install:
@mkdir -p $(plugindir)
$(INSTALL_PROG) $(LIBFILE) $(plugindir)/$(LIBFILE)
test test-qd test-grid:
$(MAKE) -C test $@
objdir:
@mkdir -p $(objdir)
# Forcibly lower RPM_BUILD_NCPUs in CircleCI cloud(but not on local builds)
RPMBUILD=$(shell test "$$CIRCLE_BUILD_NUM" && echo RPM_BUILD_NCPUS=2 rpmbuild || echo rpmbuild)
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 $(wildcard obj/*.d)