help-make
[Top][All Lists]
Advanced

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

About make manual 11.3 a(m) syntax in prerequisite


From: lijh8
Subject: About make manual 11.3 a(m) syntax in prerequisite
Date: Fri, 27 Dec 2024 17:03:57 +0800

Hi community,


```
# gnu make 11.3 ,
# https://www.gnu.org/software/make/manual/make.html#Archive-Pitfalls ,
# Makefile
(%) : % ;
%.a : ; $(AR) $(ARFLAGS) $@ $?
# libfoo.a: libfoo.a($(patsubst %.c,%.o,$(wildcard *.c)))
libfoo.a: $(patsubst %.c,%.o,$(wildcard *.c)) 
```


if i do not use ` a(m) ` syntax in the prerequisites, it works well.


$ make libfoo.a
make: 'libfoo.a' is up to date.
$ 


but if i use ` a(m) ` syntax in the prerequisites, 
it rebuilds the archive even i did not change the `*.c` source files or the 
`*.o` object files.


$ 
$ make libfoo.a
ar -rv libfoo.a foo1.o foo2.o
r - foo1.o
r - foo2.o
$ 


$ make --version
GNU Make 4.4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<https://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$&nbsp;
$ cat /etc/os-release &nbsp;| grep PRETTY_NAME
PRETTY_NAME="Debian GNU/Linux trixie/sid"
$&nbsp;

reply via email to

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