]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - Makerules
hurd: Fix build
[thirdparty/glibc.git] / Makerules
index 07bfe8abcb28d4fb0af7110f55231d5c7d232cb6..83bdd3a44d0d42db6634b91f26bc1d126aa43c3f 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2018 Free Software Foundation, Inc.
+# Copyright (C) 1991-2019 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -232,42 +232,26 @@ ifdef gen-py-const-headers
 py-const-files := $(patsubst %.pysym,%.py,$(gen-py-const-headers))
 py-const-dir := $(objpfx)
 py-const := $(addprefix $(py-const-dir),$(py-const-files))
-py-const-script := $(..)scripts/gen-py-const.awk
+py-const-script := $(..)scripts/gen-as-const.py
 
-# This is a hack we use to generate .py files with constants for Python
-# pretty printers.  It works the same way as gen-as-const.
-# See scripts/gen-py-const.awk for details on how the awk | gcc mechanism
-# works.
+# This is a hack we use to generate .py files with constants for
+# Python code.
 #
-# $@.tmp and $@.tmp2 are temporary files we use to store the partial contents
-# of the target file.  We do this instead of just writing on $@ because, if the
-# build process terminates prematurely, re-running Make wouldn't run this rule
-# since Make would see that the target file already exists (despite it being
-# incomplete).
+# $@.tmp is a temporary file we use to store the partial contents of
+# the target file.  We do this instead of just writing on $@ because,
+# if the build process terminates prematurely, re-running Make
+# wouldn't run this rule since Make would see that the target file
+# already exists (despite it being incomplete).
 #
-# The sed line replaces "@name@SOME_NAME@value@SOME_VALUE@" strings from the
-# output of 'gcc -S' with "SOME_NAME = SOME_VALUE" strings.
-# The '-n' option, combined with the '/p' command, makes sed output only the
-# modified lines instead of the whole input file.  The output is redirected
-# to a .py file; we'll import it in the pretty printers file to read
-# the constants generated by gen-py-const.awk.
-# The regex has two capturing groups, for SOME_NAME and SOME_VALUE
-# respectively.  Notice SOME_VALUE may be prepended by a special character,
-# depending on the assembly syntax (e.g. immediates are prefixed by a '$'
-# in AT&T x86, and by a '#' in ARM).  We discard it using a complemented set
-# before the second capturing group.
+# The output is redirected to a .py file; we'll import it in the main
+# Python code to read the constants generated by gen-as-const.py.
 $(py-const): $(py-const-dir)%.py: %.pysym $(py-const-script) \
             $(common-before-compile)
        $(make-target-directory)
-       $(AWK) -f $(py-const-script) $< \
-              | $(CC) -S -o $@.tmp $(CFLAGS) $(CPPFLAGS) -x c -
-       echo '# GENERATED FILE\n' > $@.tmp2
-       echo '# Constant definitions for pretty printers.' >> $@.tmp2
-       echo '# See gen-py-const.awk for details.\n' >> $@.tmp2
-       sed -n -r 's/^.*@name@([^@]+)@value@[^[:xdigit:]Xx-]*([[:xdigit:]Xx-]+)@.*/\1 = \2/p' \
-           $@.tmp >> $@.tmp2
-       mv -f $@.tmp2 $@
-       rm -f $@.tmp
+       $(PYTHON) $(py-const-script) --python \
+                 --cc="$(CC) $(CFLAGS) $(CPPFLAGS)" $< \
+                 > $@.tmp
+       mv -f $@.tmp $@
 
 generated += $(py-const)
 endif  # gen-py-const-headers
@@ -282,15 +266,12 @@ ifdef gen-as-const-headers
 # may include <tcb-offsets.h>.  Target header files can check if
 # GEN_AS_CONST_HEADERS is defined to avoid circular dependency which
 # may lead to build hang on a many-core machine.
-$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
+$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.py \
                                           %.sym $(common-before-compile)
-       $(AWK) -f $< $(filter %.sym,$^) \
-       | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) \
-               -DGEN_AS_CONST_HEADERS -x c - \
-               -MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)'
-       sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' \
-               $(@:.h.d=.h)T3 > $(@:.h.d=.h)T
-       rm -f $(@:.h.d=.h)T3
+       $(PYTHON) $< --cc="$(CC) $(CFLAGS) $(CPPFLAGS) -DGEN_AS_CONST_HEADERS \
+                          -MD -MP -MF $(@:.h=.h.d)T \
+                          -MT '$(@:.h=.h.d) $(@:.h.d=.h)'" \
+                 $(filter %.sym,$^) > $(@:.h.d=.h)T
        sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
            $(@:.h=.h.d)T > $(@:.h=.h.d)T2
        rm -f $(@:.h=.h.d)T
@@ -301,11 +282,10 @@ before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
 
 tests-internal += $(gen-as-const-headers:%.sym=test-as-const-%)
 generated += $(gen-as-const-headers:%.sym=test-as-const-%.c)
