diff --git a/Makefile.rules b/Makefile.rules index c3b36d5c5ca0b3ead9c360cc7350d80ff77e46e4..24fd5e81307c5a97ee1de704ee63fc2eaa53eaad 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -8,6 +8,7 @@ # @param $(3) # The source files for this sub-library. # +ifeq ($(CONFIG_LIBMUSL), y) define _libmusl_import_lib $(LIBMUSL_BUILD)/include/$(1): $(call verbose_cmd,MKDIR,libmusl: $(subst $(LIBMUSL_BUILD),,$(1)): $(notdir $$@), mkdir -p $$@) @@ -33,3 +34,4 @@ CXXINCLUDES-$(CONFIG_LIBMUSL) += -I$(LIBMUSL_BUILD)/include/$(1)/include # Append the sub library directory to the include path $(LIBMUSL_BUILD)/.prepared: $(subst $(LIBMUSL),$(LIBMUSL_BUILD)/include/$(1),$(2)) endef +endif diff --git a/Makefile.uk b/Makefile.uk index 0d6e0e045e71990f3ab5bc92eba1b880fa27ddfe..0c863bf5897d085b3763d142138a8f82a53de245 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -54,6 +54,7 @@ endif ################################################################################ # Library registration ################################################################################ + $(eval $(call addlib_s,libmusl,$(CONFIG_LIBMUSL))) # Additionally, build glue code. This is put into a separate library so that we @@ -67,16 +68,20 @@ $(eval $(call addlib_s,libmuslglue,$(CONFIG_LIBMUSL))) LIBMUSL_VERSION=1.2.3 LIBMUSL_URL=https://gitee.com/tenonos-mirror/fork-musl.git LIBMUSL_PATCHDIR=$(LIBMUSL_BASE)/patches +ifeq ($(CONFIG_LIBMUSL),y) $(eval $(call clone,libmusl,$(LIBMUSL_URL),v$(LIBMUSL_VERSION))) $(eval $(call patch,libmusl,$(LIBMUSL_PATCHDIR),.)) - +endif ################################################################################ # Helpers ################################################################################ LIBMUSL=$(LIBMUSL_ORIGIN)/ # Additional macros for musl sub-libraries + +ifeq ($(CONFIG_LIBMUSL),y) include $(LIBMUSL_BASE)/Makefile.rules +endif ################################################################################ # Library includes @@ -104,6 +109,7 @@ CXXINCLUDES-$(CONFIG_LIBMUSL) += $(LIBMUSL_GLOBAL_INCLUDES-y) # Musl-specific Targets ################################################################################ # generate alltypes.h through musl sed script +ifeq ($(CONFIG_LIBMUSL),y) $(LIBMUSL)/arch/$(MUSL_ARCH)/bits/alltypes.h: $(LIBMUSL_BUILD)/.patched $(call verbose_cmd,CONFIGURE,libmusl: $(notdir $@),\ sed -f $(LIBMUSL)/tools/mkalltypes.sed \ @@ -121,6 +127,8 @@ UK_PREPARE += $(LIBMUSL)/arch/$(MUSL_ARCH)/bits/alltypes.h UK_PREPARE += $(LIBMUSL)/src/internal/version.h UK_PREPARE += $(LIBMUSL_BUILD)/.prepared +endif + LIBMUSL_CLEAN += $(LIBMUSL)/arch/$(MUSL_ARCH)/bits/alltypes.h LIBMUSL_CLEAN += $(LIBMUSL)/src/internal/version.h @@ -189,7 +197,9 @@ LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/features.h LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/assert.h LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sysexits.h +ifeq ($(CONFIG_LIBMUSL),y) $(eval $(call _libmusl_import_lib,core,$(LIBMUSL_CORE_HDRS-y),$(LIBMUSL_CORE_SRCS-y))) +endif ################################################################################ # musl code -- one external Makefile per sub-lib diff --git a/Makefile.uk.musl.stdio b/Makefile.uk.musl.stdio index b8cb2d5b23b411d079d13f4632a88eb21e10096f..5d4be43996bbc8fda93558537f3c5312bc7749c7 100644 --- a/Makefile.uk.musl.stdio +++ b/Makefile.uk.musl.stdio @@ -30,6 +30,8 @@ LIBMUSL_STDIO_HDRS-y += $(LIBMUSL)/include/sys/uio.h LIBMUSL_STDIO_HDRS-y += $(LIBMUSL)/include/unistd.h LIBMUSL_STDIO_HDRS-y += $(LIBMUSL)/include/wchar.h LIBMUSL_STDIO_HDRS-y += $(LIBMUSL)/include/wctype.h +LIBMUSL_STDIO_HDRS-y += $(LIBMUSL)/include/paths.h +LIBMUSL_STDIO_HDRS-y += $(LIBMUSL)/include/ar.h LIBMUSL_STDIO_SRCS-y += $(LIBMUSL)/src/stdio/asprintf.c