YB_Platform/public/make/makefile.lib
2023-07-13 11:27:03 +08:00

79 lines
2.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ==============================================================================
# lib makefile
#FileName makefile
#Author: xianfeng.du
#Data 2022-08-10
#Description: extract libxxx.a to xxx.o
# ==============================================================================
VERSION = 1.00
# ==============================================================================
# include common makefile Rules
# ==============================================================================
#$(info "MAKE_DIR"=$(MAKE_DIR))
include $(MAKE_DIR)/makefile.config
include $(MAKE_DIR)/makefile.toolchain
# ==============================================================================
# files DIR definition
# ==============================================================================
#$(info DIR_LIB=$(DIR_LIB))
DIR_APE := $(DIR_LIB)/ape_spu
DIR_Common := $(DIR_LIB)/common
DIR_RFM := $(DIR_LIB)/rfm_spu
LIB_APE_DIRS := $(DIR_APE) $(DIR_Common)
LIB_RFM_DIRS := $(DIR_RFM) $(DIR_Common)
#Flatten files
LIB_ABS_APE_DIRS := $(foreach d,$(LIB_APE_DIRS),$(abspath $(d)))
LIB_APE_FILES := $(foreach d,$(LIB_ABS_APE_DIRS),$(wildcard $(d)/*.a))
LIB_ABS_RFM_DIRS := $(foreach d,$(LIB_RFM_DIRS),$(abspath $(d)))
LIB_RFM_FILES := $(foreach d,$(LIB_ABS_RFM_DIRS),$(wildcard $(d)/*.a))
# ==============================================================================
# Variables: Output Files
# ==============================================================================
APE_TARGET_DIR := $(DIR_LIB)/lib/ape_spu
RFM_TARGET_DIR := $(DIR_LIB)/lib/rfm_spu
# ==============================================================================
# Rules: extract
# ==============================================================================
$(APE_TARGET_DIR):
# @echo "# Creating directory $@"
mkdir -p $@
@for list in $(LIB_APE_FILES); \
do \
# echo $$list; \
ar -x $$list; \
mv *.o $@; \
done
$(RFM_TARGET_DIR):
# @echo "# Creating directory $@"
mkdir -p $@
@for list in $(LIB_RFM_FILES); \
do \
# echo $$list; \
ar -x $$list; \
mv *.o $@; \
done
# ==============================================================================
# Rules: Targets
# ==============================================================================
.DEFAULT_GOAL := all
.PHONY: build clean
all: build
build: $(APE_TARGET_DIR) $(RFM_TARGET_DIR)
# $(eval export APE_OBJ_LIB := $(wildcard $(APE_TARGET_DIR)/*.o))
# $(eval export RFM_OBJ_LIB := $(wildcard $(RFM_TARGET_DIR)/*.o))
# @echo "# APE_OBJ_LIB:$(APE_OBJ_LIB)"
# @echo "# RFM_OBJ_LIB:$(RFM_OBJ_LIB)"
clean:
@echo "deleted all files"
rm -rf $(BUILD_DIR)