about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/Makefile
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-06 20:32:46 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-06 22:35:01 +0200
commit53850f044f65dd11efdf67a2ab214d312295d85c (patch)
tree1ceaf2a2c4e7153079a8d07046865fc07cb60d49 /sysdeps/mach/hurd/Makefile
parent41d8c3bc33bcae1ebb8077b0442caef4917f763a (diff)
downloadglibc-53850f044f65dd11efdf67a2ab214d312295d85c.tar.gz
glibc-53850f044f65dd11efdf67a2ab214d312295d85c.tar.xz
glibc-53850f044f65dd11efdf67a2ab214d312295d85c.zip
hurd: Rework generating errno.h
We only need to give to gawk the headers that actually define error
numbers, so let's rather filter out the other included headers early.
Diffstat (limited to 'sysdeps/mach/hurd/Makefile')
-rw-r--r--sysdeps/mach/hurd/Makefile30
1 files changed, 18 insertions, 12 deletions
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 5bc682a397..029dac4bc7 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -66,26 +66,32 @@ errno.texinfo = $(..)manual/errno.texi
 
 hurd = $(..)sysdeps/mach/hurd
 
-define mach-errno-h
-($(foreach h,mach/message.h \
+mach-errno-h = \
+	     mach/message.h \
 	     mach/kern_return.h \
 	     mach/mig_errors.h \
-	     device/device_types.h,\
- echo '#include <$h>';\
- ))
-endef
+	     device/device_types.h
 
 # We use the compiler to generate a list of absolute file names for
 # the headers we want to search for Mach error codes, listed above (and
 # incidentally, all other headers those include).
 -include $(common-objpfx)errnos.d
 $(common-objpfx)errnos.d: $(mach-errnos-deps)
-	$(mach-errno-h) | \
-	$(CC) $(CFLAGS) \
-	    $(subst -include $(common-objpfx)libc-modules.h,,$(CPPFLAGS)) \
-	    -M -x c - | \
-	sed $(sed-remove-objpfx) -e 's,- *:,mach-errnos-deps :=,' \
-	    -e 's, \.\./, $(..),g' > $@t
+	echo -n "mach-errnos-deps := " > $@t
+	for h in $(mach-errno-h) ; do \
+		echo "#include <$$h>" \
+		| $(CC) $(CFLAGS) \
+		    $(subst -include $(common-objpfx)libc-modules.h,,$(CPPFLAGS)) \
+		    -M -x c - \
+		| sed $(sed-remove-objpfx) \
+		    -e 's, \.\./, $(..),g' \
+		    -e 's,\\$$,,g' \
+		    -e 's, ,\n,g' \
+		| grep "$$h$$" \
+		| tr '\n' ' ' \
+		  >> $@t ; \
+	done
+	echo >> $@t
 	mv -f $@t $@
 
 $(hurd)/bits/errno.h: $(common-objpfx)stamp-errnos ;