diff --git a/Makefile b/Makefile index 28694873d966bc72414e76474c4eb7d964fa7e82..12629ca7dcffd1ce0da9c8252b557c0b8215a20d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -MK_DESCRIPTION="This provides some additional tools for makefiles." -MK_LICENSE="Released under the BSD two-clause license, see the LICENSE file for more information." -MK_ASSURE="python3 ls tree clang" +MEX_DESCRIPTION="This provides some additional tools for makefiles." +MEX_LICENSE="Released under the BSD two-clause license, see the LICENSE file for more information." +MEX_ASSURE="python3 ls tree clang" include makext.mk diff --git a/README.md b/README.md index 5f8fd865e6c8be78d34043c7932c4cb39e9b8f62..ada9a43ec85711062f42776102143dd97029ad47 100644 --- a/README.md +++ b/README.md @@ -93,22 +93,22 @@ ## Description & License information You can provide description for the project that will be displayed together with `help`. To do this provide this information in the -`MK_DESCRIPTION` variable. +`MEX_DESCRIPTION` variable. Same goes for license information. Provide this information by creating -`MK_LICENSE` variable. +`MEX_LICENSE` variable. If these variables are not present this information will not be displayed in the help. > [!IMPORTANT] -> Variables `MK_DESCRIPTION` and `MK_LICENSE` must be defined before you +> Variables `MEX_DESCRIPTION` and `MEX_LICENSE` must be defined before you > include `makext.mk` to your `Makefile`. This is needed because the way > GNU Make is parsing Makefiles. ```make -MK_DESCRIPTION="This provides some additional tools for makefiles." -MK_LICENSE="Released under the BSD two-clause license, see the LICENSE file for more information." +MEX_DESCRIPTION="This provides some additional tools for makefiles." +MEX_LICENSE="Released under the BSD two-clause license, see the LICENSE file for more information." include makext.mk @@ -143,7 +143,7 @@ be used. If programs are missing recipes can only partially be executed leaving project in a potentially broken state. ```make -MK_ASSURE="python3 ls tree clang" +MEX_ASSURE="python3 ls tree clang" include makext.mk @@ -152,7 +152,7 @@ @echo "Building the application..." ``` `.assure` prerequisite will loop over the list of programs defined in -`MK_ASSURE` variable and in case one is missing will exit `make` with +`MEX_ASSURE` variable and in case one is missing will exit `make` with status code error 1. This will stop executing the recipe and therefore not execute anything in target `build-app`. diff --git a/makext.mk b/makext.mk index b4846c0d437706991f49b231f4e2821a677761d0..99cba0a6f41ef5122cc9ec7b33540d1b352021db 100644 --- a/makext.mk +++ b/makext.mk @@ -24,23 +24,23 @@ # Help extension that lists all the targets with descriptions # and adds description and license information if data provided. .PHONY: .help .help: -ifdef MK_DESCRIPTION - @echo "$(MK_DESCRIPTION)\n" | fmt +ifdef MEX_DESCRIPTION + @echo "$(MEX_DESCRIPTION)\n" | fmt endif @echo "Targets:" @grep -vE '^[[:space:]]' $(MAKEFILE_LIST) | grep -E '^.*:.* #' | sed -E 's/(.*):(.*):.*#(.*)/ \2###\3/' | column -t -s '###' -ifdef MK_LICENSE - @echo "\n$(MK_LICENSE)" | fmt +ifdef MEX_LICENSE + @echo "\n$(MEX_LICENSE)" | fmt endif -# Checks `MK_ASSURE` variable if all the programs declared actually +# Checks `MEX_ASSURE` variable if all the programs declared actually # exist on a machine. If not this exists make with error. .PHONY: .assure .assure: -ifndef MK_ASSURE - @echo "Variable MK_ASSURE is not defined. Can not check for programs." +ifndef MEX_ASSURE + @echo "Variable MEX_ASSURE is not defined. Can not check for programs." else - @for prog in $(shell echo $(MK_ASSURE)); do \ + @for prog in $(shell echo $(MEX_ASSURE)); do \ if ! which $$prog > /dev/null; then \ echo "Error: '$$prog' not found on this machine."; \ exit 1; \