bug-make
[Top][All Lists]
Advanced

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

make -t and directories


From: Alejandro Colomar
Subject: make -t and directories
Date: Sat, 11 Mar 2023 01:54:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

Hi!

Let's say I have a build tree that has directories which are created
during build.  The build system has some linters in a `lint` target,
which touches files when it succeeds.  When I want to lint only a
specific file, it's interesting to convince make(1) to touch all files,
and then touch the source file I want to lint; a subsequent make(1)
invocation will only lint the file I want.  However, that only works
if I've created all the directories, so I need to run
`make -ij lint && make -t lint`.

Here's a small reproducer of the problem:

$ cat Makefile 
.PHONY: all
all: dir/file

.PHONY: clean
clean:
        rm -rf dir

dir:
        mkdir $@

dir/file: | dir
        echo foo > dir/file

.DELETE_ON_ERROR:
$ ls
Makefile
$ make -t
touch dir
touch dir/file
make: touch: open: dir/file: Not a directory


How about using `mkdir -p` instead of touch(1) for nonexistent files?
The effect would be the same, but it would allow such structures to
work with this feature.  I don't foresee big issues with it (I don't
imagine that some systems will depend on make -t creating regular
empty files).

What do you think?

Cheers,

Alex


-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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