summaryrefslogtreecommitdiff
path: root/cfg.mk
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-05-03 15:35:56 +0200
committerJim Meyering <meyering@redhat.com>2010-05-03 15:49:38 +0200
commit7d501cdd9c1b7c37dd0c3c085c05969edd2917ee (patch)
tree3c6e4a7c234c5f119dbf8fba817ed56b1737d8fc /cfg.mk
parentecf6d16dc7488e6929cd431c31288b354071dce3 (diff)
downloadcoreutils-7d501cdd9c1b7c37dd0c3c085c05969edd2917ee.tar.xz
maint: factor trap-related code out of two syntax-check rules
* cfg.mk (gl_trap_): Define, using a loop and eval'd trap, rather than repeated "trap" uses. Also handle "13", SIGPIPE. (sc_always_defined_macros): Use it. (sc_system_h_headers): Likewise.
Diffstat (limited to 'cfg.mk')
-rw-r--r--cfg.mk15
1 files changed, 9 insertions, 6 deletions
diff --git a/cfg.mk b/cfg.mk
index 3bdf28c96..679ea8e2f 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -135,13 +135,18 @@ gl_extract_significant_defines_ = \
> $@-t
@mv $@-t $@
+define gl_trap_
+ Exit () { set +e; (exit $$1); exit $$1; }; \
+ for sig in 1 2 3 13 15; do \
+ eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \
+ done
+endef
+
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -d $(gnulib_dir); then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0; \
- am__exit='(exit $rc); exit $rc'; \
- trap "rc=129; $$am__exit" 1; trap "rc=130; $$am__exit" 2; \
- trap "rc=131; $$am__exit" 3; trap "rc=143; $$am__exit" 15; \
+ $(gl_trap_); \
grep -f .re-defmac $$($(VC_LIST_EXCEPT)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
@@ -161,9 +166,7 @@ sc_always_defined_macros: .re-defmac
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0; \
- am__exit='(exit $rc); exit $rc'; \
- trap "rc=129; $$am__exit" 1; trap "rc=130; $$am__exit" 2; \
- trap "rc=131; $$am__exit" 3; trap "rc=143; $$am__exit" 15; \
+ $(gl_trap_); \
grep -nE -f .re-list \
$$($(VC_LIST_EXCEPT) | grep '^src/') \
&& { echo '$(ME): the above are already included via system.h'\