File: rules

package info (click to toggle)
dash 0.5.8-2.4
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,264 kB
  • sloc: ansic: 13,040; sh: 1,398; makefile: 154
file content (118 lines) | stat: -rwxr-xr-x 3,888 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
#!/usr/bin/make -f

CC =gcc
STRIP =strip

DEB_BUILD_MAINT_OPTIONS =hardening=+all
CFLAGS =$(shell DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS) \
  dpkg-buildflags --get CFLAGS)
LDFLAGS =$(shell DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS) \
  dpkg-buildflags --get LDFLAGS)
CPPFLAGS =$(shell DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS) \
  dpkg-buildflags --get CPPFLAGS)

BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')

DEB_HOST_GNU_TYPE =$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE =$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  CC =$(DEB_HOST_GNU_TYPE)-gcc
  STRIP =$(DEB_HOST_GNU_TYPE)-strip
endif

ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
  CC =diet -v -Os gcc
  CFLAGS =-nostdinc -Wall
  CPPFLAGS =
  LDFLAGS =
endif
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  STRIP =: strip
endif

DIR =$(shell pwd)/debian/dash
DIRA =$(shell pwd)/debian/ash

patch: deb-checkdir patch-stamp
patch-stamp:
	for i in `ls -1 debian/diff/*.diff || :`; do \
	  patch -p1 <$$i || exit 1; \
	done
	touch patch-stamp

configure: deb-checkdir configure-stamp
configure-stamp: patch-stamp
	mkdir -p build-tmp
	touch configure
	(cd build-tmp && CC='$(CC)' \
	  CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \
	  exec ../configure --enable-fnmatch --disable-lineno \
	    --host='$(DEB_HOST_GNU_TYPE)')
	touch configure-stamp

build: build-arch build-indep
build-arch: deb-checkdir build-stamp
build-indep:
build-stamp: configure-stamp
	-$(CC) -v
	(cd build-tmp && exec $(MAKE) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)') || \
	  (cat build-tmp/config.log; exit 1) || exit 1
	touch build-stamp

po-templates: po-templates-stamp
po-templates-stamp: deb-checkdir
	po2debconf debian/dash.templates.in >debian/dash.templates
	touch po-templates-stamp

clean: deb-checkdir deb-checkuid
	rm -rf build-tmp
	test ! -e patch-stamp || \
	  for i in `ls -1r debian/diff/*.diff || :`; do patch -p1 -R <$$i; done
	rm -f configure-stamp patch-stamp build-stamp po-templates-stamp
	rm -rf '$(DIR)' '$(DIRA)'
	rm -f debian/files debian/substvars debian/dash.templates changelog

install: install-indep install-arch
install-indep: deb-checkdir deb-checkuid
	rm -rf '$(DIRA)'
	install -d -m0755 '$(DIRA)'/bin
	ln -s dash '$(DIRA)'/bin/ash
	install -d -m0755 '$(DIRA)'/usr/share/man/man1/
	ln -s dash.1.gz '$(DIRA)'/usr/share/man/man1/ash.1.gz
	# changelog
	test -r changelog || ln -s ChangeLog changelog
install-arch: deb-checkdir deb-checkuid build-stamp
	# dash
	rm -rf '$(DIR)'
	install -d -m0755 '$(DIR)'/bin
	install -m0755 build-tmp/src/dash '$(DIR)'/bin/dash
	$(STRIP) -R .comment -R .note '$(DIR)'/bin/dash
	ln -s dash '$(DIR)'/bin/sh
	install -d -m0755 '$(DIR)'/usr/share/man/man1/
	install -m0644 src/dash.1 '$(DIR)'/usr/share/man/man1/dash.1
	gzip -9n '$(DIR)'/usr/share/man/man1/dash.1
	ln -s dash.1.gz '$(DIR)'/usr/share/man/man1/sh.1.gz
	install -d -m0755 '$(DIR)'/usr/share/menu
	install -m0644 debian/dash.menu '$(DIR)'/usr/share/menu/dash
	# changelog
	test -r changelog || ln -s ChangeLog changelog

binary: binary-indep binary-arch
binary-indep: install-indep ash.deb
	dpkg-gencontrol -isp -pash -P'$(DIRA)'
	find '$(DIRA)' -depth -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg -b '$(DIRA)' ..
binary-arch: install-arch po-templates dash.deb
	# dash
	rm -f debian/substvars
	test '$(CC)' != 'gcc' || dpkg-shlibdeps '$(DIR)'/bin/dash
	dpkg-gencontrol -isp -pdash -P'$(DIR)'
	find '$(DIR)' -depth -newermt '$(BUILD_DATE)' -print0 | \
		xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	dpkg -b '$(DIR)' ..

.PHONY: configure build build-arch build-indep po-templates clean patch install install-indep \
	  install-arch binary binary-indep binary-arch

include debian/implicit