|
|
|
|
|
by ainar-g
2231 days ago
|
|
One person's obtuseness is other person's simplicity :-) . In all of my
personal and some of my work projects I used nothing but portable
features in Shell, Make, Sed, etc. Checking with multiple
implementations where possible. As long as you use the right tool for
the right job, there shouldn't be any problems. The most common mistake of that sort that I've seen is people trying to
do complex conditionals inside their makefiles when they clearly would
be better off in a Shell script. (I'm looking at you, fans of ifeq.) |
|
Once POSIX standardizes "!=" then POSIX-portable conditionals will be possible using the same technique as above, replacing, e.g. OS = $(shell $(OS.exec))$(OS.exec:sh) with just OS != $(OS.exec). Though, you'd need to wait for Solaris, AIX, and macOS gmake[1] to add support for !=.
Alternatively, if you add an extra level of indirection using .DEFAULT to capture and forward make invocations, you can simply pass OS, etc, as invocation arguments. Indirection solves everything, though, so that's cheating.
[1] Apple's ancient GNU Make 3.81 predates != support. :(