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
|
#!/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)
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
profiled_build=no
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 --host='$(DEB_HOST_GNU_TYPE)')
touch configure-stamp
build: deb-checkdir build-stamp
ifeq ($(profiled_build),yes)
build-stamp: configure-stamp check-system-stamp build-pgen-stamp build-puse-stamp check-built-stamp
touch build-stamp
else
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
endif
check-system-stamp:
uudecode tests.tar.gz.uue
tar xf tests.tar.gz
cat $$(find tests -type f) > /dev/null
tests/rt/run /bin/dash tests/rt 2>&1 | sort | tee tests/rt-system.log
touch check-system-stamp
build-pgen-stamp: check-system-stamp
$(MAKE) -C build-tmp CFLAGS='$(CFLAGS) -fprofile-generate'
tests/rt/run build-tmp/src/dash tests/rt 2>&1 | tee tests/rt-pgen.log
shells="build-tmp/src/dash" \
tests/sp/run tests/sp/tests 2>&1 | tee tests/sp-pgen.log
touch build-pgen-stamp
build-puse-stamp: build-pgen-stamp
$(MAKE) -C build-tmp clean
$(MAKE) -C build-tmp CFLAGS='$(CFLAGS) -fprofile-use'
touch build-puse-stamp
check-built-stamp: build-puse-stamp
tests/rt/run build-tmp/src/dash tests/rt 2>&1 | sort | tee tests/rt-puse.log
comm -23 tests/rt-system.log tests/rt-puse.log > tests/progressions
comm -13 tests/rt-system.log tests/rt-puse.log > tests/regressions
@if [ -s tests/progressions ]; then \
echo >&2 'progressions found in profiled build:'; \
cat >&2 tests/progressions; \
fi
@if [ -s tests/regressions ]; then \
echo >&2 'regressions found in profiled build:'; \
cat >&2 tests/regressions; \
exit 1; \
fi
shells="/bin/dash build-tmp/src/dash" \
tests/sp/run tests/sp/tests 2>&1 | tee tests/sp-puse.log
touch check-built-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
rm -rf tests.tar.gz tests *-stamp
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 -9 '$(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)'
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)'
dpkg -b '$(DIR)' ..
.PHONY: configure build po-templates clean patch install install-indep \
install-arch binary binary-indep binary-arch
include debian/implicit
|