mirror of
https://salsa.debian.org/debian/dash.git
synced 2026-01-27 01:44:22 +00:00
dash (0.5.7-4ubuntu1) trusty; urgency=medium
* Merge from Debian testing, remaining changes:
- If the dash/sh question has not been seen by the user, reset it to
the default which is now true.
- Support build with profile feedback based optimization.
- Ensure correct strip is called when cross-building.
156 lines
4.9 KiB
Makefile
Executable File
156 lines
4.9 KiB
Makefile
Executable File
#!/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
|