summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 782268efeea62b54b3e92b91e09443564782cd7e (plain) (blame)
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
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

TARGET_BUILD=iwyu-build
VERSION=$(shell dpkg-parsechangelog |grep "^Version:"|sed -e "s|Version: \(.*\)|\1|")
include /usr/share/dpkg/architecture.mk
ADDITIONAL_CXX_FLAGS=""

ifneq (,$(filter $(DEB_BUILD_ARCH),mips64el))
	ADDITIONAL_CXX_FLAGS += -mxgot
endif

ifneq (,$(filter $(DEB_HOST_ARCH), armel))
	export DEB_LDFLAGS_MAINT_APPEND = -latomic
endif

%:
	dh $@ --buildsystem=cmake --builddirectory=$(TARGET_BUILD)


override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$(ADDITIONAL_CXX_FLAGS)" -DLLVM_PATH=/usr/lib/llvm-14/ -DCMAKE_PREFIX_PATH=/usr/lib/llvm-14/


override_dh_auto_build:
	dh_auto_build
	help2man --no-info --version-string "$(VERSION)" -n "Analyze #includes in C and C++ source files" $(TARGET_BUILD)/bin/include-what-you-use > $(TARGET_BUILD)/include-what-you-use.1
	cd $(TARGET_BUILD) && ln -s include-what-you-use.1 iwyu.1 && \
	cp ../fix_includes.py fix_include
	chrpath -d $(TARGET_BUILD)/bin/include-what-you-use


override_dh_auto_install:
	dh_auto_install
	cd debian/iwyu/usr/bin; \
		rm -f fix_includes.py; \
		mv iwyu_tool.py iwyu_tool

override_dh_auto_test:
# Do not fail the build if a test is failing.
# It isn't tested upstream besides i386 & amd64
	dh_auto_test || true

override_dh_auto_clean:
	rm -rf $(TARGET_BUILD)