blob: 21f4c0cafa112685ee2e5b0d0e44f56101b44191 [file] [log] [blame]
# Common Makefile rules
#
# For linux_lib we don't build anything. Object files are just added
# when compiling modules depending on the libs
ifeq ("$(MOD_TYPE)", "linux_lib")
# Skip libraries that might have crept in dependencies
SKIP_LIB_MODULES = y
export SKIP_LIB_MODULES
endif
ifeq ("$(MOD_TYPE)", "linux_module")
# Skip libraries that might have crept in dependencies
SKIP_LIB_MODULES = y
export SKIP_LIB_MODULES
endif
ifeq ("$(MOD_TYPE)", "lib")
MODULE_IS_A_LIBRARY = y
else ifeq ("$(MOD_TYPE)", "shared_lib")
MODULE_IS_A_LIBRARY = y
else
MODULE_IS_A_LIBRARY = n
endif
# Include module's own auto-generated Makefile.config.$(MODULE) file if any
# It in turn includes all dependencies
ifeq (x"$(V)", x"2")
$(info !!!MOD_NAME=$(MOD_NAME) MOD_TYPE=$(MOD_TYPE) MOD_TARGET=$(MOD_TARGET))
$(info !!!Including own dependency file: $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME))
endif
-include $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME)
ifeq (x"$(V)", x"2")
$(info !!!After include of $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME))
endif
ifeq (x"$(V)", x"2")
$(info !!! Building $(MOD_TYPE) module $(MOD_NAME): depends on $(MOD_DEPS_FILES) SKIP_LIBS=$(SKIP_LIB_MODULES))
endif
# Skip default rules for custom module
ifneq ("$(MOD_CUSTOM)", "y")
# Default lib rule
ifeq ("$(MOD_TYPE)", "lib")
ifeq ("$(SKIP_LIB_MODULES)", "y")
$(MOD_TARGET):
else
# Rule to compile all module's C files in one go
ifeq ("$(COMPILE_ALL_IN_ONE_GO)", "y")
$(MOD_TARGET): $(SRCS) $(AS_OBJS) $(as_OBJS)
# Create library if there are any objects
ifneq ("$(SRCS)$(AS_SRCS)$(as_SRCS)$(GEN_SRCS)", "")
ifneq ("$(SRCS)$(GEN_SRCS)", "")
ifeq (x"$(V)", x"0")
@echo "CC $(srcs) $(gen_srcs)"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)cd $(dir $@) && $(BLD_CC) $(CFLAGS) -c $(SRCS) $(GEN_SRCS)
endif
$(SILENT_BUILD)cd $(dir $@) && $(BLD_AR) $(ARFLAGS) $@ $(OBJS)
$(SILENT_BUILD)touch $(OUT_DIR_BASE)/.$(MOD_NAME)
@$(BOLD_PRINT) "done: $@"
# ifneq ("$(SRCS)$(AS_SRCS)$(as_SRCS)$(GEN_SRCS)", "")
endif
# ifeq ("$(COMPILE_ALL_IN_ONE_GO)", "y")
else
# Create library if there are any objects
$(MOD_TARGET): $(OBJS)
ifneq ("$(OBJS)", "")
$(SILENT_BUILD)$(BLD_AR) $(ARFLAGS) $@ $(OBJS)
$(SILENT_BUILD)touch $(OUT_DIR_BASE)/.$(MOD_NAME)
@$(BOLD_PRINT) "done: $@"
endif
# end of ifeq ($(COMPILE_ALL_IN_ONE_GO), "y")
endif
# end of ifeq ("$(SKIP_LIB_MODULES)", "y")
endif
# end of ifeq ("$(MOD_TYPE)", "lib")
endif
# Default shared_lib rule
ifeq ("$(MOD_TYPE)", "shared_lib")
EXTRA_CFLAGS += -fPIC
# Create library if there are any objects
$(MOD_TARGET): $(OBJS)
ifneq ("$(OBJS)", "")
$(SILENT_BUILD)$(BLD_CC) -shared -rdynamic -o $@ $(OBJS) $(LFLAGS)
$(SILENT_BUILD)mkdir -p $(SHARED_LIB_PATH)/
$(SILENT_BUILD)cp $@ $(SHARED_LIB_PATH)/
@$(BOLD_PRINT) "done: $@"
endif
$(SILENT_BUILD)touch $(OUT_DIR_BASE)/.$(MOD_NAME)
# end of ifeq ("$(MOD_TYPE)", "shared_lib")
endif
# Default app rule
ifeq ("$(MOD_TYPE)", "app")
# Currently, ThreadX image doesn't support any applications, apart from the
# image itself. Disable building applications for ThreadX
ifneq ("$(OS)", "threadx")
$(MOD_TARGET): $(OBJS) $(MOD_DEPS_FILES)
$(SILENT_BUILD)$(BLD_CC) -o $@ $(OBJS) $(LFLAGS) $(EXTRA_LIBS_PATH) $(LIBS_START_MARKER) $(EXTRA_LIBS) $(LIBS_END_MARKER) $(LIBS)
$(SILENT_BUILD)touch $(OUT_DIR_BASE)/.$(MOD_NAME)
@$(BOLD_PRINT) "done: $(OUT_DIR)/$(MOD_NAME)"
# else of ifneq ("$(OS)", "threadx")
else
$(MOD_TARGET):
# endif of ifneq ("$(OS)", "threadx")
endif
# endif of ifeq ("$(MOD_TYPE)", "app")
endif
# For linux_lib we don't build anything. Object files are just added
# when compiling modules depending on the libs
ifeq ("$(MOD_TYPE)", "linux_lib")
LINUX_LIB_OBJECTS := $(srcs:%.c=$(SRC_DIR)/%.o)
$(MOD_TARGET): $(SRCS) $(GEN_SRCS) $(MOD_DEPS_FILES)
$(SILENT_BUILD)touch $(MOD_TARGET)
$(SILENT_BUILD)touch $(OUT_DIR_BASE)/.$(MOD_NAME)
endif
# Default linux_module$(srcs:%=$(SRC_DIR)/%)
ifeq ("$(MOD_TYPE)", "linux_module")
obj-m += $(MOD_NAME).o
$(MOD_NAME)-objs := $(srcs:%.c=%.o)
LIB_OBJS_REL_PATH = $(foreach oo,$(ALL_LIB_OBJS),$(shell python -c "import os.path; print os.path.relpath('$(oo)', '$(SRC_DIR)')"))
_KERNEL_MAKEPARMS = -C $(KERNELDIR) M=$(SRC_DIR) KBUILD_EXTRA_SYMBOLS="$(KBUILD_EXTRA_SYMBOLS)" \
O=$(KERNEL_OUTDIR) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) V=$(V) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
obj-m=$(obj-m) $(MOD_NAME)-objs="$($(MOD_NAME)-objs) $(LIB_OBJS_REL_PATH)"
KERNEL_MAKEPARMS = $(_KERNEL_MAKEPARMS:%os_abstraction/posix=%os_abstraction/linux)
# Prevent parallel build
.NOTPARALLEL:
# Only build linux module if not already being built by another make thread.
# Otherwise, linux build system get confused
# Also, remove -s flag using MAKEFLAGS. Otherwise, linux build system will not print names of the files
# being compiled
$(MOD_TARGET): $(SRCS) $(MOD_DEPS_FILES)
ifneq ("$(SRC_DIR)", "$(TOP_DIR)/$(MOD_DIR)")
@cp -f $(TOP_DIR)/$(MOD_DIR)/Makefile $(SRC_DIR)
endif
$(SILENT_BUILD)if [ ! -f $(SRC_DIR)/.$(MOD_NAME)_in_progress ]; then \
touch $(SRC_DIR)/.$(MOD_NAME)_in_progress; \
MAKEFLAGS= $(MAKE) $(KERNEL_MAKEPARMS) ;\
if [[ "$$?" != "0" ]]; then \
rm -f $(SRC_DIR)/.$(MOD_NAME)_in_progress;\
exit -2;\
fi; \
mkdir -p $(OUT_DIR_BASE)/linux_modules ;\
touch -c $(MOD_TARGET) ;\
cp $(SRC_DIR)/$(MOD_NAME).ko $(OUT_DIR_BASE)/linux_modules/ ;\
touch $(OUT_DIR_BASE)/.$(MOD_NAME) ;\
$(BOLD_PRINT) "done: $(MOD_TARGET)" ;\
rm -f $(SRC_DIR)/.$(MOD_NAME)_in_progress ;\
fi
# Take care of compiling generated code for linux kernel
ifneq ("$(SRC_DIR)", "$(TOP_DIR)/$(MOD_DIR)")
$(SRC_DIR)/%.c : $(CODEGEN_OUTPUT_DIR)/../%.c
$(SILENT_BUILD)cp -f $(CODEGEN_OUTPUT_DIR)/../*.[c,h] $(SRC_DIR)/
$(SRC_DIR)/%.h : $(CODEGEN_OUTPUT_DIR)/../%.h
$(SILENT_BUILD)cp -f $(CODEGEN_OUTPUT_DIR)/../*.[c,h] $(SRC_DIR)/
endif
# End of MOD_TYPE==linux_module
endif
else
# only for MOD_CUSTOM include Module Makefile second time for propagate
# custom rules, first time included in Makefile.config for all modules
include $(SRC_DIR)/Makefile
# End of ifneq ($(MOD_CUSTOM), y)
endif
$(OUT_DIR)/%.o: $(SRC_DIR)/%.c $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME)
ifeq (x"$(V)", x"0")
@echo "CC $<"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)$(BLD_CC) $(CFLAGS) -D__BASENAME__=`basename $<` -c -o $@ $<
ifeq (x"$(USE_LINT)", x"yes")
ifeq (x"$(V)", x"0")
@echo "LINT $<"
endif
$(SILENT_BUILD)FORCE_LINT=$(FORCE_LINT) $(MAKE_DEVICE_DIR)/lint.sh $(LINT_FLAGS) $(filter -I% -D%, $(CFLAGS)) $< || { rm $@; false; }
endif
ifeq (x"$(USE_CLANG)", x"y")
ifeq (x"$(V)", x"0")
_fn=`basename "$<" .c` ;\
eval "_disable_fn_set=\$${DISABLE_CLANG_$$_fn}"; \
if test "$$_disable_fn_set" != "y" ; then echo "CLANG $<"; else echo "CLANG $< ... skipped"; fi
endif
_fn=`basename "$<" .c` ;\
eval "_disable_fn_set=\$${DISABLE_CLANG_$$_fn}"; \
if test "$$_disable_fn_set" != "y" ; then $(CLANG) $(CLANG_FLAGS) -c $< -o $@.clang && rm -f $@.clang; fi
# ifeq (x"$(USE_CLANG)", x"y")
endif
$(OUT_DIR)/%.o: $(SRC_DIR)/%.s $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME)
ifeq (x"$(V)", x"0")
@echo "AS $<"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)$(BLD_AS) $(asFLAGS) -o $@ $<
$(OUT_DIR)/%.o: $(SRC_DIR)/%.S $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME)
ifeq (x"$(V)", x"0")
@echo "AS $<"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)$(BLD_CC) $(ASFLAGS) -o $@ $<
$(OUT_DIR)/%.d: $(SRC_DIR)/%.c $(SRC_DIR)/Makefile
ifneq ("$(BUILD_DEPS_IN_CC)", "y")
ifeq (x"$(V)", x"0")
@echo "DP $<"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)$(BLD_DEP) -MM -MT $(@:.d=.o) $(DEP_FLAGS) $< > $@ && sed 's,\($*\.o\)[ :]*,\1 $@ : ,g' -i $@
endif
$(CODEGEN_OUTPUT_DIR)/%.o: $(CODEGEN_OUTPUT_DIR)/%.c $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME)
ifeq (x"$(V)", x"0")
@echo "CC $<"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)$(BLD_CC) $(CFLAGS) -D__BASENAME__=`basename $<` -c -o $@ $<
$(CODEGEN_OUTPUT_DIR)/%.d: $(CODEGEN_OUTPUT_DIR)/%.c $(SRC_DIR)/Makefile
ifneq ("$(BUILD_DEPS_IN_CC)", "y")
ifeq (x"$(V)", x"0")
@echo "DP $<"
endif
$(SILENT_BUILD)mkdir -p $(dir $@)
$(SILENT_BUILD)$(BLD_DEP) -MM -MT $(@:.d=.o) $(DEP_FLAGS) $< > $@ && sed 's,\($*\.o\)[ :]*,\1 $@ : ,g' -i $@
endif
ifneq ("$(SKIP_DEPS)", "yes")
ifneq ("$(MOD_TYPE)", "linux_module")
ifneq ("$(MOD_TYPE)", "linux_lib")
-include $(OBJS:.o=.d)
endif
endif
endif
BUILD_UNITEST = $(UNITEST)
ifeq ("$(OBJS)", "")
BUILD_UNITEST = n
endif
ifeq ("$(OS)", "threadx")
BUILD_UNITEST = n
endif
# Only build unitest if library objects are included
ifeq ("$(BUILD_UNITEST)", "y")
unitest: $(OUT_DIR)/unitest
$(OUT_DIR)/unitest: $(OUT_DIR)/unitest.o $(TARGET_LIB_FNAME) $(MOD_DEPS_FILES)
$(SILENT_BUILD)$(BLD_CC) -o $@ $(OUT_DIR)/unitest.o $(LFLAGS) $(EXTRA_LIBS_PATH) $(LIBS_START_MARKER) $(EXTRA_LIBS) $(LIBS_END_MARKER) $(LIBS)
$(SILENT_BUILD)touch $(OUT_DIR_BASE)/.$(MOD_NAME)
@$(BOLD_PRINT) "done: $@"
# else of ifneq ("$(BUILD_UNITEST)", "y")
else
unitest: $(TARGET_LIB_FNAME) $(MOD_DEPS_FILES)
# endif of ifneq ("$(BUILD_UNITEST)", "y")
endif
# Generate version header
MODEL_REVISION_FILE = $(MODEL_OUT_DIR)/bcmolt_model_revision.h
ifneq ("$(RELEASE_BUILD)", "y")
$(MODEL_REVISION_FILE): $(MODEL_FILE)
mkdir -p $(MODEL_OUT_DIR)
@$(TOP_DIR)/scripts/update_model_revision.sh $< $@
# Generate sources if necessary
ifneq ("$(GEN_SRCS)", "")
ifneq ("$(CUSTOM_CODEGEN)", "y")
$(CODEGEN_OUTPUT_DIR)/.generated: $(MODEL_FILE) $(wildcard $(CODEGEN_DIR)/*) $(wildcard $(CODEGEN_INPUT_DIR)/*) $(MODEL_REVISION_FILE)
$(SILENT_BUILD)rm -fr $@
@echo "Generating code in $(CODEGEN_OUTPUT_DIR) from model..."
@mkdir -p $(CODEGEN_OUTPUT_DIR)
$(SILENT_BUILD)$(MONO_PATH) $(CODEGEN_EXE) --genobjmodel -objtags=$(GEN_OBJTAGS) -objset=$(MODEL_FILE) \
$(GEN_EXTRA_TYPES) -templatedir=$(CODEGEN_INPUT_DIR) -outdir=$(CODEGEN_OUTPUT_DIR)
$(SILENT_BUILD)touch $@
@echo "Code generation in $(CODEGEN_OUTPUT_DIR) complete!"
$(GEN_SRCS): $(CODEGEN_OUTPUT_DIR)/.generated
# ifneq ("$(CUSTOM_CODEGEN)", "y")
endif
# ifneq ("$(GEN_SRCS)", "")
endif
# ifneq ("$(RELEASE_BUILD)", "y")
endif
#
# Dependency rules generation: --> Makefile.config.$(MOD_NAME)
#
MOD_CONFIG_FILE = $(OUT_DIR_BASE)/Makefile.config.$(MOD_NAME)
MOD_CONFIG_DEF = $(MOD_NAME)_DEP_DEFINED
ifneq ("$(MOD_INC_DIRS)", "")
# Make sure that each directory is an absolute path
MOD_INCS = $(addprefix -I$(TOP_DIR)/, $(subst $(TOP_DIR)/,,$(MOD_INC_DIRS)))
else
MOD_INCS = -I$(SRC_DIR)
endif
#
# Generate Makefile.config.$(MODULE) capable of re-creating the module
#
moddep: $(GEN_SRCS)
ifeq (x"$(V)", x"3")
@echo "!!!!! moddep for MOD_NAME=$(MOD_NAME) MOD_TYPE=$(MOD_TYPE) MOD_CUSTOM=$(MOD_CUSTOM)!!!"
endif
$(SILENT_BUILD)mkdir -p $(OUT_DIR_BASE)
@rm -fr $(MOD_CONFIG_FILE)
@rm -fr $(OBJS:.o=.d)
@echo "ifeq (x\"$$""(V)\", x\"2\")" >> $(MOD_CONFIG_FILE)
@echo " $$""(info !!! MODULE=$$""(MOD_NAME) --> $(MOD_CONFIG_FILE): $(MOD_CONFIG_DEF)=$$""($(MOD_CONFIG_DEF)), DEPS=$(MOD_DEPS))" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
# Prevent double inclusion
@echo "ifneq (\"$$""($(MOD_CONFIG_DEF))\", \"y\")" >> $(MOD_CONFIG_FILE)
@echo "" >> $(MOD_CONFIG_FILE)
@echo "$(MOD_CONFIG_DEF) := y" >> $(MOD_CONFIG_FILE)
ifeq ("$(MODULE_IS_A_LIBRARY)", "y")
@echo "_skip_it := y" >> $(MOD_CONFIG_FILE)
else
@echo "_skip_it := n" >> $(MOD_CONFIG_FILE)
endif
@echo "ifneq (\"$$""(SKIP_LIB_MODULES)\", \"y\")" >> $(MOD_CONFIG_FILE)
@echo " _skip_it := n" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
@echo "ifneq (\"$$""(_skip_it)\", \"y\")" >> $(MOD_CONFIG_FILE)
ifeq ("$(MODULE_IS_A_LIBRARY)", "y")
ifneq ("$(OBJS)", "")
@echo "EXTRA_LIBS += $(LIBS_MARKER)$(TARGET_LIB)" >> $(MOD_CONFIG_FILE)
@echo "EXTRA_LIBS_PATH += $(LIBS_PATH_MARKER)$(OUT_DIR)" >> $(MOD_CONFIG_FILE)
endif
ifneq ("$(MOD_LIBS)", "")
@echo "EXTRA_LIBS += $(MOD_LIBS)" >> $(MOD_CONFIG_FILE)
endif
@echo "ifneq (x\"$$""(MOD_NAME)\", x\"$(MOD_NAME)\")" >> $(MOD_CONFIG_FILE)
@echo " MOD_DEPS_FILES += $(OUT_DIR_BASE)/.$(MOD_NAME)" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
ifneq ("$(startup_src)", "")
@echo "" >> $(MOD_CONFIG_FILE)
@echo "ENTRY_POINT_SRC = $(SRC_DIR)/$(startup_src)" >> $(MOD_CONFIG_FILE)
@echo "" >> $(MOD_CONFIG_FILE)
endif
endif
ifeq ("$(MOD_TYPE)", "linux_lib")
ifneq ("$(OBJS)", "")
@echo "ALL_LIB_OBJS += $(LINUX_LIB_OBJECTS)" >> $(MOD_CONFIG_FILE)
endif
@echo "ifneq (x\"$$""(MOD_NAME)\", x\"$(MOD_NAME)\")" >> $(MOD_CONFIG_FILE)
@echo " MOD_DEPS_FILES += $(OUT_DIR_BASE)/.$(MOD_NAME)" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
endif
ifeq ("$(MOD_TYPE)", "linux_module")
@echo "ifneq (x\"$$""(MOD_NAME)\", x\"$(MOD_NAME)\")" >> $(MOD_CONFIG_FILE)
@echo " KBUILD_EXTRA_SYMBOLS += $(SRC_DIR)/Module.symvers" >> $(MOD_CONFIG_FILE)
@echo " MOD_DEPS_FILES += $(OUT_DIR_BASE)/.$(MOD_NAME)" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
endif
# Module creation rules
@echo "$(MOD_NAME)_$(SUBSYSTEM): $(OUT_DIR_BASE)/.$(MOD_NAME)" >> $(MOD_CONFIG_FILE)
@echo "" >> $(MOD_CONFIG_FILE)
@echo "$(OUT_DIR_BASE)/.$(MOD_NAME): .FORCE" >> $(MOD_CONFIG_FILE)
ifeq ("$(MOD_CUSTOM)", "y")
@echo " $$""(MAKE) MOD_DIR=$(MOD_DIR) -f $(MAKE_DIR)/Makefile.template $(MOD_TARGET)" >> $(MOD_CONFIG_FILE)
else
ifneq ("$(OBJS)", "")
@echo " $$""(MAKE) MOD_DIR=$(MOD_DIR) -f $(MAKE_DIR)/Makefile.template $(MOD_TARGET)" >> $(MOD_CONFIG_FILE)
endif
ifeq ("$(OBJS)", "")
@echo " if [ ! -f $(OUT_DIR_BASE)/.$(MOD_NAME) ]; then touch $(OUT_DIR_BASE)/.$(MOD_NAME); fi" >> $(MOD_CONFIG_FILE)
endif
endif
@echo "" >> $(MOD_CONFIG_FILE)
@echo ".FORCE:" >> $(MOD_CONFIG_FILE)
@echo "" >> $(MOD_CONFIG_FILE)
ifneq ("$(MOD_DEFS)", "")
@echo "EXTRA_CFLAGS += $(MOD_DEFS)" >> $(MOD_CONFIG_FILE)
endif
@echo "endif" >> $(MOD_CONFIG_FILE)
# If it is a library and this file is included as someone's dependency - extend MOD_DEP_FULL_NAMES
# and generate a rule to rebuilt the library
ifneq ("$(MOD_DEPS)", "")
@echo "ifeq (x\"$$""(V)\", x\"2\")" >> $(MOD_CONFIG_FILE)
@echo " $$""(info !!! Now include dependencies $(MOD_DEPS))" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
@echo "$(MOD_NAME)_MOD_DEPS = $(MOD_DEPS)" >> $(MOD_CONFIG_FILE)
@echo "ifneq (x\"$$""(SKIP_DEPS)\", x\"yes\")" >> $(MOD_CONFIG_FILE)
@echo "include $$""($(MOD_NAME)_MOD_DEPS:%=$(OUT_DIR_BASE)/Makefile.config.%)" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
@echo "ifeq (x\"$$""(V)\", x\"2\")" >> $(MOD_CONFIG_FILE)
@echo " $$""(info !!! $(MOD_NAME) finished including dependencies)" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
endif
@echo "EXTRA_CFLAGS += $(MOD_INCS)" >> $(MOD_CONFIG_FILE)
@echo "" >> $(MOD_CONFIG_FILE)
@echo "endif" >> $(MOD_CONFIG_FILE)
#
# end of moddep: target
#
clean_module:
ifeq ("$(MOD_TYPE)", "linux_module")
$(SILENT_BUILD)-test -f $(SRC_DIR)/Makefile && $(MAKE) $(KERNEL_MAKEPARMS) clean
$(SILENT_BUILD)cd $(SRC_DIR) && rm -fr $($(MOD_NAME)-objs) $($(MOD_NAME)-objs:../%=../.%.cmd)
$(SILENT_BUILD)rm -fr $(OUT_DIR_BASE)/linux_modules/$(MOD_NAME).ko
endif
ifeq ("$(MOD_TYPE)", "linux_lib")
$(SILENT_BUILD)rm -fr $(LINUX_LIB_OBJECTS)
endif
$(SILENT_BUILD)cd $(SRC_DIR) && rm -fr $(patsubst %.c,.%.o.cmd,$(srcs))
$(SILENT_BUILD)[ ! -d $(OUT_DIR) ] || find $(OUT_DIR) -name '*.[o,d,a]' -print0 | xargs -0 rm -rf
$(SILENT_BUILD)[ ! -d $(OUT_DIR) ] || find $(OUT_DIR) -name '*~' -print0 | xargs -0 rm -rf
$(SILENT_BUILD)[ ! -d $(OUT_DIR) ] || find $(OUT_DIR) -name '*.ko' -print0 | xargs -0 rm -rf
$(SILENT_BUILD)[ ! -d $(OUT_DIR) ] || find $(OUT_DIR) -name '.*.cmd' -print0 | xargs -0 rm -rf
$(SILENT_BUILD)rm -fr $(SRC_DIR)/*.mod.c $(SRC_DIR)/modules.order $(SRC_DIR)/Module.symvers $(SRC_DIR)/.tmp_versions
$(SILENT_BUILD)rm -fr $(MOD_TARGET) $(OUT_DIR)/$(TARGET) $(OUT_DIR)/unitest $(TARGET_LIB_FNAME)
$(SILENT_BUILD)rm -fr $(ALL_LIB_OBJS)
$(SILENT_BUILD)rm -fr $(GEN_SRCS) $(CODEGEN_OUTPUT_DIR)/.generated
ifneq ("$(MOD_NAME)", "")
$(SILENT_BUILD)rm -fr $(OUT_DIR_BASE)/.$(MOD_NAME)
$(SILENT_BUILD)rm -fr $(SRC_DIR)/.$(MOD_NAME)_in_progress
endif
clobber: clean_module
$(SILENT_BUILD)rm -fr $(OUT_DIR)
# Optional platform-specific rules
-include $(MAKE_DEVICE_DIR)/Makefile.$(SUBSYSTEM).rules
# Generate board-specific environment if any
board_env: $(BOARD_ENV_RULE)
module_name:
$(info $(MOD_NAME))