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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
#!/usr/bin/make -f
# -*- makefile -*-
CC = gcc-8
#ALT_CC = gcc-9
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
ifneq (,$(ALT_CC))
rm -rf build-alt-$*
mkdir -p build-alt-$*
tar -c -f - --exclude=debian --exclude=build-* . | tar -C build-alt-$* -x -f -
$(MAKE) -C build-alt-$* \
CC=$(ALT_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
endif
touch $@
check-stamp-%: build-stamp-%
dh_testdir
: # TODO: 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
ifneq (,$(ALT_CC))
-$(MAKE) -C build-alt-$* \
CC=$(ALT_CC) \
PYTHON=$* PYTHON_CONFIG=$*-config \
PLUGIN_NAME=$(subst -,_,$*) \
PLUGIN_DSO=$(subst -,_,$*.so) \
PLUGIN_PYTHONPATH=$(shell $(CC) --print-file-name=plugin)/$(subst -,_,$*) \
all
endif
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
ifneq (,$(ALT_CC))
$(MAKE) -C build-alt-$* \
CC=$(ALT_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 $(ALT_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; \
)
endif
$(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
|