Make Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * make")
 
Line 1: Line 1:
=Internal=
=Internal=
* [[Make#Subjects|make]]
* [[Make#Subjects|make]]
=<tt>.PHONY</tt>=
By default, <code>make</code> targets are assumed to be files on disk. They will be built from other files as result of executing <code>make</code> with that name as argument. However, sometimes you want <code>make</code> to run commands that do not represent physical files in the filesystem, and if there's a file with the same name in the filesystem, <code>make</code> will be confused and will pick up the file. To avoid this, you can disambiguate with <code>.PHONY</code>:
<syntaxhighlight lang='make'>
.PHONY: clean
clean:
  rm -rf *.o
</syntaxhighlight>

Revision as of 23:26, 13 December 2023

Internal

.PHONY

By default, make targets are assumed to be files on disk. They will be built from other files as result of executing make with that name as argument. However, sometimes you want make to run commands that do not represent physical files in the filesystem, and if there's a file with the same name in the filesystem, make will be confused and will pick up the file. To avoid this, you can disambiguate with .PHONY:

.PHONY: clean
clean: 
  rm -rf *.o