From: Bobby Bingham <koorogi@koorogi.info>
To: musl@lists.openwall.com
Subject: [PATCH 1/5] generalize "generic" fallback for bits headers
Date: Tue, 5 Jul 2016 22:54:10 -0500 [thread overview]
Message-ID: <20160706035414.10083-1-koorogi@koorogi.info> (raw)
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
next reply other threads:[~2016-07-06 3:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-06 3:54 Bobby Bingham [this message]
2016-07-06 3:54 ` [PATCH 2/5] create big/little endian generic bits overlays Bobby Bingham
2016-07-06 3:54 ` [PATCH 3/5] create ld64/ld128 " Bobby Bingham
2016-07-06 3:54 ` [PATCH 4/5] create 32-/64-bit " Bobby Bingham
2016-07-06 4:29 ` Rich Felker
2016-07-06 4:31 ` Rich Felker
2016-07-06 3:54 ` [PATCH 5/5] move generic fcntl.h to generic-32 Bobby Bingham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160706035414.10083-1-koorogi@koorogi.info \
--to=koorogi@koorogi.info \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).