-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathhi_rules.mak
104 lines (84 loc) · 4.06 KB
/
hi_rules.mak
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#-------------------------------------------------------------------------------
# Copyright (C), 2016, Hisilicon Tech. Co., Ltd.
#-------------------------------------------------------------------------------
CFLAGS += $(filter-out $(FILTER),$(CFG_HI_CFLAGS))
CFLAGS += -I$(COMMON_UNF_INCLUDE) \
-I$(COMMON_API_INCLUDE) \
-I$(COMMON_DRV_INCLUDE) \
-I$(MSP_UNF_INCLUDE) \
-I$(MSP_API_INCLUDE) \
-I$(MSP_DRV_INCLUDE) \
-I$(CURDIR)
OBJS := $(SRCS:%.c=%.o) $(CPP_SRCS:%.cpp=%.o) $(ASM_SRCS:%.S=%.o)
ifneq ($(LOCAL_SRC_DIR),)
OBJS := $(notdir $(OBJS))
endif
OBJ_DIR32 := $(HI_OUT_DIR)/obj/$(subst $(SDK_DIR)/,,$(CURDIR))
OBJ_DIR64 := $(HI_OUT_DIR)/obj64/$(subst $(SDK_DIR)/,,$(CURDIR))
OBJS32 += $(addprefix $(OBJ_DIR32)/,$(OBJS) $(SIC_RSA_OBJS))
OBJS64 += $(addprefix $(OBJ_DIR64)/,$(OBJS) $(SIC_RSA_OBJS64))
TARGETS :=
ifeq ($(HI_USER_SPACE_LIB),y)
TARGETS += $(OBJ_DIR32)/$(LIB_NAME)
endif
ifeq ($(HI_USER_SPACE_LIB64),y)
TARGETS += $(OBJ_DIR64)/$(LIB_NAME)
endif
ifneq ($(DEPEND_LIBS),)
LDFLAGS32 += -L$(HI_EXTERN_LIB_DIR) -L$(HI_SHARED_LIB_DIR) $(DEPEND_LIBS)
LDFLAGS64 += -L$(HI_EXTERN_LIB64_DIR) -L$(HI_SHARED_LIB64_DIR) $(DEPEND_LIBS)
endif
#===============================================================================
# rules
#===============================================================================
.PHONY: all clean
all : $(TARGETS)
ifneq ($(HEADER_FILES),)
$(AT)test -d $(HI_INCLUDE_DIR) || mkdir -p $(HI_INCLUDE_DIR)
$(AT)cp -f $(HEADER_FILES) $(HI_INCLUDE_DIR)/
endif
ifeq ($(HI_USER_SPACE_LIB),y)
$(AT)test -d $(HI_STATIC_LIB_DIR) || mkdir -p $(HI_STATIC_LIB_DIR)
$(AT)cp -f $(OBJ_DIR32)/$(LIB_NAME).a $(HI_STATIC_LIB_DIR)
$(AT)test -d $(HI_SHARED_LIB_DIR) || mkdir -p $(HI_SHARED_LIB_DIR)
$(AT)cp -f $(OBJ_DIR32)/$(LIB_NAME).so $(HI_SHARED_LIB_DIR)
endif
ifeq ($(HI_USER_SPACE_LIB64),y)
$(AT)test -d $(HI_STATIC_LIB64_DIR) || mkdir -p $(HI_STATIC_LIB64_DIR)
$(AT)cp -f $(OBJ_DIR64)/$(LIB_NAME).a $(HI_STATIC_LIB64_DIR)
$(AT)test -d $(HI_SHARED_LIB64_DIR) || mkdir -p $(HI_SHARED_LIB64_DIR)
$(AT)cp -f $(OBJ_DIR64)/$(LIB_NAME).so $(HI_SHARED_LIB64_DIR)
endif
clean :
$(AT)rm -rf $(OBJS32) $(OBJS64)
$(AT)rm -rf $(OBJ_DIR32)/$(LIB_NAME).a $(OBJ_DIR32)/$(LIB_NAME).so
$(AT)rm -rf $(OBJ_DIR64)/$(LIB_NAME).a $(OBJ_DIR64)/$(LIB_NAME).so
ifneq ($(HEADER_FILES),)
$(AT)rm -rf $(foreach file, $(HEADER_FILES), $(HI_INCLUDE_DIR)/$(notdir $(file)))
endif
$(AT)rm -f $(HI_STATIC_LIB_DIR)/$(LIB_NAME).a $(HI_SHARED_LIB_DIR)/$(LIB_NAME).so
$(AT)rm -f $(HI_STATIC_LIB64_DIR)/$(LIB_NAME).a $(HI_SHARED_LIB64_DIR)/$(LIB_NAME).so
$(OBJ_DIR32)/%.o : $(if $(LOCAL_SRC_DIR),$(LOCAL_SRC_DIR)/%.c,%.c)
$(AT)test -d $(dir $@) || mkdir -p $(dir $@)
$(AT)$(CFG_HI_ARM_TOOLCHAINS_NAME)-gcc $(CFLAGS) $(FLOAT_OPTIONS) -o $@ -c $^
$(OBJ_DIR32)/%.o : $(if $(LOCAL_SRC_DIR),$(LOCAL_SRC_DIR)/%.cpp,%.cpp)
$(AT)test -d $(dir $@) || mkdir -p $(dir $@)
$(AT)$(CFG_HI_ARM_TOOLCHAINS_NAME)-gcc $(CFLAGS) $(FLOAT_OPTIONS) -o $@ -c $^
$(OBJ_DIR32)/%.o : $(if $(LOCAL_SRC_DIR),$(LOCAL_SRC_DIR)/%.S,%.S)
$(AT)test -d $(dir $@) || mkdir -p $(dir $@)
$(AT)$(CFG_HI_ARM_TOOLCHAINS_NAME)-gcc $(CFLAGS) $(FLOAT_OPTIONS) -o $@ -c $^
$(OBJ_DIR64)/%.o : $(if $(LOCAL_SRC_DIR),$(LOCAL_SRC_DIR)/%.c,%.c)
$(AT)test -d $(dir $@) || mkdir -p $(dir $@)
$(AT)$(CFG_HI_AARCH64_TOOLCHAINS_NAME)-gcc $(CFLAGS) -o $@ -c $^
$(OBJ_DIR64)/%.o : $(if $(LOCAL_SRC_DIR),$(LOCAL_SRC_DIR)/%.cpp,%.cpp)
$(AT)test -d $(dir $@) || mkdir -p $(dir $@)
$(AT)$(CFG_HI_AARCH64_TOOLCHAINS_NAME)-gcc $(CFLAGS) -o $@ -c $^
$(OBJ_DIR64)/%.o : $(if $(LOCAL_SRC_DIR),$(LOCAL_SRC_DIR)/%.S,%.S)
$(AT)test -d $(dir $@) || mkdir -p $(dir $@)
$(AT)$(CFG_HI_AARCH64_TOOLCHAINS_NAME)-gcc $(CFLAGS) -o $@ -c $^
$(OBJ_DIR32)/$(LIB_NAME): $(OBJS32)
$(AT)$(CFG_HI_ARM_TOOLCHAINS_NAME)-ar -rcs [email protected] $(OBJS32)
$(AT)$(CFG_HI_ARM_TOOLCHAINS_NAME)-gcc -shared -o [email protected] $(OBJS32) $(LDFLAGS32)
$(OBJ_DIR64)/$(LIB_NAME): $(OBJS64)
$(AT)$(CFG_HI_AARCH64_TOOLCHAINS_NAME)-ar -rcs [email protected] $(OBJS64)
$(AT)$(CFG_HI_AARCH64_TOOLCHAINS_NAME)-gcc -shared -o [email protected] $(OBJS64) $(LDFLAGS64)