2 ms·
I guess you're talking about the Plan 9 tool: https://9fans.github.io/plan9port/man/man1/mk.html https://9fans.github.io/plan9port/man/man1/mk.html The GNU ma
by chubot 6y ago
I guess you're talking about the Plan 9 tool:
https://9fans.github.io/plan9port/man/man1/mk.html https://9fans.github.io/plan9port/man/man1/mk.html
The GNU make pattern rules are OK, but they don't handle some pretty simple scenarios I've encountered in practice.
One was building the Oil shell blog, where the names of the posts are dynamic, and not hard-coded in the make file.
The other one is build variants. Say I have a custom tool with a flag. I want to build:
- two binaries: oil and opy
- two variants, opt and dbg
I want them to look like:
_build/oil.opt
_build/oil.dbg
_build/opy.opt
_build/opy.dbg
The % pattern rules apparently can't handle this. You need some kind of Turing complete "metaprogramming". (CMake and autoconf offer that, but mostly for different reasons.)
This is a real problem that came up in: https://github.com/oilshell/oil/blob/master/Makefile https://github.com/oilshell/oil/blob/master/Makefile
I plan to switch to a generated Ninja script to solve some of these problems.