File: rules

package info (click to toggle)
gcc-python-plugin 0.15-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 46,188 kB
  • ctags: 3,820
  • sloc: python: 14,937; ansic: 11,188; makefile: 493; xml: 440; cpp: 137; pascal: 75; sh: 2
file content (141 lines) | stat: -rwxr-xr-x 3,545 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
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
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/make -f
# -*- makefile -*-

CC 	= gcc-6
PYTHON	= python
p3	= gcc-python3-plugin
d3	= debian/$(p3)
p3dbg	= gcc-python3-dbg-plugin
d3dbg	= debian/$(p3dbg)
pdoc	= gcc-python-plugin-doc
ddoc	= debian/$(pdoc)

INTERP	= python3 python3-dbg # python python-dbg

export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

build-arch: $(INTERP:%=build-stamp-%)
build-indep: doc-stamp
build: $(INTERP:%=build-stamp-%) $(INTERP:%=check-stamp-%)
build-stamp-%:
	dh_testdir
	rm -rf build-$*
	mkdir -p build-$*
	tar -c -f - --exclude=debian --exclude=build-* . | tar -C build-$* -x -f -
	$(MAKE) -C build-$* \
	  CC=$(CC) \
	  PYTHON=$* PYTHON_CONFIG=$*-config \
	  PLUGIN_NAME=$(subst -,_,$*) \
	  PLUGIN_DSO=$(subst -,_,$*.so) \
	  PLUGIN_PYTHONPATH=$(shell $(CC) --print-file-name=plugin)/$(subst -,_,$*) \
	  plugin print-gcc-version
	touch $@

check-stamp-%: build-stamp-%
	dh_testdir
	: # FIXME: see the spec file for XFAIL tests
	-$(MAKE) -C build-$* \
	  CC=$(CC) \
	  PYTHON=$* PYTHON_CONFIG=$*-config \
	  PLUGIN_NAME=$(subst -,_,$*) \
	  PLUGIN_DSO=$(subst -,_,$*.so) \
	  PLUGIN_PYTHONPATH=$(shell $(CC) --print-file-name=plugin)/$(subst -,_,$*) \
	  all
	touch $@

doc-stamp:
	dh_testdir
	$(MAKE) -C docs html
	touch $@

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp* check-stamp* doc-stamp
	rm -rf build-*
	$(MAKE) -C docs clean
	find -type d -name __pycache__ | xargs -r rm -rf
	find -type f -name '*.py[co]'  | xargs -r rm -f
	dh_clean 

pre-install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

install-%: build-stamp-%
	dh_testdir
	dh_testroot
	$(MAKE) -C build-$* \
	  CC=$(CC) \
	  PYTHON=$* PYTHON_CONFIG=$*-config \
	  PLUGIN_NAME=$(subst -,_,$*) \
	  PLUGIN_DSO=$(subst -,_,$*.so) \
	  PLUGIN_PYTHONPATH=$(shell $(CC) --print-file-name=plugin)/$(subst -,_,$*) \
	  DESTDIR=$(CURDIR)/debian/gcc-$*-plugin \
	  install
	set -x; \
	p="gcc-$*-plugin"; \
	src="$(shell $(CC) --print-file-name=plugin)/$(subst -,_,$*)"; \
	dst="usr/lib/$(if $(findstring python3, $*),python3,python2.7)/dist-packages"; \
	mkdir -p debian/$$p/$$dst; \
	for d in gccutils libcpychecker; do \
	  tar -C debian/$$p/$$src -c -f - $$d \
	    | tar -C debian/$$p/$$dst -x -f -; \
	  rm -rf debian/$$p/$$src/$$d; \
	  dh_link -p$$p /$$dst/$$d /$$src/$$d; \
	done; \
	$(if $(findstring dbg,$*), \
	  rm -f debian/$$p/$$src/../libgcc-c-api.so; \
	  rm -rf debian/$$p/$$dst; \
	)

install: pre-install $(INTERP:%=install-%)
	dh_testdir
	dh_testroot
	find $(d) -type d -name __pycache__ | xargs -r rm -rf
	find $(d) -type f -name '*.py[co]'  | xargs -r rm -f

# Build architecture-independent files here.
binary-indep: install doc-stamp
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -p$(pdoc) docs/_build/html
	cp -a examples $(ddoc)/usr/share/doc/$(pdoc)/.
	dh_sphinxdoc -i
	dh_lintian -i
	dh_compress -i -X.py
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -a
#	dh_python2 -a
	dh_python3 -a --no-dbg-cleaning
	dh_installman -a
	dh_link -a
#	dh_strip -p$(p2) --dbg-package=$(p2dbg)
	dh_strip -p$(p3) --dbg-package=$(p3dbg)
	rm -rf debian/$(p3dbg)/usr/share/doc/$(p3dbg)
	ln -s $(p3) debian/$(p3dbg)/usr/share/doc/$(p3dbg)
	dh_lintian -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.NOTPARALLEL:
.PHONY: build clean binary-indep binary-arch binary install