Reputation: 3625
I created a makefile to build some code and when adding --trace option to debug/make sure everything is good, I noticed that there is a print saying some target is not found, even if it is there and it executes it. So I created a more simple example to point this and ask around why this is happening.
My makefile:
APP_NAME = apl
ODIR = obj
all: $(APP_NAME)
$(ODIR):
@mkdir -p $(ODIR)
$(APP_NAME): $(ODIR)
If I execute it with make all
it creates the obj folder.
If I add the --trace
option at the end it says that the obj
target does not exist and it creates the folder:
$ make all --trace
makefile:7: target 'obj' does not exist
mkdir -p obj
$ ll
drwxrwxr-x. 2 user user 4096 Aug 17 10:44 obj
I have a linux machine with fedora installed. Can anyone help me understand why that message?
Upvotes: 2
Views: 786
Reputation: 12909
The trace message...
makefile:7: target 'obj' does not exist
is simply informational. It's telling you why the mkdir -p obj
was executed. If you specify some dependency for $(OBJ)
and arrange for that dependency to be newer than $(OBJ)
then the message would be something like...
makefile:7: update target 'obj' due to: <dependency name>
Upvotes: 6