4918
5880
3万
GROAD
曲径通幽,安觅芳踪。
clean: @echo "always be executed" helloworld:file1.o file2.o gcc file1.o file2.o -o helloworld file1.o:file1.c file2.h gcc -c file1.c -o file1.o file2.o:file2.c file2.h gcc -c file2.c -o file2.o PHONY += clean .PHONY: $(PHONY)
[beyes@SLinux Makefile]$ make always be executed
[beyes@SLinux Makefile]$ make helloworld gcc -c file1.c -o file1.o gcc -c file2.c -o file2.o gcc file1.o file2.o -o helloworld
PHONY := __build .PHONY: $(PHONY) __build: obj-y := timesheet obj-m := hello __build: lib-y := world __build: @echo $(obj-y) @echo $(lib-y)
$ make timesheet world
$ make make: Nothing to be done for `__build'.
PHONY := __build .PHONY: $(PHONY) __build: obj-y := timesheet obj-m := hello temp: @echo "--------------------------" __build: @echo "i am here"
all: hello world ok .PHONY:all hello : hello.o gcc hello.o -o hello hello.o: hello.c gcc -c hello.c -o hello.o world : world.o gcc world.o -o world world.o : world.c gcc -c world.c -o world.o ok : ok.o gcc ok.o -o ok ok.o : ok.c gcc -c ok.c -o ok.o clean: -rm -f *.o hello world ok
[beyes@SLinux temp2]$ make make: Nothing to be done for `all'.
PHONY += all all: hello world ok hello : hello.o gcc hello.o -o hello hello.o: hello.c gcc -c hello.c -o hello.o world : world.o gcc world.o -o world world.o : world.c gcc -c world.c -o world.o ok : ok.o gcc ok.o -o ok ok.o : ok.c gcc -c ok.c -o ok.o PHONY += cleanall clwanobj cleanexe cleanall:cleanobj cleanexe cleanobj: rm *.o cleanexe: rm hello world ok .PHONY: $(PHONY)
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )
GMT+8, 2025-6-18 02:42 , Processed in 0.084979 second(s), 22 queries .
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.