Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly does "Clean and Build" do?

Maybe this seems like a naive question.

I have some functionality in my project that suddenly doesn't work, an when I "Clean and Build", it works again. What might be the problem that is being solved by performing this Clean and Build?

Your input is highly appreciated.

like image 763
Dina Avatar asked Dec 06 '25 04:12

Dina


1 Answers

The actions on a Make and clean are derermined by the makefile. You can look at the Makefile itself to see what is there.

make by itself corresponds to the very first rule in the makefile. make clean corresponds to the clean rule in the makefile

Also, you can use

make -n

and

make -n clean

These will show you the sequence of command(s) that are actually executed when make or make clean are run.

As a general convention, make by itself is a rule for compiling so it executes the compile commands necessary to build the project.

make clean is used for cleaning the project. It deletes the object files and the executable, and any other files necessary to allow a clean build of the project on next make.

Why doing make clean followed by a make helps?

It can be due to a number of reasons and its hard for me to tell you what may be going on. Can you give some more details on the failure mode?

like image 88
Aater Suleman Avatar answered Dec 07 '25 19:12

Aater Suleman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!