Files
kunlun/import/Makefile

75 lines
1.5 KiB
Makefile
Raw Normal View History

2024-09-28 14:24:04 +08:00
# OUTPUT type
# 1 - .out
# 2 - .a
# 3 - .so
OUTPUT_TYPE = 2
OUTPUT_NAME = import
SUB_DIRS = sby
ifeq ($(target), kunlun3)
ifeq ($(build_amp_type), 1)
OUTDIR = .output/cus
else
OUTDIR = .output/plc
endif
else
OUTDIR = .output
endif
# obj output folder
BIN_DIR = $(OUTDIR)/obj
# image output folder
OUTPUT_DIR = $(OUTDIR)/lib
# lib
LIB = $(CURDIR)/sby/lib/libsby.a
#CC = riscv32-unknown-elf-gcc
# if risc-v
ifeq ($(CC), riscv32-unknown-elf-gcc)
AR = riscv32-unknown-elf-ar
endif
ifeq ($(CC), riscv64-unknown-elf-gcc)
AR = riscv64-unknown-elf-ar
endif
# create the output folder
$(BIN_DIR)/.sub_dirs: $(BIN_DIR) $(OUTPUT_DIR)
cp $(LIB) $(OUTPUT_DIR)/
$(OUTPUT_DIR):
$(shell if [ -n "$(OUTPUT_DIR)" -a ! -e "$(OUTPUT_DIR)" ];then mkdir -p $(OUTPUT_DIR); fi )
$(BIN_DIR):
$(shell if [ -n "$(BIN_DIR)" -a ! -e "$(BIN_DIR)" ];then mkdir -p $(BIN_DIR); fi)
# create the output folder
$(OUTPUT_FULL_NAME): $(BIN_DIR)/.sub_dirs
# dummy object
.PHONY: clean $(OUTPUT_FULL_NAME)
# clean all
clean:
-$(RM) -r $(OUTDIR)
# display the obj files and output name
debug:
@echo TOPDIR=$(TOPDIR)
@echo OUTPUT_DIR=$(OUTPUT_DIR)
@echo OUTPUT_MAP=$(OUTPUT_MAP)
@echo OUTPUT_LIB=$(OUTPUT_FULL_NAME)
@echo DEPS=$(DEPS)
@echo OBJECTS=$(OBJECTS)
@echo SRCS=$(SRCS)
@echo OBJECTS folder=$(foreach dirname, $(SUB_DIRS), $(addprefix $(BIN_DIR)/, $(dirname)))
@echo output_name=$(OUTPUT_FULL_NAME)
@echo LINK_LIBS=$(LINK_LIBS)
@echo MAKEDEP=$(MAKEDEP)
@echo CC=$(CC)
@echo AR=$(AR)