|
From: | Martin Dorey |
Subject: | Re: Feature request / patch: dependency-only prerequisites |
Date: | Fri, 5 Jul 2019 21:44:15 +0000 |
> The
target certainly also depends on the compiler frontend, the linker backend and the Makefile itself
It's unimaginable that it doesn't depend on compiler libraries and myriad compiler-provided header files too. Using header files in a compilation example would make the $(filter ...) solution less tenable, strengthening your case. Sadly, though, adding all
these things to the dependency list won't really help me. We installed this system just three days ago, yet the mtime on stdio.h is months ago:
devadmin@ch-ep1-3:~$ ls -l /usr/include/stdio.h
-rw-r--r-- 1 root root 31494 Feb 6 21:17 /usr/include/stdio.h
devadmin@ch-ep1-3:~$
That dates from when upstream built the package that included it:
If you decide to press on, then I have three minor suggestions:
> the newly introduced
GNU Make’s $(filter ) function
The revision history for make.texi shows that $(filter) was added some three decades ago:
address@hidden 9f8301ae1ac6d9076e38ec86f12d59ba40b851bd:Revision 1.2 1988/04/23 16:16:04 roland
...
address@hidden 9f8301ae1ac6d9076e38ec86f12d59ba40b851bd:* Added the `filter', `filter-out', `strip' and `join' expansion functions.
https://www.gnu.org/software/make/manual/html_node/Features.html#Features suggests
that this function was an innovation of GNU make, true, but I found "newly introduced" misleading. I'm a native English speaker.
> gcc -o $ $(filter %.o, $^)
You've put a space after the comma. I wouldn't do that in a Makefile, though I would in every other programming language. https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-Functions mostly
wouldn't have that space either. $(filter) is one of those word-oriented functions where I don't think it would matter, but it's easier to have simple rules of thumb that keep you safe. One of the spaces after a comma here is important:
martind@swiftboat:~/tmp/warlich-2019-07-05$ cat Makefile
INPUT = a.o b.o
fn = $(1)
OUTPUT = $(call fn, $(filter-out %.o, $(INPUT)))
$(if $(OUTPUT),$(error :$(OUTPUT): is non-empty!))
martind@swiftboat:~/tmp/warlich-2019-07-05$ make
Makefile:4: *** : : is non-empty!. Stop.
martind@swiftboat:~/tmp/warlich-2019-07-05$
> depenency
> conviniently
> reciepe
Spelling.
From: Bug-make <bug-make-bounces+martin.dorey=address@hidden> on behalf of Christof Warlich <address@hidden>
Sent: Thursday, July 4, 2019 10:13 To: address@hidden Subject: Feature request / patch: dependency-only prerequisites ***** EXTERNAL EMAIL *****
Dear all, please bear with me if I'm doing something wrong here, this is the first time that I'm trying to contribute to GNU Make. The attached patch would add a minor (but imho useful) feature to GNU Make. Here is an extract of the (changed) documentation (changes are in red), giving a quite comprehensive idea as to why this feature would be useful:
What do you think: Do I have any chance to have my patch included? I'm certainly more that willing to do any modifications desired. Thanks in advance for any help, Chris
|
[Prev in Thread] | Current Thread | [Next in Thread] |