From aad08dbad983a352492542a61478074e5869dec6 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 27 Dec 2002 23:05:53 +0000 Subject: 2002-12-27 Roland McGrath * 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)). --- Makerules | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Makerules') diff --git a/Makerules b/Makerules index df56d7a3ed..7e31ef7fba 100644 --- a/Makerules +++ b/Makerules @@ -663,7 +663,8 @@ ifeq ($(build-programs),yes) endif +depfiles := $(addprefix $(objpfx),\ $(filter-out $(addsuffix .d,$(omit-deps)),\ - $(+depfiles))) + $(+depfiles))) \ + $(addprefix $(common-objpfx),$(gen-as-const-headers:.sym=.h.d)) ifdef +depfiles ifneq ($(no_deps),t) @@ -1177,6 +1178,23 @@ common-generated += libc.symlist 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 TAGS: $(objpfx)distinfo $(..)MakeTAGS -- cgit v1.2.3