help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dependencies for clean rule


From: Kaz Kylheku (gmake)
Subject: Re: Dependencies for clean rule
Date: Wed, 17 Jul 2019 11:11:10 -0700
User-agent: Roundcube Webmail/0.9.2

On 2019-07-17 04:17, Christian Hujer wrote:
2. Use $(RM) instead of rm
For removing files, use $(RM). It is more portable, and it expands to rm
-f, not just rm.
So you don't have to worry about files that do not exist.

By the time we reach the level of portability where we are worried
about not having an "rm" command, we have long passed the point
that we can use any GNU-Make-specific feature.

When would we have GNU Make, yet not have an environment which either
provides a POSIX "rm" natively, or via GNU Coreutils?

However, $(RM) is actually GNU-Make-specific. I don't see it in POSIX!

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html#tag_20_76_13_09

Thus, in portable Makefiles, we must actually avoid relying on $(RM);
if we use it, we have to check that it doesn't exist and define it
in that case.

If the program needs POSIX APIs, should the build system worry about
not having rm? (Maybe for cross-compiling: say we want to target a Linux
embedded system with glibc, but our build machine might be an IBM mainframe
with OS/370, or a DEC VAX with VMS?)

How far do we have go with this? $(CAT), $(SED), $(GREP), $(MV), $(CP), ...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]