Skip to content

Commit

Permalink
<Make> Upgraded builder
Browse files Browse the repository at this point in the history
- `make clean` is no longer a valid target
- `make <project> clean` is valid target, this change is made
  to keep other build safe.
- Add new target to clean up workspace `make clean_workspace`
- Upgraded project builder to validate targets more effectively
  • Loading branch information
akashkollipara committed Aug 1, 2024
1 parent 7c8831e commit 68c9e20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions mk/help.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Usage: make [<project_name>|default|...] (V=|PP=|...)\n\
\n\
Examples:\n\
$$ make demo_avr \# Builds project demo_avr\n\
$$ make clean \# Cleans the build out folder \n\
$$ make demo_avr clean \# Cleans demo_avr build\n\
$$ make demo_avr V=1 \# Builds demo_avr with verbose\n\
$$ make list \# Displays all the available projects\n\
$$ make get_all_tc \# Fetches all toolchains\n\
Expand Down Expand Up @@ -54,7 +54,7 @@ passed. This uses multi threaded build.\n\
Use this for debug as it will be slow than default.\n\
~ clean: Cleans the project build artifacts.\n\
~ check: Perform static analysis.\n\
clean: Cleans all the build artifacts.\n\
clean_workspace: Cleans workspace to new checkout state.\n\
list: Displays all the projects available for build.\n\
get_all_tc: Fetches all Toolchains.\n\
get_avr_tc: Fetches AVR Toolchain.\n\
Expand Down
2 changes: 1 addition & 1 deletion mk/path.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ OUT ?= $(OUT_PATH)/$(PROJECT)

GET_PATH = $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))

./%/:
%/:
mkdir -p $@
10 changes: 5 additions & 5 deletions mk/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ include mk/mk_helper.mk
include mk/qemu.mk
include mk/picotool.mk

P_TARGETS += default cyancore check version copy_to_remote clean_remote
T_ALLOWLIST += list clean all_projects clean_workspace setup_workspace
P_TARGETS += default cyancore check version copy_to_remote clean_remote clean
T_ALLOWLIST += list all_projects clean_workspace setup_workspace
PROJECT_LIST := $(shell ls projects/ -I *.template -I *.src)

.PHONY: aux_target
Expand All @@ -44,7 +44,7 @@ setup_workspace: | --install_os_pkgs $(SIZE) get_all_tc

clean_workspace: clean
$(info < / > Cleaning up workspace ...)
rm -rf $(CCACHE_DIR) $(TOOLS_ROOT)
rm -rf $(OUT_PATH) $(CCACHE_DIR) $(TOOLS_ROOT)

list:
$(info Available projects are :)
Expand All @@ -56,8 +56,8 @@ copy_to_remote: --cpremote
clean_remote: --rmremote


ifeq ($(findstring $(MAKECMDGOALS),$(T_ALLOWLIST)),)
ifeq ($(findstring $(firstword $(MAKECMDGOALS)),$(P_TARGETS)),)
ifeq ($(filter $(MAKECMDGOALS),$(T_ALLOWLIST)),)
ifeq ($(filter $(firstword $(MAKECMDGOALS)),$(P_TARGETS)),)
PROJECT ?= $(firstword $(MAKECMDGOALS))
CMD := $(word 2,$(MAKECMDGOALS))
ifeq ($(CMD),)
Expand Down

0 comments on commit 68c9e20

Please sign in to comment.