summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: d08735b2b3edcf71fe5addb3eaccfbd70ec6eaa2 (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
58
59
60
61
62
#!/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:
	rm -rf $(CURDIR)/debian/tmp/opt
	mkdir -p $(CURDIR)/debian/tmp/opt
	cp -a platform-*/sysroot-cross/opt/* $(CURDIR)/debian/tmp/opt/
	echo -Xsysroot- > $(CURDIR)/debian/excludes
	ls -d $(CURDIR)/debian/tmp/opt/OSELAS.Toolchain-*/*/*/*/lib \
		$(CURDIR)/debian/tmp/opt/OSELAS.Toolchain-*/*/*/lib/gcc/*/* \
		| sed 's;$(CURDIR)/debian/tmp;-X;' >> $(CURDIR)/debian/excludes

override_dh_auto_clean:
	dh_auto_clean
	rm -rf gstate platform-*

EXCLUDES = $(shell cat $(CURDIR)/debian/excludes)

# 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)

# ignore target stuff
override_dh_makeshlibs:
	dh_makeshlibs $(EXCLUDES)

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

.PHONY: $(RULETARGETS)