Answer the question
In order to leave comments, you need to log in
Creating a simple makefile. Why doesn't the clean target work?
I'm learning the make utility. As an example, I threw the following simple example in the makefile:
.PHONY: all clean
all: hello
clean:
rm -rf hello *.o
main.o: main.cpp
g++ -c -o main.o main.cpp
hello: main.o
g++ -o hello main.o
Answer the question
In order to leave comments, you need to log in
Most likely you do not specify the target explicitly. By default, the first target is executed (except for those that start with a period) - and in this target (all) there is no clean in the dependencies.
www.gnu.org/software/make/manual/make.html#How-Mak...
And .PHONY is used to bypass file name and script match (try removing clean from .phony, create clean file and do make clean)
https://www.gnu.org/software/make/manual/html_node...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question