mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 1/5] generalize "generic" fallback for bits headers
@ 2016-07-06  3:54 Bobby Bingham
  2016-07-06  3:54 ` [PATCH 2/5] create big/little endian generic bits overlays Bobby Bingham
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bobby Bingham @ 2016-07-06  3:54 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-07-06  4:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06  3:54 [PATCH 1/5] generalize "generic" fallback for bits headers Bobby Bingham
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

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).