-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile.rules
35 lines (31 loc) · 1.38 KB
/
Makefile.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
# Import a sub-library of musl
#
# @param $(1)
# The name of the sub-library within musl.
# @param $(2)
# The headers for this sub-library.
# @param $(3)
# The source files for this sub-library.
#
define _libmusl_import_lib
$(LIBMUSL_BUILD)/include/$(1):
$(call verbose_cmd,MKDIR,libmusl: $(subst $(LIBMUSL_BUILD),,$(1)): $(notdir $$@), mkdir -p $$@)
# Make a symbolic link of the original header file to a sub-library directory
$(LIBMUSL_BUILD)/include/$(1)/%.h:
$$(Q)mkdir -p $$(shell dirname $$@)
$(call verbose_cmd,HOSTLN,libmusl: $(1): $$(subst $(LIBMUSL_BUILD)/include/$(1)/,,$$@), \
ln -sf $$(subst $(LIBMUSL_BUILD)/include/$(1)/,$(LIBMUSL),$$@) $$@)
# includes for building libmusl
LIBMUSL_$(call uc,$(1))_INCLUDES-y += -I$(LIBMUSL_BUILD)/include/$(1)/src/internal
LIBMUSL_$(call uc,$(1))_INCLUDES-y += -I$(LIBMUSL_BUILD)/include/$(1)/src/$(1)
LIBMUSL_$(call uc,$(1))_INCLUDES-y += -I$(LIBMUSL_BUILD)/include/$(1)/include
LIBMUSL_SRCS-y += $(3)
LIBMUSL_CINCLUDES-y += $$(LIBMUSL_$(call uc,$(1))_INCLUDES-y)
LIBMUSL_CXXINCLUDES-y += $$(LIBMUSL_$(call uc,$(1))_INCLUDES-y)
# includes for using libmusl
CINCLUDES-$(CONFIG_LIBMUSL) += -I$(LIBMUSL_BUILD)/include/$(1)/include
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