summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 633a5a60e0a4ddd6006f07e402ce5127ba292999 (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
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
#! /usr/bin/make -f

# Debian package information
package		= strace

DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
  build64 = yes
  HOST64 = sparc64-linux
  CC64 = gcc -m64
endif

ifeq ($(DEB_HOST_GNU_TYPE),s390-linux)
  build64 = yes
  HOST64 = s390x-linux
  CC64 = gcc -m64
endif

ifeq ($(build64),yes)
   extra_build_targets += stamp-build64
endif

ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
else
  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif

all build: stamp-build

stamp-%: %/Makefile
	$(MAKE) -C $*
	touch $@

build/Makefile:
	mkdir -p $(@D)
	cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)

build64/Makefile:
	mkdir -p $(@D)
	cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)

clean:
	rm -rf debian/tmp debian/substvars debian/files
	rm -rf build64 stamp-build64
	rm -rf build stamp-build

binary: binary-indep binary-arch

binary-indep:

binary-arch: $(extra_build_targets) build checkroot
	test -f stamp-build || make $(MFLAGS) -f debian/rules build
	-rm -rf debian/tmp debian/files debian/substvars

	install -d -m 755 -o root -g root debian/tmp
	# reset the mode to work around a bug in install
	chown 755 debian/tmp
	install -d -m 755 -o root -g root debian/tmp/DEBIAN

# Install documentation
	install -d -o root -g root -m 755 debian/tmp/usr/share/doc/$(package)
	install -p -o root -g root -m 644 debian/changelog \
			debian/tmp/usr/share/doc/$(package)/changelog.Debian
	install -p -o root -g root -m 644 TODO \
			debian/tmp/usr/share/doc/$(package)/TODO
	install -p -o root -g root -m 644 NEWS \
			debian/tmp/usr/share/doc/$(package)/changelog
	gzip -9 debian/tmp/usr/share/doc/$(package)/*
	install -p -o root -g root -m 644 debian/copyright \
			debian/tmp/usr/share/doc/$(package)/copyright

# Install strace
	install -d -o root -g root -m 755 debian/tmp/usr/bin debian/tmp/usr/share/man/man1
	install -s -o root -g root -m 755 build/strace debian/tmp/usr/bin/strace
	install -p -o root -g root -m 644 strace.1 debian/tmp/usr/share/man/man1/strace.1
	gzip -9 debian/tmp/usr/share/man/man1/strace.1

ifeq ($(build64),yes)
	install -s -o root -g root -m 755 build64/strace debian/tmp/usr/bin/strace64
	ln -s strace.1 debian/tmp/usr/share/man/man1/strace64.1
endif

	dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))

	dpkg-gencontrol -isp
	dpkg --build debian/tmp ..

checkroot:
	test root = "`whoami`"