1# Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14include $(MAIN_TOPDIR)/build/make_scripts/config.mk 15-include $(MAIN_TOPDIR)/$(MODULE_DIR)/srcs.mk 16include $(MAIN_TOPDIR)/$(MODULE_DIR)/module_config.mk 17 18OBJDIR = $(MAIN_TOPDIR)/$(OBJ_PATH)/$(MODULE_DIR) 19 20ID_CFG_FILE = $(MAIN_TOPDIR)/$(MODULE_DIR)/file_id.cfg 21 22LIB_NAME = lib$(LIB).a 23SRCS = $($(LIB)_srcs) 24LIBOUT = $(MAIN_TOPDIR)/$(LIB_PATH)/$(MODULE_DIR)/$(LIB_NAME) 25 26ifdef SRC_FILES 27OBJ_SRCS := $(filter %.c, $(SRC_FILES)) 28ASM_SRCS := $(filter %.S, $(SRC_FILES)) 29else 30OBJ_SRCS := $(foreach dir, $(SRCS), $(wildcard $(dir)/*.c)) 31ASM_SRCS := $(foreach dir, $(SRCS), $(wildcard $(dir)/*.S )) 32endif 33 34OBJ_SRCS := $(filter-out %/ethernetif.c, $(OBJ_SRCS)) 35OBJS = $(patsubst %.c, $(OBJDIR)/%.o, $(OBJ_SRCS)) 36ASM_OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(ASM_SRCS)) 37 38all: $(LIBOUT) 39include $(MAIN_TOPDIR)/build/make_scripts/lib.mk 40 41clean: 42 $(Q)$(foreach x, $(OBJS) $(ASM_OBJS) $(LIBOUT), \ 43 if [ -d $(dir $x) ]; \ 44 then $(RM) $(dir $x); \ 45 echo clean dir $(dir $x) success; \ 46 fi;) 47 48.PHONY: all clean 49 50