refactor(make): reorganize targets and improve locking mechanism
1. Introduce a “project lock” mechanism alongside the existing “build lock”; the lock file is now generated within the platform-specific Makefile. 2. Set `project` as the default Makefile goal for consistency. 3. Remove the `standalone` target to improve compatibility, especially when invoked via `make -f`. 4. Simplify target dependencies for better maintainability and clarity.
This commit is contained in:
+10
-29
@@ -45,7 +45,8 @@ endif
|
|||||||
# COMMON INITIALIZATION
|
# COMMON INITIALIZATION
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
PLATFORM_TOOLS = $(SCRIPT_DIR)/platform/$(PLATFORM)
|
PLATFORM_TOOLS = $(SCRIPT_DIR)/platform/$(PLATFORM)
|
||||||
BUILD_LOCK = $(BUILD_DIR)/.project.lock
|
BUILD_LOCK = $(BUILD_DIR)/.build.lock
|
||||||
|
PROJECT_LOCK = $(BUILD_DIR)/.project.lock
|
||||||
|
|
||||||
ifeq ('xilinx', '$(PLATFORM)')
|
ifeq ('xilinx', '$(PLATFORM)')
|
||||||
include $(PLATFORM_TOOLS)/xilinx.mk
|
include $(PLATFORM_TOOLS)/xilinx.mk
|
||||||
@@ -56,43 +57,23 @@ endif
|
|||||||
# Generic Goals
|
# Generic Goals
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.DEFAULT_GOAL := all
|
PHONY := clean reset project build sdkopen
|
||||||
PHONY += all
|
.DEFAULT_GOAL := project
|
||||||
ifneq ($(wildcard $(BUILD_LOCK)),)
|
|
||||||
all:
|
|
||||||
@$(call print_build_type,$(PLATFORM))
|
|
||||||
$(MAKE) --no-print-directory build
|
|
||||||
@$(call print,Done ($(notdir $(BUILD_DIR))))
|
|
||||||
else
|
|
||||||
all:
|
|
||||||
@$(call print_build_type,$(PLATFORM))
|
|
||||||
$(MAKE) --no-print-directory project
|
|
||||||
$(MAKE) --no-print-directory build
|
|
||||||
@$(call print,Done ($(notdir $(BUILD_DIR))))
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
# Create project using corresponding SDK
|
||||||
project: $(PLATFORM)_project
|
project: $(PLATFORM)_project
|
||||||
@echo "$(TIMESTAMP): Build lock." > $(BUILD_LOCK)
|
|
||||||
|
|
||||||
standalone:
|
# Build project using corresponding compiler
|
||||||
$(MAKE) --no-print-directory project LINK_SRCS=n
|
build: project $(PLATFORM)_sdkbuild
|
||||||
|
|
||||||
# Build project using generic compiler
|
|
||||||
build: $(PLATFORM)_sdkbuild
|
|
||||||
|
|
||||||
# Open the project using the corresponding SDK
|
# Open the project using the corresponding SDK
|
||||||
sdkopen: $(PLATFORM)_sdkopen
|
sdkopen: project $(PLATFORM)_sdkopen
|
||||||
|
|
||||||
# Remove build artefacts
|
# Remove build artefacts
|
||||||
PHONY += clean
|
|
||||||
ifneq ($(wildcard $(BUILD_LOCK)),)
|
ifneq ($(wildcard $(BUILD_LOCK)),)
|
||||||
clean:
|
clean: $(PLATFORM)_sdkclean
|
||||||
@$(call log,Cleaning sdk build uploaded to board)
|
|
||||||
$(MAKE) --no-print-directory $(PLATFORM)_sdkclean
|
|
||||||
else
|
else
|
||||||
clean:
|
clean: reset
|
||||||
@$(call log,No project found, cleaning dummy files)
|
|
||||||
$(MAKE) --no-print-directory reset
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Remove the whole build directory
|
# Remove the whole build directory
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ define tcl_util
|
|||||||
$(CONFIG_FILE) $(BUILD_DIR)
|
$(CONFIG_FILE) $(BUILD_DIR)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
PHONY += xilinx_reset xilinx_project xilinx_sdkclean xilinx_sdkbuild
|
||||||
|
|
||||||
xilinx_sdkopen:
|
xilinx_sdkopen:
|
||||||
@$(call log,Launching IDE...)
|
@$(call log,Launching IDE...)
|
||||||
@if [ "$(call check_command,vitis)" = "y" ]; then \
|
@if [ "$(call check_command,vitis)" = "y" ]; then \
|
||||||
@@ -21,19 +23,22 @@ xilinx_sdkopen:
|
|||||||
echo "No IDE found!" && exit 1; \
|
echo "No IDE found!" && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PHONY += xilinx_sdkbuild
|
|
||||||
xilinx_sdkbuild:
|
xilinx_sdkbuild:
|
||||||
@$(call log,[Build] SDK projects in $(BUILD_DIR))
|
@$(call log,[Build] SDK projects in $(BUILD_DIR))
|
||||||
$(call tcl_util, build) $(HIDE)
|
$(call tcl_util, build) $(HIDE)
|
||||||
|
@echo "$(TIMESTAMP): Build lock." > $(BUILD_LOCK)
|
||||||
|
|
||||||
xilinx_sdkclean:
|
xilinx_sdkclean:
|
||||||
@$(call log,[Delete] SDK artefacts from $(BUILD_DIR))
|
@$(call log,[Delete] SDK artefacts from $(BUILD_DIR))
|
||||||
$(call tcl_util, clean_project) $(HIDE)
|
$(call tcl_util, clean_project) $(HIDE)
|
||||||
|
|
||||||
xilinx_project:
|
$(XILINX_PROJECT_LOCK):
|
||||||
@$(call print,Creating and configuring the IDE project)
|
@$(call log,Creating and configuring the IDE project)
|
||||||
$(call mk_dir,$(BUILD_DIR))
|
@$(call cmd_mkdir,$(BUILD_DIR))
|
||||||
$(call tcl_util, create_project) $(HIDE)
|
$(call tcl_util, create_project) $(HIDE)
|
||||||
|
@echo "$(TIMESTAMP): Project lock." > $@
|
||||||
|
|
||||||
|
xilinx_project: $(PROJECT_LOCK)
|
||||||
|
|
||||||
xilinx_reset:
|
xilinx_reset:
|
||||||
$(call cmd_remove,.Xil) $(HIDE)
|
$(call cmd_remove,.Xil) $(HIDE)
|
||||||
Reference in New Issue
Block a user