instead of += to append, to be sure $(lib) gets expanded at defn time.
(libof-$(cpp-src)): New variable, define this instead.
* extra-lib.mk (cpp-srcs-left): Reduce duplication in include setup.
(lib): Don't use override.
(CPPFLAGS-$(lib)): New variable, put -D's here.
* Makeconfig (CPPFLAGS): Use basename fn for CPPFLAGS-basename.
Also add $(CPPFLAGS-LIB) before the file-specific flags, for each
LIB found by $(libof-*) for basename, target, or source.
* Makerules (CPPFLAGS-nonlib): New variable.
* nscd/Makefile (lib): Set to nonlib when using cppflags-iterator.mk.
* locale/Makefile (lib): Likewise.
* sunrpc/Makefile (lib): Likewise.
* sysdeps/unix/sysv/linux/fpathconf.c (LINUX_LINK_MAX): Move macro ...
* sysdeps/unix/sysv/linux/linux_fsinfo.h (LINUX_LINK_MAX): ... here.
* sysdeps/unix/sysv/linux/pathconf.h: New file.
(statfs_link_max): New function, guts from fpathconf.c.
* sysdeps/unix/sysv/linux/fpathconf.c: Rewritten using that.
* sysdeps/unix/sysv/linux/pathconf.c (__pathconf): Likewise.
* sysdeps/unix/sysv/linux/alpha/pathconf.c (__pathconf): Rewritten
to use the linux/pathconf.c code by #include rather than duplication.
* sysdeps/unix/sysv/linux/alpha/fpathconf.c (__pathconf): Likewise.
2002-10-16 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
Use __libc_errno only for libc itself.
+2002-10-16 Roland McGrath <roland@redhat.com>
+
+ * cppflags-iterator.mk (CPPFLAGS-$(cpp-src)): Variable removed.
+ instead of += to append, to be sure $(lib) gets expanded at defn time.
+ (libof-$(cpp-src)): New variable, define this instead.
+ * extra-lib.mk (cpp-srcs-left): Reduce duplication in include setup.
+ (lib): Don't use override.
+ (CPPFLAGS-$(lib)): New variable, put -D's here.
+ * Makeconfig (CPPFLAGS): Use basename fn for CPPFLAGS-basename.
+ Also add $(CPPFLAGS-LIB) before the file-specific flags, for each
+ LIB found by $(libof-*) for basename, target, or source.
+ * Makerules (CPPFLAGS-nonlib): New variable.
+ * nscd/Makefile (lib): Set to nonlib when using cppflags-iterator.mk.
+ * locale/Makefile (lib): Likewise.
+ * sunrpc/Makefile (lib): Likewise.
+
+ * sysdeps/unix/sysv/linux/fpathconf.c (LINUX_LINK_MAX): Move macro ...
+ * sysdeps/unix/sysv/linux/linux_fsinfo.h (LINUX_LINK_MAX): ... here.
+ * sysdeps/unix/sysv/linux/pathconf.h: New file.
+ (statfs_link_max): New function, guts from fpathconf.c.
+ * sysdeps/unix/sysv/linux/fpathconf.c: Rewritten using that.
+ * sysdeps/unix/sysv/linux/pathconf.c (__pathconf): Likewise.
+ * sysdeps/unix/sysv/linux/alpha/pathconf.c (__pathconf): Rewritten
+ to use the linux/pathconf.c code by #include rather than duplication.
+ * sysdeps/unix/sysv/linux/alpha/fpathconf.c (__pathconf): Likewise.
+
+2002-10-16 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
+ Use __libc_errno only for libc itself.
+
2002-10-16 Andreas Jaeger <aj@suse.de>
* sysdeps/x86_64/_mcount.S: Fix off-by-1 error in argument access.
# it causes cpp to stop predefining __ASSEMBLER__.
CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
-include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
- $(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) \
- $(CPPFLAGS-$(patsubst %$(suffix $@),%,$(@F)))
+ $(CPPFLAGS-$(suffix $@)) \
+ $(foreach L,$(libof-$(basename $(@F))) $(libof-$<) $(libof-$(@F)),\
+ $(CPPFLAGS-$L)) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
override CFLAGS = -std=gnu99 \
$(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
ifneq (,$(all-nonlib))
cpp-srcs-left = $(all-nonlib:=.c)
-lib := tests
+lib := nonlib
include $(patsubst %,$(..)cppflags-iterator.mk,$(all-nonlib))
endif
+
+# The include magic above causes those files to use this variable for flags.
+CPPFLAGS-nonlib = -DNOT_IN_libc=1
\f
.PHONY: TAGS
TAGS: $(objpfx)distinfo $(..)MakeTAGS
cpp-src := $(firstword $(cpp-srcs-left))
cpp-srcs-left := $(filter-out $(cpp-src),$(cpp-srcs-left))
-CPPFLAGS-$(cpp-src) += -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
+libof-$(cpp-src) := $(lib)
# to be included in that library. A sysdep Makefile can add to
# $(lib)-sysdep_routines to include additional modules.
-override lib := $(firstword $(extra-libs-left))
+lib := $(firstword $(extra-libs-left))
extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
endif
-cpp-srcs-left = $(lib)-routines
-ifneq (,$($(lib)-routines))
-cpp-srcs-left = $($(lib)-routines)
-include $(patsubst %,$(..)cppflags-iterator.mk,$($(lib)-routines))
-endif
-ifneq (,$($(lib)-sysdep_routines))
-cpp-srcs-left = $($(lib)-sysdep_routines)
-include $(patsubst %,$(..)cppflags-iterator.mk,$($(lib)-sysdep_routines))
+# This will define `libof-ROUTINE := LIB' for each of the routines.
+cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
+ifneq (,$(cpp-srcs-left))
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
endif
+
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
# This makes sure -DNOT_IN_libc is passed for all these modules.
cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
$(locale-modules) $(lib-modules))
-lib := locale_programs
+lib := nonlib
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
# This makes sure -DNOT_IN_libc is passed for all these modules.
cpp-srcs-left := $(nscd-modules:=.c)
-lib := nscd
+lib := nonlib
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
$(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
# This makes sure -DNOT_IN_libc is passed for all these modules.
cpp-srcs-left := $(rpcgen-objs:.o=.c)
-lib := rpcgen
+lib := nonlib
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
# Tell rpcgen where to find the C preprocessor.
orq $-1, %rax; \
jmp L(pseudo_end);
#elif USE___THREAD
+# ifndef NOT_IN_libc
+# define SYSCALL_ERROR_ERRNO __libc_errno
+# else
+# define SYSCALL_ERROR_ERRNO errno
+# endif
# define SYSCALL_ERROR_HANDLER \
0: \
- movq __libc_errno@GOTTPOFF(%rip), %rcx; \
+ movq SYSCALL_ERROR_ERRNO@GOTTPOFF(%rip), %rcx;\
xorq %rdx, %rdx; \
subq %rax, %rdx; \
movl %edx, %fs:(%rcx); \