clearmake和gnu make都可以检测出来target之间的循环依赖

[jialiang@ht191w tmp]$ make -f mk clean # gnu make
make: Circular target <- clean dependency dropped.
echo “clean is called”
clean is called
echo “clean running”
clean running
echo “current dir is: “
current dir is:
pwd
/home/jialiang/tmp
[jialiang@ht191w tmp]$ cmake -f mk clean # clearmake
clearmake: Warning: Cycle in dependency graph?
clearmake: Warning: “clean” was already seen.
echo “clean is called”
clean is called

echo “clean running”
clean running
echo “current dir is: “
current dir is:
pwd
/home/jialiang/tmp

[jialiang@ht191w tmp]$ cat mk

Marco/Variable define

a = “great”

Target/Dependency define

all:
echo “great”

.PHONY: clean
clean: target
echo “clean running”
ifeq ($(a), great)
echo “equals”
endif

ifneq ($(a), dd)
echo “current dir is: “
pwd
endif

target: clean
echo “clean is called”

this line is useless, unless you put it the first line when you start define

target
default: clean