mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
2002-12-27 Roland McGrath <roland@redhat.com>
* scripts/gen-as-const.awk: New file. * Makefile (distribute): Add it. * Makerules ($(common-objpfx)%.h %.h.d: %.sym): New pattern rule. (before-compile): Add $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) to the list. (+depfiles): Add $(addprefix $(common-objpfx),$(gen-as-const-headers)).
This commit is contained in:
2
Makefile
2
Makefile
@ -280,7 +280,7 @@ distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
|
|||||||
test-installation.pl gen-FAQ.pl versions.awk\
|
test-installation.pl gen-FAQ.pl versions.awk\
|
||||||
gen-sorted.awk abi-versions.awk abilist.awk \
|
gen-sorted.awk abi-versions.awk abilist.awk \
|
||||||
firstversions.awk documented.sh cpp \
|
firstversions.awk documented.sh cpp \
|
||||||
output-format.sed)
|
output-format.sed gen-as-const.awk)
|
||||||
|
|
||||||
distribute := $(strip $(distribute))
|
distribute := $(strip $(distribute))
|
||||||
generated := $(generated) stubs.h
|
generated := $(generated) stubs.h
|
||||||
|
20
Makerules
20
Makerules
@ -663,7 +663,8 @@ ifeq ($(build-programs),yes)
|
|||||||
endif
|
endif
|
||||||
+depfiles := $(addprefix $(objpfx),\
|
+depfiles := $(addprefix $(objpfx),\
|
||||||
$(filter-out $(addsuffix .d,$(omit-deps)),\
|
$(filter-out $(addsuffix .d,$(omit-deps)),\
|
||||||
$(+depfiles)))
|
$(+depfiles))) \
|
||||||
|
$(addprefix $(common-objpfx),$(gen-as-const-headers:.sym=.h.d))
|
||||||
|
|
||||||
ifdef +depfiles
|
ifdef +depfiles
|
||||||
ifneq ($(no_deps),t)
|
ifneq ($(no_deps),t)
|
||||||
@ -1177,6 +1178,23 @@ common-generated += libc.symlist
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Generating headers for assembly constants.
|
||||||
|
$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk %.sym
|
||||||
|
$(AWK) -f $^ \
|
||||||
|
| $(CC) -S -o - $(CFLAGS) $(CPPFLAGS) -x c - \
|
||||||
|
-MD -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-]*\).*@@@end@@@.*$$/#define \1 \2/p' > $(@:.h.d=.h)T
|
||||||
|
sed $(sed-remove-objpfx) \
|
||||||
|
-e 's@ *\([^ \/][^ \]*\)@ $$(..)\1@g' \
|
||||||
|
-e 's@ *\.\.\/\([^ \]*\)@ $$(..)\1@g' \
|
||||||
|
$(@:.h=.h.d)T > $(@:.h=.h.d)T2
|
||||||
|
rm -f $(@:.h=.h.d)T
|
||||||
|
mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d)
|
||||||
|
mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
|
||||||
|
vpath %.sym $(sysdirs)
|
||||||
|
|
||||||
|
before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
|
||||||
|
|
||||||
.PHONY: TAGS
|
.PHONY: TAGS
|
||||||
TAGS: $(objpfx)distinfo $(..)MakeTAGS
|
TAGS: $(objpfx)distinfo $(..)MakeTAGS
|
||||||
|
29
scripts/gen-as-const.awk
Normal file
29
scripts/gen-as-const.awk
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Script used in producing headers of assembly constants from C expressions.
|
||||||
|
# The input to this script looks like:
|
||||||
|
# #cpp-directive ...
|
||||||
|
# NAME1
|
||||||
|
# NAME2 expression ...
|
||||||
|
# The output of this script is C code to be run through gcc -S and then
|
||||||
|
# massaged to extract the integer constant values of the given C expressions.
|
||||||
|
# A line giving just a name implies an expression consisting of just that name.
|
||||||
|
|
||||||
|
BEGIN { started = 0 }
|
||||||
|
|
||||||
|
# cpp directives go straight through.
|
||||||
|
/^#/ { print; next }
|
||||||
|
|
||||||
|
NF >= 1 && !started {
|
||||||
|
print "void dummy(void) {";
|
||||||
|
started = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
NF == 1 { sub(/^.*$/, "& &"); }
|
||||||
|
|
||||||
|
NF > 1 {
|
||||||
|
name = $1;
|
||||||
|
sub(/^[^ ]+[ ]+/, "");
|
||||||
|
printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
|
||||||
|
name, $0;
|
||||||
|
}
|
||||||
|
|
||||||
|
END { if (started) print "}" }
|
Reference in New Issue
Block a user