summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-07-22 19:58:41 +0200
committerThomas Schwinge <thomas@codesourcery.com>2012-07-22 19:58:41 +0200
commitef724a37cdb3012efb5b7233eb8b450ad91d3d69 (patch)
tree2334455220f417223cc1a75aebe76302cdffdf5a /Makerules
parent6f276c2517990f6569b961b4d4919cbce570ac45 (diff)
parent47e5dcdf349a1aea5c8997104ef785412f0d34fa (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts: configure configure.in elf/rtld.c misc/syslog.c sysdeps/gnu/configure sysdeps/gnu/configure.in sysdeps/mach/hurd/accept4.c sysdeps/mach/hurd/bits/posix_opt.h sysdeps/mach/hurd/dup3.c sysdeps/mach/hurd/i386/init-first.c sysdeps/mach/hurd/kernel-features.h sysdeps/mach/hurd/readlinkat.c
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules94
1 files changed, 36 insertions, 58 deletions
diff --git a/Makerules b/Makerules
index 612c7e5d2a..912fed08b6 100644
--- a/Makerules
+++ b/Makerules
@@ -243,7 +243,7 @@ $(common-objpfx)sysd-rules: $(common-objpfx)config.make $(..)Makerules \
/*) ;; \
*) dir="\$$(..)$$dir" ;; \
esac; \
- asm='.S .s'; \
+ asm='.S'; \
$(check-inhibit-asm) \
for o in $(all-object-suffixes); do \
set $(subst :, ,$(sysd-rules-patterns)); \
@@ -275,12 +275,6 @@ object-suffixes-left := $(all-object-suffixes)
include $(o-iterator)
define o-iterator-doit
-$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-
-define o-iterator-doit
$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
endef
object-suffixes-left := $(all-object-suffixes)
@@ -304,12 +298,6 @@ object-suffixes-left := $(all-object-suffixes)
include $(o-iterator)
define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-
-define o-iterator-doit
$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
endef
object-suffixes-left := $(all-object-suffixes)
@@ -365,24 +353,31 @@ endif # sysd-sorted-done
# Generate .dT files as we compile.
compile-mkdep-flags = -MD -MP -MF $@.dt -MT $@
compile-command.S = $(compile.S) $(OUTPUT_OPTION) $(compile-mkdep-flags)
-compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) $(compile-mkdep-flags)
compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
compile-command.cc = $(compile.cc) $(OUTPUT_OPTION) $(compile-mkdep-flags)
+# Like compile-mkdep-flags, but for use with $(BUILD_CC). We don't want to
+# track system includes here, they may spuriously trigger an install rule,
+# and would cause the check-local-headers test to fail.
+native-compile-mkdep-flags = -MMD -MP -MF $@.dt -MT $@
+
# GCC can grok options after the file name, and it looks nicer that way.
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
compile.cc = $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS)
compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) \
$(ASFLAGS) $(ASFLAGS-$(suffix $@))
+COMPILE.c = $(CC) -c $(CFLAGS) $(CPPFLAGS)
COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \
$(ASFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
# We need this for the output to go in the right place. It will default to
# empty if make was configured to work with a cc that can't grok -c and -o
# together. You can't compile the C library with such a compiler.
OUTPUT_OPTION = -o $@
+# This is the end of the pipeline for compiling generated C code.
+compile-stdin.c = $(COMPILE.c) -o $@ -x c - $(compile-mkdep-flags)
+
# We need the $(CFLAGS) to be in there to have the right predefines during
# the dependency run for C sources. But having it for assembly sources can
# get the wrong predefines.
@@ -681,6 +676,7 @@ endif
+depfiles := $(sources:.c=.d) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
+ $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
$(addsuffix .d,$(tests) $(xtests) $(test-srcs))
ifeq ($(build-programs),yes)
@@ -1153,17 +1149,16 @@ install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
endif
install: install-no-libc.a-nosubdir
-# Command to compile $< in $(objdir) using the native libraries.
+# Command to compile $< using the native libraries.
define native-compile
$(make-target-directory)
-$(patsubst %/,cd % &&,$(objpfx)) \
$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
- $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
+ $< $(OUTPUT_OPTION) $(BUILD_LDFLAGS)
endef
# We always want to use configuration definitions.
-# Note that this is only used for commands running in $(objpfx).
-ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
+ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -D_GNU_SOURCE \
+ -DIS_IN_build -include $(common-objpfx)config.h
# Support the GNU standard name for this target.
.PHONY: check
@@ -1196,51 +1191,35 @@ ifeq ($(versioning),yes)
$(OBJDUMP) --dynamic-syms $< > $@T
mv -f $@T $@
-check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
- $(..)abilist/%.abilist $(objpfx)%.symlist
+vpath %.abilist $(+sysdep_dirs)
+
+# The .PRECIOUS rule prevents the files built by an implicit rule whose
+# target pattern is %.symlist from being considered "intermediate files"
+# and automatically removed. We only want these files to be removed by
+# 'make clean', which is handled by the 'generated' variable.
+.PRECIOUS: %.symlist
+generated += $(extra-libs:=.symlist)
+
+check-abi-%: $(common-objpfx)config.make %.abilist $(objpfx)%.symlist
$(check-abi)
-check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
- $(..)abilist/%.abilist $(common-objpfx)%.symlist
+check-abi-%: $(common-objpfx)config.make %.abilist $(common-objpfx)%.symlist
$(check-abi)
define check-abi
- LC_ALL=C \
- $(AWK) -f $< -v 'config=$(check-abi-config)' \
- $(patsubst %,-v 'lastversion=%',$($*-abi-frozen)) \
- $(filter %.abilist,$^) \
- | { diff -p -U 0 - $(filter %.symlist,$^) $(check-abi-warn) ; }
+ diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^)
endef
-ifeq ($(enable-check-abi),warn)
-check-abi-warn = || echo '*** WARNING: $*.so failed ABI check'
-endif
-
-ifeq ($(firstword $(sysd-sorted-done) f)$(firstword $(generating) f),tf)
-config-tls := thread
-check-abi-config := \
- $(config-machine)-$(config-vendor)-$(config-os)/$(config-tls)
-endif
-update-abi-%: $(..)scripts/merge-abilist.awk $(..)abilist/%.abilist \
- $(objpfx)%.symlist
+update-abi-%: $(objpfx)%.symlist %.abilist
$(update-abi)
-update-abi-%: $(..)scripts/merge-abilist.awk $(..)abilist/%.abilist \
- $(common-objpfx)%.symlist
+update-abi-%: $(common-objpfx)%.symlist %.abilist
$(update-abi)
-ifndef update-abi-config
define update-abi
- @echo 'Run $(MAKE) $@ update-abi-config=REGEXP'; exit 2
-endef
-else
-define update-abi
-LC_ALL=C $(AWK) -v config='$(update-abi-config)' -f $^ \
- > $(..)abilist/$*.abilist.new
-@if cmp -s $(..)abilist/$*.abilist.new $(..)abilist/$*.abilist 2> /dev/null; \
- then rm -f $(..)abilist/$*.abilist.new; \
- echo '+++ $(..)abilist/$*.abilist is unchanged'; \
- else mv -f $(..)abilist/$*.abilist.new $(..)abilist/$*.abilist; \
- echo '*** Now check $*.abilist changes for correctness ***'; \
+@if cmp -s $^ 2> /dev/null; \
+ then \
+ echo '+++ $(filter %.abilist,$^) is unchanged'; \
+ else cp -f $^; \
+ echo '*** Now check $(filter %.abilist,$^) changes for correctness ***'; \
fi
endef
-endif
.PHONY: update-abi check-abi
update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned))
@@ -1260,12 +1239,10 @@ common-generated += libc.symlist
endif
ifeq ($(build-shared),yes)
-ifneq ($(enable-check-abi),no)
ifdef subdir
tests: check-abi
endif
endif
-endif
endif
@@ -1285,7 +1262,7 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
echo '#define _LIBC 1'; \
echo '#include "$(..)misc/sys/uio.h"'; } | \
$(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \
- $(+includes) -xc - -o $(@:st=hT)
+ $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
$(@:st=dT) > $(@:st=dt)
mv -f $(@:st=dt) $(@:st=d)
@@ -1369,6 +1346,7 @@ common-clean: common-mostlyclean
-rm -f $(objpfx)*.d $(objpfx)*.dt
-rm -fr $(addprefix $(objpfx),$(generated-dirs))
-rm -f $(addprefix $(common-objpfx),$(common-generated))
+ -rm -f $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
# Produce a file `stubs' which contains `#define __stub_FUNCTION'
# for each function which is a stub. We grovel over all the .d files