1995-02-18 09:27:10 +08:00
|
|
|
|
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
|
|
|
|
# modify it under the terms of the GNU Library General Public License as
|
|
|
|
|
# published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# Library General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU Library General Public
|
|
|
|
|
# License along with the GNU C Library; see the file COPYING.LIB. If
|
|
|
|
|
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
|
|
|
|
# Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Common rules for making the GNU C library. This file is included
|
|
|
|
|
# by the top-level Makefile and by all subdirectory makefiles
|
|
|
|
|
# (through Rules).
|
|
|
|
|
#
|
|
|
|
|
ifneq (,)
|
|
|
|
|
This makefile requires GNU Make.
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifdef subdir
|
|
|
|
|
.. := ../
|
|
|
|
|
endif # subdir
|
|
|
|
|
|
|
|
|
|
# If `sources' was defined by the parent makefile, undefine it so
|
|
|
|
|
# we will later get it from wildcard search in this directory.
|
|
|
|
|
ifneq "$(findstring env,$(origin sources))" ""
|
|
|
|
|
sources :=
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
headers := $(headers) $(sysdep_headers)
|
|
|
|
|
|
|
|
|
|
oPATH := $(PATH)
|
|
|
|
|
PATH := this definition should take precedence over $(oPATH)
|
|
|
|
|
ifeq ($(PATH),$(oPATH))
|
|
|
|
|
You must not use the -e flag when building the GNU C library.
|
|
|
|
|
else
|
|
|
|
|
PATH := $(oPATH)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifndef +included-Makeconfig
|
|
|
|
|
include $(..)Makeconfig
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# `configure' writes a definition of `config-sysdirs' in `config.make'.
|
|
|
|
|
sysdirs = $(config-sysdirs)
|
|
|
|
|
|
|
|
|
|
+sysdir_pfx = $(common-objpfx)
|
|
|
|
|
|
|
|
|
|
export sysdirs := $(sysdirs)
|
|
|
|
|
|
|
|
|
|
+sysdep_dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
|
|
|
|
|
ifdef objdir
|
|
|
|
|
+sysdep_dirs := $(objdir) $(+sysdep_dirs)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Add -I switches to get the right sysdep directories.
|
|
|
|
|
# `+includes' in Makeconfig references $(+sysdep-includes).
|
|
|
|
|
+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
|
|
|
|
|
|
|
|
|
|
# Include any system-specific makefiles.
|
|
|
|
|
|
|
|
|
|
# This is here so things in sysdep Makefiles can easily depend on foo.h as
|
|
|
|
|
# appropriate and not worry about where foo.h comes from, which may be
|
|
|
|
|
# system dependent and not known by that Makefile.
|
|
|
|
|
vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) \
|
|
|
|
|
$(addprefix $(sysdep_dir)/,$(sysdirs)) \
|
|
|
|
|
$(..)))
|
|
|
|
|
|
|
|
|
|
ifeq ($(wildcard $(+sysdir_pfx)sysd-Makefile),)
|
|
|
|
|
# Don't do deps until this exists, because it might change the sources list.
|
|
|
|
|
no_deps=t
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Some sysdep makefiles use this to distinguish being included here from
|
|
|
|
|
# being included individually by a subdir makefile (hurd/Makefile needs this).
|
|
|
|
|
in-Makerules := yes
|
|
|
|
|
|
|
|
|
|
ifndef avoid-generated
|
|
|
|
|
include $(+sysdir_pfx)sysd-Makefile
|
|
|
|
|
$(+sysdir_pfx)sysd-Makefile: $(+sysdir_pfx)config.make $(..)Makerules
|
|
|
|
|
-@rm -f $@T
|
|
|
|
|
(for dir in $(sysdirs); do \
|
|
|
|
|
file=sysdeps/$$dir/Makefile; \
|
|
|
|
|
if [ -f $(..)$$file ]; then \
|
|
|
|
|
echo include "\$$(..)$$file"; \
|
|
|
|
|
else true; fi; \
|
|
|
|
|
done; \
|
|
|
|
|
echo 'sysd-Makefile-done=t') > $@T
|
|
|
|
|
mv -f $@T $@
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Reorder before-compile so that mach things come first, and hurd things
|
|
|
|
|
# second, before all else. The mach and hurd subdirectories have many
|
|
|
|
|
# generated header files which the much of rest of the library depends on,
|
|
|
|
|
# so it is best to build them first (and mach before hurd, at that).
|
|
|
|
|
before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
|
|
|
|
|
$(before-compile)) \
|
|
|
|
|
$(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
|
|
|
|
|
$(before-compile))
|
|
|
|
|
|
|
|
|
|
# Remove existing files from `before-compile'. Things are added there when
|
|
|
|
|
# they must exist for dependency generation to work right, but once they
|
|
|
|
|
# exist there is no further need for every single file to depend on them,
|
|
|
|
|
# and those gratuitous dependencies result in many gratuitous
|
|
|
|
|
# recompilations.
|
|
|
|
|
before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
|
|
|
|
|
|
|
|
|
|
# Don't let any before-compile file be an intermediate and get removed.
|
|
|
|
|
ifdef before-compile
|
|
|
|
|
$(before-compile):
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Generate an ordered list of implicit rules which find the source files in
|
|
|
|
|
# each sysdep directory. The old method was to use vpath to search all the
|
|
|
|
|
# sysdep directories. However, that had the problem that a .S file in a
|
|
|
|
|
# later directory would be chosen over a .c file in an earlier directory,
|
|
|
|
|
# which does not preserve the desired sysdeps ordering behavior.
|
|
|
|
|
|
|
|
|
|
# When making the list of .d files to include, we can't know which ones
|
|
|
|
|
# have source in .s files, and thus do not in fact need a .d file.
|
|
|
|
|
# So we must define rules to make .d files for .s files.
|
|
|
|
|
define make-dummy-dep
|
|
|
|
|
$(addprefix ln $(objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
|
|
|
|
|
endef
|
|
|
|
|
$(objpfx)dummy.d:
|
|
|
|
|
echo '# .s files cannot contain includes, so they need no deps.' > $@
|
|
|
|
|
|
|
|
|
|
# It matters that this set of rules, for compiling from sources in
|
|
|
|
|
# the current directory (the $srcdir/$subdir) come before the
|
|
|
|
|
# generated sysdep rules in included from sysd-rules below. When
|
|
|
|
|
# compiling in the source tree, generated sources go into the current
|
|
|
|
|
# directory, and those should be chosen before any sources in sysdeps.
|
|
|
|
|
$(objpfx)%.o: %.S $(before-compile); $(compile-command.S)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(objpfx)%.so: %.S $(before-compile); $(compile-command.S)
|
|
|
|
|
$(objpfx)%.po: %.S $(before-compile); $(compile-command.S)
|
|
|
|
|
$(objpfx)%.go: %.S $(before-compile); $(compile-command.S)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
|
|
|
|
|
$(objpfx)%.o: %.s $(before-compile); $(compile-command.s)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(objpfx)%.so: %.s $(before-compile); $(compile-command.s)
|
|
|
|
|
$(objpfx)%.po: %.s $(before-compile); $(compile-command.s)
|
|
|
|
|
$(objpfx)%.go: %.s $(before-compile); $(compile-command.s)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(objpfx)%.d: %.s $(objpfx)dummy.d; $(make-dummy-dep)
|
|
|
|
|
$(objpfx)%.o: %.c $(before-compile); $(compile-command.c)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(objpfx)%.so: %.c $(before-compile); $(compile-command.c)
|
|
|
|
|
$(objpfx)%.po: %.c $(before-compile); $(compile-command.c)
|
|
|
|
|
$(objpfx)%.go: %.c $(before-compile); $(compile-command.c)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
|
|
|
|
|
|
|
|
|
|
# Omit the objpfx rules when building in the source tree, because
|
|
|
|
|
# objpfx is empty and so these rules just override the ones above.
|
|
|
|
|
ifdef objpfx
|
|
|
|
|
# Define first rules to find the source files in $(objpfx).
|
|
|
|
|
# Generated source files will end up there.
|
|
|
|
|
$(objpfx)%.o: $(objpfx)%.S $(before-compile); $(compile-command.S)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(objpfx)%.so: $(objpfx)%.S $(before-compile); $(compile-command.S)
|
|
|
|
|
$(objpfx)%.po: $(objpfx)%.S $(before-compile); $(compile-command.S)
|
|
|
|
|
$(objpfx)%.go: $(objpfx)%.S $(before-compile); $(compile-command.S)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
|
|
|
|
|
$(objpfx)%.o: $(objpfx)%.s $(before-compile); $(compile-command.s)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(objpfx)%.so: $(objpfx)%.s $(before-compile); $(compile-command.s)
|
|
|
|
|
$(objpfx)%.po: $(objpfx)%.s $(before-compile); $(compile-command.s)
|
|
|
|
|
$(objpfx)%.go: $(objpfx)%.s $(before-compile); $(compile-command.s)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(objpfx)%.d: $(objpfx)%.s $(objpfx)dummy.d; $(make-dummy-dep)
|
|
|
|
|
$(objpfx)%.o: $(objpfx)%.c $(before-compile); $(compile-command.c)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(objpfx)%.so: $(objpfx)%.c $(before-compile); $(compile-command.c)
|
|
|
|
|
$(objpfx)%.po: $(objpfx)%.c $(before-compile); $(compile-command.c)
|
|
|
|
|
$(objpfx)%.go: $(objpfx)%.c $(before-compile); $(compile-command.c)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
|
|
|
|
|
# patterns matching sysdep directories whose assembly source files should
|
|
|
|
|
# be suppressed.
|
|
|
|
|
ifdef inhibit-sysdep-asm
|
|
|
|
|
define open-check-inhibit-asm
|
|
|
|
|
case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
|
|
|
|
|
endef
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
close-check-inhibit-asm = ;; esac ;
|
1995-02-18 09:27:10 +08:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Don't include sysd-rules until sysd-Makefile is already there and has been
|
|
|
|
|
# included. It might define inhibit-sysdep-asm, which would affect the
|
|
|
|
|
# contents of sysd-rules.
|
|
|
|
|
ifdef sysd-Makefile-done
|
|
|
|
|
include $(+sysdir_pfx)sysd-rules
|
|
|
|
|
endif
|
|
|
|
|
$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
|
|
|
|
|
$(wildcard $(foreach dir,$(sysdirs),\
|
|
|
|
|
$(sysdep_dir)/$(dir)/Makefile))
|
|
|
|
|
-@rm -f $@T
|
|
|
|
|
(for sysdir in $(sysdirs); do \
|
|
|
|
|
dir="\$$(sysdep_dir)/$$sysdir"; \
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
for o in $(object-suffixes); do \
|
|
|
|
|
$(open-check-inhibit-asm) \
|
|
|
|
|
echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
|
|
|
|
|
\$$(compile-command.S)"; \
|
|
|
|
|
echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
|
|
|
|
|
\$$(compile-command.s)"; \
|
|
|
|
|
$(close-check-inhibit-asm) \
|
|
|
|
|
echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
|
|
|
|
|
\$$(compile-command.c)"; \
|
|
|
|
|
done; \
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(open-check-inhibit-asm) \
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
echo "\$$(objpfx)%.d: $$dir/%.s \$$(objpfx)dummy.d; \
|
|
|
|
|
\$$(make-dummy-dep)"; \
|
1995-02-18 09:27:10 +08:00
|
|
|
|
echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
|
|
|
|
|
\$$(+make-deps)"; \
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(close-check-inhibit-asm) \
|
1995-02-18 09:27:10 +08:00
|
|
|
|
echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
|
|
|
|
|
\$$(+make-deps)"; \
|
|
|
|
|
done) > $@T
|
|
|
|
|
mv -f $@T $@
|
|
|
|
|
|
|
|
|
|
ifndef compile-command.S
|
|
|
|
|
compile-command.S = $(compile.S) $(OUTPUT_OPTION)
|
|
|
|
|
endif
|
|
|
|
|
ifndef compile-command.s
|
|
|
|
|
compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
|
|
|
|
|
endif
|
|
|
|
|
ifndef compile-command.c
|
|
|
|
|
compile-command.c = $(compile.c) $(OUTPUT_OPTION)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# GCC can grok options after the file name, and it looks nicer that way.
|
|
|
|
|
compile.S = $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS)
|
|
|
|
|
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
|
|
|
|
|
|
|
|
|
|
# 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 $@
|
|
|
|
|
|
|
|
|
|
S-CPPFLAGS = $(asm-CPPFLAGS)
|
|
|
|
|
define +make-deps
|
|
|
|
|
-@rm -f $@
|
|
|
|
|
$(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
sed -e 's,$*\.o,$(foreach o,$(object-suffixes),$(@:.d=$o)) $@,' \
|
|
|
|
|
$(sed-remove-objpfx) > $(@:.d=.T)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
mv -f $(@:.d=.T) $@
|
|
|
|
|
endef
|
|
|
|
|
ifneq (,$(objpfx))
|
|
|
|
|
sed-remove-objpfx = -e 's@ $(subst @,\@,$(objpfx))@ $$(objpfx)@g' \
|
|
|
|
|
-e 's@^$(subst @,\@,$(objpfx))@$$(objpfx)@g'
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Figure out the source filenames in this directory.
|
|
|
|
|
|
|
|
|
|
override sources := $(addsuffix .c,$(filter-out $(elided-routines),\
|
|
|
|
|
$(routines) $(aux) \
|
|
|
|
|
$(sysdep_routines)))
|
|
|
|
|
sysdep_routines := $(sysdep_routines)
|
|
|
|
|
|
|
|
|
|
# This is the list of all object files, gotten by
|
|
|
|
|
# replacing every ".c" in `sources' with a ".o".
|
|
|
|
|
override objects := $(addprefix $(objpfx),$(sources:.c=.o))
|
1995-03-18 02:42:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This variable is used in ``include $(o-iterator)'' after defining
|
|
|
|
|
# $(o-iterator-doit) to produce some desired rule using $o for the object
|
|
|
|
|
# suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy
|
|
|
|
|
# is produced for each object suffix in use.
|
|
|
|
|
o-iterator = $(patsubst %,$(..)o-iterator.mk,$(object-suffixes))
|
|
|
|
|
|
|
|
|
|
# The makefile may define $(extra-libs) with `libfoo libbar'
|
|
|
|
|
# to build libfoo.a et al from the modules listed in $(libfoo-routines).
|
|
|
|
|
ifdef extra-libs
|
|
|
|
|
# extra-lib.mk is included once for each extra lib to define rules
|
|
|
|
|
# to build it, and to add its objects to the various variables.
|
|
|
|
|
# During its evaluation, $(lib) is set to the name of the library.
|
|
|
|
|
extra-libs-left := $(extra-libs)
|
|
|
|
|
include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
|
|
|
|
|
endif
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
+depfiles := $(strip $(sources:.c=.d) \
|
|
|
|
|
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs))) \
|
|
|
|
|
$(addsuffix .d,$(others) $(tests)))
|
|
|
|
|
+depfiles := $(addprefix $(objpfx),\
|
|
|
|
|
$(filter-out $(addsuffix .d,$(omit-deps)),\
|
|
|
|
|
$(+depfiles)))
|
|
|
|
|
|
|
|
|
|
$(objpfx)depend-$(subdir): Makefile
|
|
|
|
|
ifdef +depfiles
|
|
|
|
|
for file in $(+depfiles:$(objpfx)%=%); do \
|
|
|
|
|
echo "include \$$(objpfx)$$file"; \
|
|
|
|
|
done > $@-tmp
|
|
|
|
|
mv -f $@-tmp $@
|
|
|
|
|
else
|
|
|
|
|
cp /dev/null $@
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifneq ($(no_deps),t)
|
|
|
|
|
# Include the generated dependencies of the sources in this directory.
|
|
|
|
|
include $(objpfx)depend-$(subdir)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Maximize efficiency by minimizing the number of rules.
|
|
|
|
|
.SUFFIXES: # Clear the suffix list.
|
|
|
|
|
# Add the suffixes we use.
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
.SUFFIXES: .a $(object-suffixes) .S .s .c .h .d
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
# Generic rule for making directories.
|
|
|
|
|
%/:
|
|
|
|
|
# mkdir isn't smart enough to strip a trailing /.
|
|
|
|
|
mkdir $(@:%/=%)
|
|
|
|
|
|
|
|
|
|
# Make sure that object files are not removed
|
|
|
|
|
# when they are intermediates between sources and library members.
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
.PRECIOUS: $(addprefix $(objpfx)%,$(object-suffixes))
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
# Make sure that the parent library archive is never removed.
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
# Use the verbose option of ar and tar when not running silently.
|
|
|
|
|
ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
|
|
|
|
|
verbose := v
|
|
|
|
|
else # -s
|
|
|
|
|
verbose :=
|
|
|
|
|
endif # not -s
|
|
|
|
|
|
|
|
|
|
ARFLAGS := r$(verbose)
|
|
|
|
|
|
|
|
|
|
# This makes all the object files in the parent library archive.
|
|
|
|
|
|
|
|
|
|
.PHONY: lib libobjs lib-noranlib
|
1995-03-21 12:19:38 +08:00
|
|
|
|
lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
|
|
|
|
|
# Pattern rule for libraries: depend on the __.SYMDEF member updated by ranlib.
|
|
|
|
|
lib%.a: lib%.a(__.SYMDEF) ;
|
|
|
|
|
|
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
|
# Pattern rule to build a shared object from an archive of PIC objects.
|
|
|
|
|
# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
|
|
|
|
|
# on other shared objects.
|
|
|
|
|
lib%.so: lib%_pic.a
|
1995-04-01 17:07:31 +08:00
|
|
|
|
$(LINK.o) -shared -o $@ -Wl,--whole-archive $< \
|
|
|
|
|
-L$(firstword $(objdir) .) -L$(common-objpfx:%/=%) \
|
1995-04-03 06:08:59 +08:00
|
|
|
|
$(LDLIBS-$(notdir $*).so)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
endif
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
libobjs: $(foreach o,$(object-suffixes),\
|
|
|
|
|
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
|
|
|
|
|
$(notdir $(objects:.o=$o))))
|
1995-03-21 12:19:38 +08:00
|
|
|
|
lib-noranlib: libobjs $(addprefix $(objpfx),$(install-lib))
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
ifdef objects
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
|
|
|
|
|
# Define a pattern rule that will match many targets libc.a(foo.%), for
|
|
|
|
|
# each foo.o in $(objects) (% will just happen always to match `o'). This is
|
|
|
|
|
# the only way to define a rule that updates many targets at once with one
|
|
|
|
|
# sequence of commands. We in fact define the pattern rule to match
|
|
|
|
|
# targets libc.a(foo.%), libc_pic.a(foo.%), etc, to avoid repeating the rule.
|
|
|
|
|
# Each match will only ever be called upon to make member objects of
|
|
|
|
|
# the appropriate type in each library (i.e. libc_pic.a(foo.so)).
|
|
|
|
|
$(foreach l,$(libtypes),\
|
|
|
|
|
$(common-objpfx)$(patsubst %,$l,c)($(notdir $(objects:.o=.%)))): \
|
|
|
|
|
$(objpfx)stamp.%-$(subdir) ;
|
|
|
|
|
|
|
|
|
|
# The pattern rule tells Make to remake $(objpfx)stamp.%-$(subdir) as
|
|
|
|
|
# the way to update all the foo.% object files in $(objects).
|
|
|
|
|
# Now we define a static pattern rule to update each
|
|
|
|
|
# $(objpfx)stamp.SUFFIX-$(subdir) timestamp file;
|
|
|
|
|
# these rules (one explicit rule is generated for each object suffix)
|
|
|
|
|
# will update the parent archive with
|
|
|
|
|
$(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir)): \
|
|
|
|
|
$(objpfx)stamp%-$(subdir): $(objects:.o=%)
|
|
|
|
|
$(patsubst %,cd %;,$(objdir)) \
|
|
|
|
|
$(AR) cru$(verbose) ${O%-lib} \
|
|
|
|
|
$(patsubst $(objpfx)%,%,$^)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
touch $@
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
O%-lib = $(filter ../,$(firstword $(objdir) ../))$(patsubst %,$(libtype$*),c)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
endif
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
# Rules to update the __.SYMDEF member with ranlib.
|
|
|
|
|
# To consolidate, each flavor library's __.SYMDEF member
|
|
|
|
|
# depends on the imaginary intermediate file `symdef.SUFFIX',
|
|
|
|
|
# where SUFFIX is that flavor's object suffix; then a pattern rule
|
|
|
|
|
# "remakes" symdef.% depending on all the libc.a(foo.%) files in $(objects).
|
|
|
|
|
$(common-objpfx)$(patsubst %,$(libtype.o),c)(__.SYMDEF): symdef.o
|
|
|
|
|
$(common-objpfx)$(patsubst %,$(libtype.so),c)(__.SYMDEF): symdef.so
|
|
|
|
|
$(common-objpfx)$(patsubst %,$(libtype.po),c)(__.SYMDEF): symdef.po
|
|
|
|
|
$(common-objpfx)$(patsubst %,$(libtype.go),c)(__.SYMDEF): symdef.go
|
|
|
|
|
symdef.%: $(foreach o,$(object-suffixes),\
|
|
|
|
|
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
|
|
|
|
|
$(patsubst $(objpfx)%.o,%.%,$(objects)))) \
|
|
|
|
|
$(filter subdir_lib,$(firstword $(subdir) subdir_lib))
|
|
|
|
|
# The last line above makes it also depend on subdir_lib for the parent.
|
|
|
|
|
$(RANLIB) $(common-objpfx)$(patsubst %,$(libtype.$*),c)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
# This makes all the object files.
|
|
|
|
|
.PHONY: objects objs
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
objects objs: $(foreach o,$(object-suffixes),$(objects:.o=$o)) \
|
|
|
|
|
$(addprefix $(objpfx),$(extra-objs))
|
Thu Mar 16 00:04:41 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/C-ctype.c: New correct data generated by drepper.
* Rules: Don't use $(libc.a).
Parsing of grouped numbers contributed by Ulrich Drepper.
* stdlib/strtol.c (__strtol_internal): Renamed from strtol. Take
new flag arg; if nonzero, parse locale-dependent thousands
grouping and interpret only the prefix that is correctly grouped.
(strtol): Define this to call _strtol_internal with zero for the flag.
Use a weak symbol for the definition.
* stdlib/strtod.c (strtod, __strtod_internal): Likewise.
Check for the exponent of the number overflowing the float format.
* stdlib/stdlib.h (__strtof, __strtold): Declarations removed.
(__strto{f,d,ld,l,ul,q,uq}_internal): Declare these functions.
[__OPTIMIZE__]: Define inline functions calling those.
* stdlib/grouping.h: New file, written by drepper.
* stdlib/Makefile (distribute): Add grouping.h.
* stdio/vfscanf.c: Grok %' modifier to numeric conversions. Call
__strtoX_internal with the grouping flag set iff the modifier is
present.
Wed Mar 15 00:40:54 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/generic/memchr.c: Fix typos: limit.h -> limits.h.
* mach/Machrules: Produce static deps for all object flavors.
[interface-library]: Remove all these variables and rules.
($(interface-library)-routines): Define this variable.
(extra-libs): Append $(interface-library) to this.
* mach/Makefile (interface-library): Omit .a suffix.
* hurd/Makefile: Likewise.
Tue Mar 14 23:40:31 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* stdio/internals.c (flushbuf): If !FLUSH_ONLY, don't skip out
early if no new data in buffer after priming.
* Makerules (object-suffixes, libtypes): Move all these variables
to Makeconfig.
* Makeconfig (object-suffixes, libtypes): Moved here from Makerules.
* Makerules (build-extra-lib): New canned sequence.
* sysdeps/mach/hurd/euidaccess.c: Include fcntl.h. Declare ERR;
fix uses of FILE and PORT. Remove bogus weak alias for `access'.
* sysdeps/mach/hurd/dirfd.c: Include hurd/fd.h and errno.h.
Add missing semicolon.
* sysdeps/mach/hurd/opendir.c: Include hurd/fd.h. Use a `struct
hurd_fd *' temp var, since DIRP->__fd is a `void *'.
* sysdeps/mach/hurd/readdir.c: Include hurd/fd.h.
* stdlib/wcstombs.c: #if 0 out code for non-ASCII chars until the
locale data format is implemented.
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
Pass &__sigreturn on the stack to the trampoline code, so it is
not position-dependent.
* stdio/printf_fp.c (NDEBUG): Define this to disable assert.
Don't include <stdarg.h>.
(__printf_fp): Last arg ARGS is now `const void **const';
dereference ARGS[0] instead of using va_arg.
* locale/setlocale.c: In LC_ALL case, initialize CATEGORY before
loop to install data.
* locale/loadlocale.c (_nl_category_num_items): Use _NL_ITEM_INDEX
to extract number from item code.
(_nl_load_locale): Close the descriptor when finished.
* malloc/realloc.c (_realloc_internal): Call _malloc_internal in
place of malloc.
* time/tzfile.c (__tzfile_default): Initialize RULE_STDOFF to zero.
1995-03-16 13:32:45 +08:00
|
|
|
|
|
|
|
|
|
# Canned sequence for building an extra library archive.
|
|
|
|
|
define build-extra-lib
|
|
|
|
|
$(patsubst %,cd %;,$(objdir)) \
|
|
|
|
|
$(AR) cru$(verbose) $(@:$(objpfx)%=%) \
|
|
|
|
|
$(patsubst $(objpfx)%,%,$^)
|
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
endef
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
# Installation.
|
|
|
|
|
|
|
|
|
|
# $(install-lib) are installed from the object directory into $(libdir);
|
|
|
|
|
# files in $(install-lib) matching `lib%.a' are ranlib'd after installation
|
|
|
|
|
# unless they also appear in $(non-lib.a). $(install-data) are installed
|
|
|
|
|
# as they are into $(datadir). $(headers) are installed as they are in
|
|
|
|
|
# $(includedir). $(install-bin) and $(install-sbin) are installed from the
|
|
|
|
|
# object directory into $(bindir) and $(sbindir), respectively.
|
|
|
|
|
# $(install-others) are absolute path names of files to install; rules to
|
|
|
|
|
# install them are defined elsewhere.
|
|
|
|
|
|
|
|
|
|
# The simple library name to install libc.a under.
|
|
|
|
|
# This could be defined by a sysdep Makefile.
|
|
|
|
|
ifndef libc-name
|
|
|
|
|
libc-name := c
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
define do-install
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
$(INSTALL_DATA) $< $@
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# Make the target directory if it doesn't exist. Because of make's
|
|
|
|
|
# directory cache, this will produce the `mkdir' command when the directory
|
|
|
|
|
# already exists, if it didn't exist at the start of the `make' run. The
|
|
|
|
|
# `-' prefix ignores errors from mkdir, so there will just be some
|
|
|
|
|
# gratuitous but harmless `File exists' messages.
|
|
|
|
|
define make-target-directory
|
|
|
|
|
$(addprefix -mkdir ,$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# Any directory (parent or subdir) that has any object files to build
|
|
|
|
|
# should install libc.a; this way "make install" in a subdir is guaranteed
|
|
|
|
|
# to install everything it changes.
|
|
|
|
|
ifdef objects
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
installed-libcs := $(foreach o,$(object-suffixes),\
|
|
|
|
|
$(libdir)/$(patsubst %,$(libtype$o),\
|
|
|
|
|
$(libprefix)$(libc-name)))
|
|
|
|
|
install: $(installed-libcs)
|
1995-02-18 09:27:10 +08:00
|
|
|
|
# We avoid depending on lib-noranlib because that makes the parent make
|
|
|
|
|
# subdir_lib in all the subdirs, when the make install run they do will
|
|
|
|
|
# update the library anyway. Running ranlib after installing makes the
|
|
|
|
|
# __.SYMDEF time stamp up to date, which avoids messages from some linkers.
|
|
|
|
|
# Depending on subdir_install gets all the subdirs to update the library,
|
|
|
|
|
# and is optimal for `make install' at top level.
|
1995-03-28 01:44:04 +08:00
|
|
|
|
$(installed-libcs): $(libdir)/lib$(libprefix)%: libobjs subdir_install
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(make-target-directory)
|
1995-03-28 01:44:04 +08:00
|
|
|
|
$(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@
|
1995-02-18 09:27:10 +08:00
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
endif
|
|
|
|
|
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
install-lib.so := libc.so $(filter lib%.so,$(install-lib))
|
|
|
|
|
install-lib := $(filter-out lib%.so,$(install-lib))
|
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
|
install: $(foreach so,$(install-lib.so), \
|
|
|
|
|
$(libdir)/$(so:lib%=lib$(libprefix)%).$($(so)-version))
|
|
|
|
|
$(libdir)/lib$(libprefix)%.so: $(common-objpfx)lib%.so; $(do-install)
|
|
|
|
|
endif
|
|
|
|
|
|
1995-02-18 09:27:10 +08:00
|
|
|
|
ifdef install-bin
|
|
|
|
|
$(addprefix $(bindir)/,$(install-bin)): $(bindir)/%: $(objpfx)%
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
$(INSTALL_PROGRAM) $< $@
|
|
|
|
|
endif
|
|
|
|
|
ifdef install-sbin
|
|
|
|
|
$(addprefix $(sbindir)/,$(install-sbin)): $(sbindir)/%: $(objpfx)%
|
|
|
|
|
$(make-target-directory)
|
|
|
|
|
$(INSTALL_PROGRAM) $< $@
|
|
|
|
|
endif
|
|
|
|
|
ifdef install-lib
|
|
|
|
|
install-lib.a := $(filter lib%.a,$(install-lib))
|
|
|
|
|
install-lib-non.a := $(filter-out lib%.a,$(install-lib))
|
|
|
|
|
ifdef install-lib-non.a
|
|
|
|
|
$(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \
|
|
|
|
|
$(libdir)/$(libprefix)%: $(objpfx)%
|
|
|
|
|
$(do-install)
|
|
|
|
|
endif
|
|
|
|
|
ifdef install-lib.a
|
|
|
|
|
$(install-lib.a:lib%.a=$(libdir)/lib$(libprefix)%.a): \
|
|
|
|
|
$(libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a
|
|
|
|
|
$(do-install)
|
|
|
|
|
$(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
ifdef install-data
|
|
|
|
|
$(addprefix $(datadir)/,$(install-data)): $(datadir)/%: %;$(do-install)
|
|
|
|
|
endif
|
|
|
|
|
headers := $(strip $(headers))
|
|
|
|
|
ifdef headers
|
|
|
|
|
$(addprefix $(includedir)/,$(headers)): \
|
|
|
|
|
$(includedir)/%: %;$(do-install)
|
|
|
|
|
endif # headers
|
|
|
|
|
|
|
|
|
|
.PHONY: install-bin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
|
|
|
|
|
install-data-nosubdir install-headers-nosubdir
|
|
|
|
|
install-bin-nosubdir: $(addprefix $(bindir)/,$(install-bin))
|
|
|
|
|
install-sbin-nosubdir: $(addprefix $(sbindir)/,$(install-sbin))
|
|
|
|
|
install-lib-nosubdir: $(addprefix $(libdir)/,\
|
|
|
|
|
$(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
|
|
|
|
|
$(addprefix $(libprefix),$(install-lib-non.a)))
|
|
|
|
|
install-data-nosubdir: $(addprefix $(datadir)/,$(install-data))
|
|
|
|
|
install-headers-nosubdir: $(addprefix $(includedir)/,$(headers))
|
|
|
|
|
install-others-nosubdir: $(install-others)
|
|
|
|
|
|
|
|
|
|
# We need all the `-nosubdir' targets so that `install' in the parent
|
|
|
|
|
# doesn't depend on several things which each iterate over the subdirs.
|
|
|
|
|
# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
|
|
|
|
|
# subroutine. Then in the parent `install-FOO' also causes subdir makes.
|
|
|
|
|
install-%:: install-%-nosubdir ;
|
|
|
|
|
|
|
|
|
|
.PHONY: install install-no-libc.a-nosubdir
|
|
|
|
|
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
|
|
|
|
|
install-bin-nosubdir install-lib-nosubdir \
|
|
|
|
|
install-others-nosubdir install-sbin-nosubdir
|
|
|
|
|
install: install-no-libc.a-nosubdir
|
|
|
|
|
|
|
|
|
|
# Command to compile $< in $(objdir) using the native libraries.
|
|
|
|
|
define native-compile
|
|
|
|
|
cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
|
|
|
|
|
$(addprefix $$cwd/,$^) -o $(@F)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# Command to compile $< in $(common-objdir) using the native libraries.
|
|
|
|
|
define common-objdir-compile
|
|
|
|
|
cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=%) -o $(@F)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
# We always want to use configuration definitions.
|
|
|
|
|
BUILD_CFLAGS = -include $(common-objpfx)config.h
|
|
|
|
|
|
|
|
|
|
# Support the GNU standard name for this target.
|
|
|
|
|
.PHONY: check
|
|
|
|
|
check: tests
|
|
|
|
|
|
|
|
|
|
.PHONY: TAGS
|
|
|
|
|
TAGS: distinfo $(..)MakeTAGS
|
|
|
|
|
$(MAKE) $(addprefix -f ,$^)
|
|
|
|
|
|
|
|
|
|
.PHONY: echo-headers
|
|
|
|
|
echo-headers:
|
|
|
|
|
@echo $(headers)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Common cleaning targets.
|
|
|
|
|
|
|
|
|
|
.PHONY: common-mostlyclean common-clean mostlyclean clean
|
|
|
|
|
clean: common-clean
|
|
|
|
|
mostlyclean: common-mostlyclean
|
|
|
|
|
|
|
|
|
|
# Remove the object files.
|
|
|
|
|
common-mostlyclean:
|
|
|
|
|
-rm -f $(addprefix $(objpfx),$(tests) $(others) \
|
|
|
|
|
$(addsuffix .o,$(tests) $(others)) \
|
|
|
|
|
$(addsuffix .out,$(tests)))
|
1995-03-21 12:19:38 +08:00
|
|
|
|
-rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib))
|
|
|
|
|
-rm -f core $(objpfx)stub-$(subdir)
|
Support building several flavors of objects and libraries.
* Makerules (libtypes, object-suffixes): New variables.
(libtype.*, CFLAGS-*, CPPFLAGS-*): New variables for each object
suffix.
(CFLAGS, CPPFLAGS): Append $(C{,CPP}FLAGS-$(suffix $@)).
(%.so, %.po, %.go): New compilation rules for %.S, %.s, %.c.
(close-check-inhibit-asm): Append a semicolon.
(sysd-rules): Generate rules for each object suffix.
(compile.S, compile.c): Always assume gcc.
(OUTPUT_OPTION): Define unconditionally.
(+make-deps): In generated rule, produce a dependent for each
object suffix.
(.SUFFIXES): Add $(object-suffixes) in place of .o.
(.PRECIOUS): Make all suffix flavors precious.
($(libc.a)): Target removed.
(lib): Depend on each enabled libtype.
(libobjs, objects, objs): Depend on all the enabled object flavors.
(lib%.a): New pattern rule.
[$(build-shared)=yes] (lib%.so: lib%_pic.a): New pattern rule.
(stamp-$(subdir)): Rewritten to a pattern rule for stamp.%-$(subdir)
to make one for each flavor; library dep rule likewise rewritten.
($(libc.a)(__.SYMDEF)): Target replaced with one target for each
flavor.
(symdef.%): New pattern rule; helper for __.SYMDEF targets.
(installed-libcs): New variable.
(install): Depend on that instead of
$(libdir)/lib$(libprefix)$(libc-name).a;
that file's rule rewritten to make each enabled libtype.
(install-lib.so): New variable, filters lib%.so from $(install-lib).
(install-lib): Filter out lib%.so after setting install-lib.so.
[$(build-shared)=yes] (install): Install $(install-lib.so).
(common-mostlyclean): Remove all flavors of objects.
1995-03-13 15:42:09 +08:00
|
|
|
|
$(rmobjs)
|
|
|
|
|
define rmobjs
|
|
|
|
|
$(foreach o,$(object-suffixes),
|
|
|
|
|
-rm -f $(addprefix $(objpfx),stamp$o-$(subdir)) $(objects:.o=$o))
|
|
|
|
|
endef
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
|
|
# Also remove the dependencies and generated source files.
|
|
|
|
|
common-clean: common-mostlyclean
|
|
|
|
|
-rm -f $(objpfx)depend-$(subdir) $(+depfiles)
|
|
|
|
|
-rm -f $(addprefix $(objpfx),$(generated))
|
|
|
|
|
|
|
|
|
|
# Produce a file `stub-$(subdir)' which contains `#define __stub_FUNCTION'
|
|
|
|
|
# for each function which is a stub. We grovel over all the .d files
|
|
|
|
|
# looking for references to source files in sysdeps/stub. Then we grovel
|
|
|
|
|
# over each referenced source file to see what stub function it defines.
|
|
|
|
|
|
|
|
|
|
.PHONY: stubs # The parent Makefile calls this target.
|
|
|
|
|
stubs: $(common-objpfx)stub-$(subdir)
|
|
|
|
|
s = $(sysdep_dir)/stub
|
|
|
|
|
$(common-objpfx)stub-$(subdir): $(+depfiles)
|
|
|
|
|
# Use /dev/null since `...` might expand to empty.
|
|
|
|
|
s=`cd $s; /bin/pwd`; \
|
|
|
|
|
$(patsubst %,cd %;,$(objdir)) \
|
|
|
|
|
sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
|
|
|
|
|
`sed -n 's@^.*$s/\([a-z0-9_-]*\.c\).*$$@'"$$s"/'\1@p' \
|
|
|
|
|
$(patsubst $(objpfx)%,%,$^) /dev/null` \
|
|
|
|
|
/dev/null > $@T
|
|
|
|
|
mv -f $@T $@
|
|
|
|
|
|
|
|
|
|
# Make the distribution tar file.
|
|
|
|
|
|
|
|
|
|
.PHONY: dist
|
|
|
|
|
dist: distinfo $(..)Make-dist
|
|
|
|
|
$(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
|
|
|
|
|
|
|
|
|
|
dist: $(distribute)
|
|
|
|
|
|
|
|
|
|
# We used to simply export all these variables, but that frequently made the
|
|
|
|
|
# environment get too large. Instead, we write all the information into
|
|
|
|
|
# a generated makefile fragment `distinfo', and then include it with -f in
|
|
|
|
|
# the sub-make that makes the distribution (above).
|
|
|
|
|
distinfo: Makefile $(..)Makerules
|
|
|
|
|
$(distinfo-vars)
|
|
|
|
|
mv -f $@.new $@
|
|
|
|
|
|
|
|
|
|
define distinfo-vars
|
|
|
|
|
rm -f $@.new
|
|
|
|
|
$(foreach var,subdir sources elided-routines headers distribute \
|
|
|
|
|
dont_distribute generated others tests,
|
|
|
|
|
echo >> $@.new '$(var) := $($(var))')
|
|
|
|
|
echo >> $@.new 'sources := $$(sources) $$(addsuffix .c,$$(elided-routines))'
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
ifneq (,$(strip $(gpl2lgpl)))
|
|
|
|
|
ifneq (,$(wildcard $(..)gpl2lgpl.sed))
|
|
|
|
|
# Snarf from the master source and frob the copying notice.
|
|
|
|
|
$(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
|
|
|
|
|
sed -f $^ > $@-tmp
|
|
|
|
|
# So I don't edit them by mistake.
|
|
|
|
|
chmod a-w $@-tmp
|
|
|
|
|
mv -f $@-tmp $@
|
|
|
|
|
test -d CVS && cvs commit -m'Updated from $^' $@
|
|
|
|
|
endif
|
|
|
|
|
endif
|