On Fri, 2019-03-29 at 12:55 +0800, 積丹尼 Dan Jacobson wrote:
> OK you're right. But why is what is on line A influencing this when we
> are trying to make B?
> $ cat makefile
> D=X_X_X_X
> N=noise
> L=light
> A:$D/$(addsuffix .kmz, $L $N)
> B:$D/$L.kmz $D/$N.kmz
> %.kmz:%.kml; minizip -o $@ $?
> %.kml:%.kml0; fgrep -v '?xml' $? > $@
> %.kml0: n input.txt; mode=$* ./n input.txt > $@
> $D/%:%; cp -a $? $@
> $ touch n input.txt
> $ cat makefile |sed /A/s/add/xxx/| make -f - -n B|sed $\!d
> rm noise.kml noise.kmz noise.kml0 light.kml light.kmz light.kml0
> $ cat makefile |                   make -f - -n B|sed $\!d
> rm noise.kml noise.kml0 light.kml light.kmz light.kml0

It's too hard to decipher a wall of code like that.  Please break your
question down into a simple example so people don't have to spend 10
minutes trying to understand it.

I didn't think about it too hard; however, the most likely reason for
the difference is that when you modify the function to be xxxsuffix
(which expands to the empty string) the rule evaluates to:

  A:X_X_X_X/

whereas when the addsuffix exists the rule expands to:

  A:X_X_X_X/noise.kmz light.kmz

Even though you don't run that rule, you've now declared two new
targets that weren't there before.

Since the difference you're pointing to is the "rm" which happens as
part of cleanup of intermediate files, mentioning new targets in the
makefile can definitely impact which files are considered intermediate.

See https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to