[Top][All Lists]

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

Re: Feature request / patch: dependency-only prerequisites

From: Christof Warlich
Subject: Re: Feature request / patch: dependency-only prerequisites
Date: Sat, 6 Jul 2019 10:28:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

on 05.07.19 at 23:44 Martin Dorey wrote:

... 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

That dates from when upstream built the package that included it:

Yes, that's unfortunate, and the only generic fix would be checksum-based dependencies. Decent SCMs like git are also quite helpful in tackling this issue, see https://git.wiki.kernel.org/index.php/GitFaq#Why_isn.27t_Git_preserving_modification_time_on_files.3F

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.
Yes, that's misleading: The "newly introduced" was meant to emphasize that a $(filter) function was added compared to the previous example, but you are right, it does more bad than good.

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.



Thanks for your suggestions, I'm happy to include them all (patch attached), together with some other doc fixes (hopefully) improving the grammer.

Attachment: 0001-Add-support-for-dependency-only-prerequisites.patch
Description: Text Data

Attachment: 0002-Fix-documentation-for-dependency-only-prerequisites.patch
Description: Text Data

reply via email to

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