change RECIPEPREFIX to space work only with simple expansion

2025-04-20 Thread lijh.8
Hi community, I tried to change RECIPEPREFIX to space.  It works with simple variable expansion but not recursive expansion, as shown in the first three assignments to it. I ever thought that the simple expansion gurantees that it happens  before enter recipe. But in the manual 6.14, it present

why make clean triggers other rules

2025-05-06 Thread lijh.8
Hi community, 1.  Why will the rule for `.d` dependency file be triggered when I do `make clean`? Why it tries to stop me from deleting the temporary `.d` file? I define an explicit pattern rule for `.o` object file,  and there is also an implicit rule for it. Why rule for `.o` object file is

Re: why make clean triggers other rules

2025-05-06 Thread lijh.8
Thanks Paul, I have been following your article https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ and put ` CPPFLAGS += -MMD ` in my makefile. And this works. I have been so confused for years everytime when I read the example in manual section 4.14 `Generating Prer

Re: why make clean triggers other rules

2025-05-06 Thread lijh.8
Thanks Paul! Correct some of my misunderstanding: ``` %.d: %.c set -e; rm -f $@; \ $(CC) -M $(CPPFLAGS) $< > $@.; \ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@. > $@; \ rm -f $@. ``` the .d file depends on `.c` source file as stated in rule ` %.d: %.c `. the sed command puts the `.