How to use ${WRKDIR}, ${PREFIX} and other variables in target names?

John Marino at
Sun Jan 19 10:23:50 UTC 2014

On 1/19/2014 11:09, Lev Serebryakov wrote:
> Hello, Ports.
> I want to write something like this in port's Makefile
> ===============================
> some-target: ${SOME_FILE}
>     # Some commands to generate ${SOME_FILE}
> ===============================
>  But it doesn't work. make complains, that
> "I don't know how to make /distname"
>  Of course, ${WRKDIR}/${DISTNAME} exists (it is directory with unpacked
> sources).
>  It looks like WRKDIR is not defined when target/prerequisites names are
> expanded.
>  I've tried to use, but it doesn't help
> at all.

Many ports carry a BSD makefile in the files subdirectory, install that
and that makefile does all the internal building.

What you are attempting is not done.

The ports Makefiles are meant to handle major targets (configure, build,
install), not do the low level building.  You should have a separate
makefile in WRKSRC for that.


More information about the freebsd-ports mailing list