-$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \
+$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.py $(..)Makerules \
                            %.sym $(common-objpfx)%.h
        ($(AWK) '{ sub(/^/, "asconst_", $$2); print; }' $(filter %.h,$^); \
-        $(AWK) -v test=1 -f $< $(filter %.sym,$^); \
-        echo '#include "$(..)test-skeleton.c"') > $@T
+        $(PYTHON) $< --test $(filter %.sym,$^)) > $@T
        mv -f $@T $@
 endif
 \f
@@ -1348,14 +1328,6 @@ ifeq ($(build-shared),yes)
        LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
        mv -f $@T $@
 
-# A sysdeps/.../Makefile can set abilist-pattern to something like
-# %-foo.abilist to look for libc-foo.abilist instead of libc.abilist.
-# This makes sense if multiple ABIs can be most cleanly supported by a
-# configuration without using separate sysdeps directories for each.
-ifdef abilist-pattern
-vpath $(abilist-pattern) $(+sysdep_dirs)
-endif
-
 vpath %.abilist $(+sysdep_dirs)
 
 # The .PRECIOUS rule prevents the files built by an implicit rule whose
@@ -1365,16 +1337,6 @@ vpath %.abilist $(+sysdep_dirs)
 .PRECIOUS: %.symlist
 generated += $(extra-libs:=.symlist)
 
-ifdef abilist-pattern
-$(objpfx)check-abi-%.out: $(common-objpfx)config.make $(abilist-pattern) \
-                         $(objpfx)%.symlist
-       $(check-abi-pattern); \
-       $(evaluate-test)
-$(objpfx)check-abi-%.out: $(common-objpfx)config.make $(abilist-pattern) \
-                         $(common-objpfx)%.symlist
-       $(check-abi-pattern); \
-       $(evaluate-test)
-endif
 $(objpfx)check-abi-%.out: $(common-objpfx)config.make %.abilist \
                          $(objpfx)%.symlist
        $(check-abi); \
@@ -1383,32 +1345,14 @@ $(objpfx)check-abi-%.out: $(common-objpfx)config.make %.abilist \
                          $(common-objpfx)%.symlist
        $(check-abi); \
        $(evaluate-test)
-define check-abi-pattern
-       diff -p -U 0 $(filter $(abilist-pattern),$^) $(filter %.symlist,$^) \
-            > $@
-endef
 define check-abi
        diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^) > $@
 endef
 
-ifdef abilist-pattern
-update-abi-%: $(objpfx)%.symlist $(abilist-pattern)
-       $(update-abi-pattern)
-update-abi-%: $(common-objpfx)%.symlist $(abilist-pattern)
-       $(update-abi-pattern)
-endif
 update-abi-%: $(objpfx)%.symlist %.abilist
        $(update-abi)
 update-abi-%: $(common-objpfx)%.symlist %.abilist
        $(update-abi)
-define update-abi-pattern
-@if cmp -s $^ 2> /dev/null; \
- then \
-      echo '+++ $(filter $(abilist-pattern),$^) is unchanged'; \
- else cp -f $^; \
-      echo '*** Now check $(filter $(abilist-pattern),$^) changes for correctness ***'; \
- fi
-endef
 define update-abi
 @if cmp -s $^ 2> /dev/null; \
  then \
@@ -1418,26 +1362,13 @@ define update-abi
  fi
 endef
 
-# Patch all .abilist files for one DSO.  The find command locates
-# abilist files for all architectures.  The regular expression in the
-# find invocation is needed to separate libc.abilist and
-# libcrypt.abilist, for example.  It assumes that abilist-pattern, if
-# set, is of the form "%-SUFFIX", and not "%SUFFIX", that is, there is
-# a non-alphanumeric seperator between the pattern and the suffix
-# added.  The abilist files in /generic/ are filtered out because
-# these are expected to remain empty.
+# Patch all .abilist files for one DSO.  The find command locates abilist
+# files for all architectures.  The abilist files in /generic/ are
+# filtered out because these are expected to remain empty.
 define update-all-abi
 $(SHELL) $(..)scripts/update-abilist.sh $^ \
-  $$(find $(..)sysdeps \
-    -regextype posix-egrep -regex '.*/$*([^a-z0-9].*)?\.abilist$$' \
-    \! -regex '.*/generic/.*')
+  $$(find $(..)sysdeps -name '$*.abilist' \! -path '*/generic/*')
 endef
-ifdef abilist-pattern
-update-all-abi-%: $(abilist-pattern) $(objpfx)%.symlist
-       $(update-all-abi)
-update-all-abi-%: $(abilist-pattern) $(common-objpfx)%.symlist
-       $(update-all-abi)
-endif
 update-all-abi-%: %.abilist $(objpfx)%.symlist
        $(update-all-abi)
 update-all-abi-%: %.abilist $(common-objpfx)%.symlist