Reputation: 167
I am trying to use makedepend
in a makefile named Makefile_abc
.
Normally when I have to build a target trg
, I say
make -f Makefile_abc trg
and this works beautifully. I have added following lines in this makefile.
dep:
makedepend main.c
Now, when I do,
make -f Makefile_abc dep
I get the error,
makedepend: error: [mM]akefile is not present
make: *** [depend] Error 1
If I rename my makefile as Makefile, then following command works fine,
make depend
So, I am looking for a way to use makedepend on non-standard makefile names.
Upvotes: 0
Views: 1529
Reputation: 753970
This is a basic 'read the manual' question.
Looking at makedepend(1), you need -fMakefile_abc
in the recipe for the target dep
(optionally with a space between -f
and Makefile_abc
):
dep:
makedepend -fMakefile_abc main.c
To update the dependencies, you'd run:
$ make -f Makefile_abc dep
This would cause make
to run:
makedepend -fMakefile_abc main.c
(Note that the 'standard' — most common — name for the target is depend
rather than dep
, so you'd normally run make -fMakefile_abc depend
or, with a plain makefile
file, make depend
.)
If you're using GNU Make, you might also add another line to Makefile_abc
:
.PHONY: dep # Or depend, depending…
This tells make
that there won't be a file dep
created by the rule.
You can often get information about how to run a command by using makedepend --help
or makedepend -:
— the first may (or may not) give a useful help message outlining options, and the second is very unlikely to be a valid option which should generate a 'usage' message that summarizes the options.
Upvotes: 1