From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10301 Path: news.gmane.org!not-for-mail From: Bobby Bingham Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 1/5] generalize "generic" fallback for bits headers Date: Tue, 5 Jul 2016 22:54:10 -0500 Message-ID: <20160706035414.10083-1-koorogi@koorogi.info> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1467777306 14281 80.91.229.3 (6 Jul 2016 03:55:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Jul 2016 03:55:06 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10312-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jul 06 05:54:57 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bKdvJ-0003Cy-Se for gllmg-musl@m.gmane.org; Wed, 06 Jul 2016 05:54:54 +0200 Original-Received: (qmail 19905 invoked by uid 550); 6 Jul 2016 03:54:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19591 invoked from network); 6 Jul 2016 03:54:31 -0000 X-Mailer: git-send-email 2.9.0 Xref: news.gmane.org gmane.linux.lib.musl.general:10301 Archived-At: Previously, ports could provide a given bits header, or they could inherit a generic version. There was a limitation that there could only be one generic version of a given header. In some cases, there were multiple ports that could share one version of a header, and others which could share a different version (e.g., 32-bit vs 64-bit versions). This commit implements the makefile infrastructure necessary to provide multiple bits header overlays, and to let each port decide which overlays to use. The first referenced overlay which contains a given bits header will be the one that is used for that header. --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8246b78..b401cdf 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ CFLAGS_AUTO = -Os -pipe CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc CFLAGS_ALL = $(CFLAGS_C99FSE) -CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include +CFLAGS_ALL += -D_XOPEN_SOURCE=700 $(foreach a,$(ARCH_FALLBACKS),-I$(srcdir)/arch/$(a)) -Iobj/src/internal -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS) LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS) @@ -55,10 +55,9 @@ AR = $(CROSS_COMPILE)ar RANLIB = $(CROSS_COMPILE)ranlib INSTALL = $(srcdir)/tools/install.sh -ARCH_INCLUDES = $(wildcard $(srcdir)/arch/$(ARCH)/bits/*.h) -GENERIC_INCLUDES = $(wildcard $(srcdir)/arch/generic/bits/*.h) +ARCH_INCLUDES = $(sort $(foreach a,$(ARCH_FALLBACKS),$(patsubst $(srcdir)/arch/$(a)/%,include/%,$(wildcard $(srcdir)/arch/$(a)/bits/*.h)))) INCLUDES = $(wildcard $(srcdir)/include/*.h $(srcdir)/include/*/*.h) -ALL_INCLUDES = $(sort $(INCLUDES:$(srcdir)/%=%) $(GENH:obj/%=%) $(ARCH_INCLUDES:$(srcdir)/arch/$(ARCH)/%=include/%) $(GENERIC_INCLUDES:$(srcdir)/arch/generic/%=include/%)) +ALL_INCLUDES = $(sort $(INCLUDES:$(srcdir)/%=%) $(GENH:obj/%=%) $(ARCH_INCLUDES)) EMPTY_LIB_NAMES = m rt pthread crypt util xnet resolv dl EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a) @@ -84,6 +83,12 @@ all: else +-include $(srcdir)/arch/$(ARCH)/arch.mak + +ifeq ($(ARCH_FALLBACKS),) +ARCH_FALLBACKS = $(ARCH) generic +endif + all: $(ALL_LIBS) $(ALL_TOOLS) OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(GENH) $(GENH_INT))) obj/include) @@ -100,6 +105,12 @@ obj/include/bits/syscall.h: $(srcdir)/arch/$(ARCH)/bits/syscall.h.in cp $< $@ sed -n -e s/__NR_/SYS_/p < $< >> $@ +define mkarchheaders +$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(1)/bits/% + $(INSTALL) -D -m 644 $$< $$@ +endef +$(foreach a,$(ARCH_FALLBACKS),$(eval $(call mkarchheaders,$(a)))) + obj/src/internal/version.h: $(wildcard $(srcdir)/VERSION $(srcdir)/.git) printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@ @@ -202,12 +213,6 @@ $(DESTDIR)$(libdir)/%.so: lib/%.so $(DESTDIR)$(libdir)/%: lib/% $(INSTALL) -D -m 644 $< $@ -$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(ARCH)/bits/% - $(INSTALL) -D -m 644 $< $@ - -$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/generic/bits/% - $(INSTALL) -D -m 644 $< $@ - $(DESTDIR)$(includedir)/bits/%: obj/include/bits/% $(INSTALL) -D -m 644 $< $@ -- 2.9.0