This shows you the differences between two versions of the page.
gnumake [2016/01/07 01:49] |
gnumake [2023/12/02 23:36] (current) rzr |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | |||
+ | * https://gist.github.com/rueycheng/42e355d1480fd7a33ee81c866c7fdf78 | ||
+ | |||
+ | ===== verbose ===== | ||
+ | |||
+ | how to print invocated commands including non echoed ones "@foo" ? | ||
+ | make -n | ||
+ | but dont invocated them : | ||
+ | * http://www.gnu.org/software/make/manual/html_node/Echoing.html#Echoing | ||
+ | |||
+ | Solution : | ||
+ | remake -d | ||
+ | |||
+ | This helped to hack [[autotools]] [[makefile]]s | ||
+ | * http://packages.qa.debian.org/r/remake.html | ||
+ | |||
+ | |||
+ | ===== ENV ===== | ||
+ | |||
+ | If you need only a few known variables exporting in makefile can be an option, here is an example of what I am using. | ||
+ | |||
+ | $ grep ID /etc/os-release | ||
+ | |||
+ | ID=ubuntu | ||
+ | ID_LIKE=debian | ||
+ | |||
+ | |||
+ | $ cat Makefile | ||
+ | |||
+ | default: help rule/setup/lsb | ||
+ | |||
+ | source?=. | ||
+ | |||
+ | help: | ||
+ | -${MAKE} --version | head -n1 | ||
+ | |||
+ | rule/setup/%: | ||
+ | echo ID=${@F} | ||
+ | |||
+ | rule/setup/lsb: /etc/os-release | ||
+ | ${source} $< && export ID && ${MAKE} rule/setup/$${ID} | ||
+ | |||
+ | |||
+ | $ make | ||
+ | |||
+ | make --version | head -n1 | ||
+ | GNU Make 3.81 | ||
+ | . /etc/os-release && export ID && make rule/setup/${ID} | ||
+ | make[1]: Entering directory `/tmp' | ||
+ | echo ID=ubuntu | ||
+ | ID=ubuntu | ||
+ | |||
+ | * http://stackoverflow.com/questions/7507810/howto-source-a-script-from-makefile | ||
+ | |||
+ | |||
+ | ===== paths ===== | ||
+ | |||
+ | [[VPATH]] : | ||
+ | * http://www.gnu.org/software/autoconf/manual/make/General-Search.html#General-Search | ||
+ | |||
+ | OBJ_DIRS?=$(shell find . -iname "*.o" | sed -e "s|\(.*\)/.*|\1|g" | sort | uniq | tr '\n' ':') | ||
+ | VPATH=${OBJ_DIRS} | ||
+ | |||
+ | show-vpath: ${OBJS} | ||
+ | echo "VPATH=" | ||
+ | echo ${^D} | tr ' ' '\n' | sort | uniq | tr '\n' ':' " | ||
+ | |||
+ | |||
+ | ===== regex ===== | ||
+ | |||
+ | [[RegEx]] : | ||
+ | |||
+ | test: ${CURDIR} | ||
+ | echo ${<:%-1.0.0=%} | ||
+ | echo ${<:%-1.0.0=%-snapshot} | ||
+ | echo ${<:%-%=%-snapshot} | ||
+ | echo ${<:%-1.0.0=%-snapshot} | ||
+ | install-libs: ${modules_jni} | ||
+ | echo ${^:TuxGuitar-%=tuxguitar-%} | ||
+ | for t in ${^} ; do \ | ||
+ | echo install -s $$t/$${t/TuxGuitar/tuxguitar} \ | ||
+ | ; done | ||
+ | |||
+ | ===== install ====== | ||
+ | |||
+ | install-list: | ||
+ | find . -type f -perm -u+x -exec file '{}' \; | ||
+ | |||
+ | |||
+ | ===== ERROR ===== | ||
+ | |||
+ | " *** target pattern contains no `%'. Stop." | ||
+ | |||
+ | pwd | grep ':' | ||
+ | |||
+ | Message : | ||
+ | |||
+ | # rzr@lap:linux/ # [0] # make | ||
+ | Makefile:129: *** multiple target patterns. Stop. | ||
+ | |||
+ | |||
+ | Cause : | ||
+ | |||
+ | # rzr@lap:linux/ # [0] # pwd | ||
+ | /home/rzr/var/cache/url/git/ssh/git@github.com:/rzr/linux/src/linux | ||
+ | |||
+ | Solution : | ||
+ | |||
+ | # rzr@lap:ssh/ # [0] # mv git\@github.com\: git\@github.com/ | ||
+ | |||
+ | ===== MISC ===== | ||
+ | |||
+ | * http://blog.jgc.org/2015/03/gnu-make-insanity-finding-value-of-j.html# SmP | ||
+ | * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/introduction-to-redo.html# IncrementaL | ||
+ | * http://www.olioapps.com/blog/the-lost-art-of-the-makefile/# JavaScript | ||
+ | |||
+ | |||
+ | ===== MORE ===== | ||
+ | |||
+ | @TaG: MakE ProgrammingTool TooL GnU MakE | ||
+ | |||
+ | |||