Make Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 10: Line 10:
clean:  
clean:  
   rm -rf *.o
   rm -rf *.o
</syntaxhighlight>
=Variables=
==<tt>CURDIR</tt>==
<code>CURDIR</code> refers to the directory make is run from:
<syntaxhighlight lang='make'>
something:
"$(CURDIR)/scripts/something.sh"
</syntaxhighlight>
</syntaxhighlight>

Revision as of 19:32, 14 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


Variables

CURDIR

CURDIR refers to the directory make is run from:

something:
	"$(CURDIR)/scripts/something.sh"