You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.6 KiB

#
# Copyright (c) 2021 Phytium Information Technology, Inc.
#
# SPDX-License-Identifier: Apache-2.0.
#
# @Date: 2021-06-02 11:03:35
# @LastEditTime: 2021-06-02 11:39:19
# @Description:  This files is for pack mini source code for building
#
# make pack OUTPATH=/mnt/d/6-2021
#
# @Modify History:
# Ver   Who        Date         Changes
# ----- ------     --------    --------------------------------------
#
ifeq ($(MAKECMDGOALS),pack)
ifndef OUTPATH
$(error error, please type in 'make pack OUTPATH=<dir>'!!)
endif
DST_PACK_PATH ?= $(OUTPATH)/$(CONFIG_TARGET_NAME)
TAR_PACK_PATH ?= $(OUTPATH)/$(CONFIG_TARGET_NAME).tar.gz
# remove cur dir '.'
EXCL_PATH ?= .
SRC_PACK_PATH := $(filter-out $(EXCL_PATH), $(SRC_DIR))
# add common dir for pack
SRC_PACK_PATH += $(STANDALONE_DIR) \
$(STANDALONE_DIR)/make \
$(STANDALONE_DIR)/ \
$(STANDALONE_DIR)/lib \
$(PWD)
# filter src files if you do not need
SRC_PACK_FILES ?= $(foreach dir, $(SRC_PACK_PATH), $(wildcard $(dir)/*))
endif
pack:
$(foreach dir, $(SRC_PACK_PATH), if [ -d $(dir) ]; then sudo mkdir -p $(dir) $(dir:$(STANDALONE_DIR)/%=$(DST_PACK_PATH)/%);fi;)
$(foreach file, $(SRC_PACK_FILES), if [ -f $(file) ]; then sudo cp -f $(file) $(file:$(STANDALONE_DIR)/%=$(DST_PACK_PATH)/%);fi;)
$(shell sudo tar -zcvf $(TAR_PACK_PATH) $(DST_PACK_PATH))
@echo "*****************************"
@echo "source code from: " $(SRC_PACK_PATH)
@echo "*****************************"
@echo "source copy to: " $(DST_PACK_PATH)
@echo "*****************************"
@echo "pack source code as: " $(OUTPATH)/$(CONFIG_TARGET_NAME).tar.gz