pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Help with printing a variable from a bsd makefile, from the commandline.



On Sat, 26 Jan 2013, Josh Branning wrote:

> I am trying to print a variable from a bsd makefile from the command
> line, without editing said file.
> 
> I believe the command to do this is something like:
> 
> [bmake|make] -V [variable] pkgsrc/path/to/Makefile
> 
> For example; if I try and print the variable, PYPKGSRCDIR, from the
> python package, it should look something like this:
> 
> /usr/pkg/bin/bmake -V "${PYPKGSRCDIR}" pkgsrc/lang/python/pyversion.mk

Add a -f before the location of the makefile. And don't need a dollar 
sign nor {} braces.
(In this case you will need to be in the same directory too since it 
references files with relative references.)

$ cd /usr/pkgsrc/lang/python
$ make -V PYPKGSRCDIR -f pyversion.mk                              
../../lang/python27

By the way, pkgsrc offers:

$ cd ../../databases/py-sqlite3/                                    
$ make show-var VARNAME=PYPKGSRCDIR            
../../lang/python27
$ make show-vars VARNAMES="PYPKGSRCDIR PYTHON_VERSION_DEFAULT"
../../lang/python27
27


Home | Main Index | Thread Index | Old Index