Makefile 2.4 KB
Newer Older
W
wenjun 已提交
1 2 3 4
include $(LITEOSTOPDIR)/config.mk

MODULE_NAME := c

5 6 7 8
TOPDIR = $(LITEOSTOPDIR)/../..
MUSLDIR = $(TOPDIR)/third_party/musl
MUSLPORTINGDIR = $(MUSLDIR)/porting/liteos_a/kernel
OPTRTDIR = $(TOPDIR)/third_party/optimized-routines
W
wenjun 已提交
9

10
MUSL_SRCS =
A
arvinzzz 已提交
11 12 13
LOCAL_OPT_DIR = src/arch/$(ARCH)
LOCAL_OPT_SRCS =
LOCAL_FILTER_SRCS =
M
mamingshuai 已提交
14

15 16 17
MUSLPORTING_SRCS = \
	src/*/$(ARCH)/*.[csS] \
	src/*/*.c
M
mamingshuai 已提交
18

19 20
LOCAL_SRCS = $(wildcard $(addprefix $(MUSLPORTINGDIR)/,$(MUSLPORTING_SRCS)))
LOCAL_SRCS := $(filter-out $(subst $(MUSLPORTINGDIR),$(MUSLDIR),$(LOCAL_SRCS)),$(addprefix $(MUSLDIR)/,$(MUSL_SRCS)) $(LOCAL_SRCS))
A
arvinzzz 已提交
21 22 23 24 25 26 27
LOCAL_SRCS += $(wildcard src/*.c src/*.S)
# Sources optimized for specific architectures
LOCAL_OPT_SRCS := $(wildcard $(LOCAL_OPT_DIR)/*.c, $(LOCAL_OPT_DIR)/*.S)
# Enumerate common src files with the same name as the optimized srcs
LOCAL_FILTER_SRCS := $(addprefix $(MUSLPORTINGDIR)/src/string/,$(subst $(LOCAL_OPT_DIR)/,,$(LOCAL_OPT_SRCS)))
LOCAL_FILTER_SRCS += $(addprefix src/,$(subst $(LOCAL_OPT_DIR)/,,$(LOCAL_OPT_SRCS)))
LOCAL_FILTER_SRCS := $(subst .S,.c, $(LOCAL_FILTER_SRCS))
M
mamingshuai 已提交
28 29

ifeq ($(LOSCFG_ARCH_ARM_VER), "armv7-a")
30
LOCAL_SRCS := $(filter-out $(addprefix $(MUSLPORTINGDIR)/src/string/,memchr.c memcpy.c strcmp.c strcpy.c strlen.c), $(LOCAL_SRCS))
31 32 33 34 35 36
LOCAL_SRCS += \
	$(OPTRTDIR)/string/arm/memchr.S \
	$(OPTRTDIR)/string/arm/memcpy.S \
	$(OPTRTDIR)/string/arm/strcmp.S \
	$(OPTRTDIR)/string/arm/strcpy.c \
	$(OPTRTDIR)/string/arm/strlen-armv6t2.S
37 38 39 40 41 42

LOCAL_CMACRO = \
	-D__strlen_armv6t2=strlen \
	-D__strcmp_arm=strcmp \
	-D__memchr_arm=memchr

L
LiteOS2021 已提交
43 44 45 46 47 48
ifeq ($(LOSCFG_KERNEL_LMS), y)
LOCAL_CMACRO += -D__memcpy_arm=__memcpy -D__strcpy_arm=__strcpy
else
LOCAL_CMACRO += -D__memcpy_arm=memcpy -D__strcpy_arm=strcpy
endif

A
arvinzzz 已提交
49 50 51
# Replace the general srcs of the same name with specially optimized srcs
LOCAL_SRCS += $(LOCAL_OPT_SRCS)
LOCAL_SRCS := $(filter-out $(LOCAL_FILTER_SRCS),$(LOCAL_SRCS))
M
mamingshuai 已提交
52
endif
W
wenjun 已提交
53 54

LOCAL_INCLUDE := \
M
mamingshuai 已提交
55
	-I $(LITEOSTOPDIR)/syscall \
A
arvinzzz 已提交
56
	-I $(LITEOSTOPDIR)/bsd/dev/random
M
mamingshuai 已提交
57

58
LOCAL_INCLUDE += $(addprefix -I$(MUSLPORTINGDIR)/, src/include src/internal)
W
wenjun 已提交
59

A
arvinzzz 已提交
60
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LOCAL_CMACRO)
W
wenjun 已提交
61
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
A
arvinzzz 已提交
62
LOCAL_FLAGS +=-Wno-char-subscripts -Wno-ignored-pragmas -Wno-strict-prototypes
W
wenjun 已提交
63
else
A
arvinzzz 已提交
64
LOCAL_FLAGS += -frounding-math -Wno-unused-but-set-variable
W
wenjun 已提交
65
endif
A
arvinzzz 已提交
66
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-unknown-pragmas
G
guzhihao4 已提交
67
LOCAL_FLAGS += -Wno-unused-but-set-variable
W
wenjun 已提交
68

69
include $(MODULE)