I have a fairly large makefile that creates a number of targets on the fly by computing names from variables. (eg foo$(VAR) : $(PREREQS)). Is there any way that gnu make can be convinced to spit out a list of targets after it has expanded these variables?
I'd like to be able to get the targets for an aribitrary makefile. I'm trying to write a completion function for my shell.
Can you parse the output from
make -pn
(i.e.make --print-data-base --dry-run
)? It prints out all the variables, rules, implicit rules and which commands will be run in laborious detail.Guess I'm a little late to this party, but if you're looking for a specific command you could try
This mostly works, although it might still include some non-target stuff like a
vpath
directive. If you don't depend onmake
's built-in rules, you can usemake -qpR
as the first command in the pipeline.Ruby solution:
Im working on solaris 10 anda turbo C shell. The given solution doesn´t work for my makefile project. even after altering the command line above to tcsh syntax. However, I found out you can get an easy solution using
remake version:
is
and some other unimportant version data
I'm not sure if this is only a gnu make thing, but this works well:
make help
This will give a nice output: