Created
January 25, 2022 21:15
-
-
Save Dragonink/e05c91e4b703016497eb46a2c11cd427 to your computer and use it in GitHub Desktop.
Util Makefile snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # DEBUG VARIABLE FUNCTION | |
| # | |
| # USAGE: $(call debug,<var_name>) | |
| # <var_name> is the identifier of the variable to debug | |
| # | |
| # EXAMPLE: | |
| # $(call debug,ARCH) print "ARCH = x86" provided the variable ARCH has the value "x86" | |
| debug = $(info $1 = $($1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # RECURSIVE WILDCARD FUNCTION | |
| # | |
| # USAGE: $(call rwildcard,<rootdir>,<wildcard>) | |
| # <rootdir> is the directory from which to start the search (empty for current directory) | |
| # <wilcard> is the argument of the standard wilcard function | |
| # | |
| # EXAMPLES: | |
| # $(call rwildcard,,*.c *.h) search all .c and .h files from the current directory | |
| # $(call rwdilcard,src/,*.ts) search all *.ts files from the src/ directory | |
| rwildcard = $(strip $(foreach d,$(wildcard $(patsubst %/,%,$1)/*),$(filter $(subst *,%,$2),$(d)) $(call rwildcard,$(d)/,$2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment