In a make file i found the code snip like below. Is there any difference between create_file and run_debug ? i mean the use of . (dot) before create_file introduce any functionality like PHONY?
all:debug run_debug
setup: .create_file
.create_file:
cd /home/user1
touch file.txt
run_debug:
@echo Building debug
cd /home/user1/debug
As far as I know it has only one purpose (and in this makefile that purpose is obviated by the makefile construction).
From How make
Processes a Makefile:
By default,
make
starts with the first target (not targets whose names start with‘.’
). This is called the default goal.
So a leading .
means that make will not consider that target as a valid default goal.
But, as written, the all
target is the first target in this makefile so that will be the default goal so the leading dot here doesn't actually do anything.
That said all three of the setup
, run_debug
and .create_file
targets should be marked as .PHONY
and may have much better ways of being written/etc.
In addition to the default goal use, I also found it convenient that targets beginning with a .
are not displayed in auto-completion, i.e. typing make
+ Tab
So I prefix targets that are not meant for the end user with a .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With