summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 9abd8ea196a8fd8fa301c9de75f32310d871160a (plain)
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
#!/usr/bin/make -f

PTXDIST ?= ptxdist-$(shell sed -n 's/.*PTXCONF_CONFIGFILE_VERSION="\(.*\)"$$/\1/p' fixup_ptxconfigs.sh)

TOOLCHAINS := $(shell sed -n 's;Package: oselas.toolchain-20..\...\..-\(.*-gcc-.*\);gstate/\1.build;p' debian/control)

RULETARGETS := binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep
$(RULETARGETS): %: debian/control
	dh $@


debian/control: debian/bin/gencontrol.sh $(wildcard ptxconfigs/*.ptxconfig)
	debian/bin/gencontrol.sh

debian/ptxdistrc:
	: > $@
	test ! -d /ptx/src || echo 'PTXCONF_SETUP_SRCDIR="/ptx/src"' >> $@
	if [ -x /usr/lib/icecc/icecc-create-env ]; then \
		echo 'PTXCONF_SETUP_ICECC=y'; \
		echo 'PTXCONF_SETUP_ICECC_CREATE_ENV="/usr/lib/icecc/icecc-create-env"'; \
	fi >> $@

PTXDIST_ENV := \
	PTXDIST_PTXRC=$(CURDIR)/debian/ptxdistrc \
	CROSS_GDB_WITHOUT_PYTHON=n

override_dh_auto_build: debian/ptxdistrc
	$(PTXDIST_ENV) make -f build_all_v2.mk ARG="-j -q go" PTXDIST="$(PTXDIST)" $(TOOLCHAINS)

override_dh_auto_install-arch:
	mkdir -p $(CURDIR)/debian/tmp
	rm -rf $(CURDIR)/debian/tmp/opt
	cp -a inst/opt $(CURDIR)/debian/tmp/

override_dh_auto_clean:
	dh_auto_clean
	rm -rf gstate platform-* inst/

EXCLUDES = \
	-Xsysroot- \
	$(foreach d,$(wildcard inst/opt/OSELAS.Toolchain-*/*/*/*/lib),-X$(subst inst,,$(d))) \
	$(foreach d,$(wildcard inst/opt/OSELAS.Toolchain-*/*/*/lib/gcc/*/*),-X$(subst inst,,$(d)))

# don't change the permissions of target files
# the dynamic linker and glibc must remain executable
override_dh_fixperms:
	dh_fixperms $(EXCLUDES)

# don't strip target stuff
override_dh_strip:
	dh_strip $(EXCLUDES)

# don't use target binaries to generate dependencies
override_dh_shlibdeps:
	dh_shlibdeps $(EXCLUDES)

.PHONY: $(RULETARGETS)