File: rules

package info (click to toggle)
double-conversion 3.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 19,580 kB
  • sloc: cpp: 321,603; makefile: 48; sh: 15
file content (65 lines) | stat: -rwxr-xr-x 1,775 bytes parent folder | download
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Get compilation flags from dpkg-buildflags
include /usr/share/dpkg/default.mk
ifeq ($(origin CXX),default)
       CXX = $(DEB_HOST_GNU_TYPE)-g++
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
endif

%:
	dh $@

SO=1
VERS=$(SO).0

SRC=$(sort $(wildcard double-conversion/*.cc))
OBJ=$(SRC:.cc=.o)

TEST_SRC=$(sort $(wildcard test/cctest/*.cc))
TEST_OBJ=$(TEST_SRC:.cc=.o)

CPPFLAGS += -Idouble-conversion/ -I.

debian/shared_dir debian/static_dir:
	mkdir -p $(subst _dir,,$(@))
	touch $@

$(subst double-conversion/,debian/static/,$(OBJ)): \
  debian/static/%.o : double-conversion/%.cc debian/static_dir

	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

$(subst double-conversion/,debian/shared/,$(OBJ)): \
  debian/shared/%.o : double-conversion/%.cc debian/shared_dir

	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC -c $< -o $@

libdouble-conversion.so: libdouble-conversion.so.$(SO)
	ln -snf $< $@

libdouble-conversion.so.$(SO): libdouble-conversion.so.$(VERS)
	ln -snf $< $@

libdouble-conversion.so.$(VERS): $(subst double-conversion/,debian/shared/,$(OBJ))
	$(CXX) $(LDFLAGS) -shared -Wl,-soname=libdouble-conversion.so.$(SO) -o $@ $^

libdouble-conversion.a: $(subst double-conversion/,debian/static/,$(OBJ))
	ar r $@ $^

run_tests: $(TEST_OBJ) libdouble-conversion.a
	$(CXX) $(LDFLAGS) -o run_tests $^

override_dh_auto_build: libdouble-conversion.so libdouble-conversion.a run_tests

override_dh_auto_clean:
	rm -f libdouble-conversion.* run_tests test/cctest/*.o
	rm -rf debian/shared debian/static
	rm -f debian/static_dir debian/shared_dir