compiling ports with --sysroot= and -isystem

Mathieu Arnold mat at
Fri Apr 22 07:20:32 UTC 2016

+--On 22 avril 2016 11:54:21 +0800 Julian Elischer <julian at>
| On 22/04/2016 11:18 AM, olli hauer wrote:
|> On 2016-04-22 04:04, Julian Elischer wrote:
|>> How can I add entries (like the above) to a port compile?
|>> I want to ADD things to CFLAGS.
|>> If I add 'CFLAGS=...' to the build (for example, of lsof)  it actually
|>> replaces all the CFLAGS already there. lsof (as the example) uses
|>> configure, so I would need to feed the added stuff into configure. Is
|>> there a standard way to do this? In the environment I'm using, I'm
|>> building for a machine that is not the build machine, but an appliance.
|>> It has a small number of differences in the include file contents, so I
|>> want it to compile using a different set of includes than those in
|>> /usr/include.
|>> On the other hand I'm building a bunch of tools that do have t orun on
|>> the build machine and they need to use the regular /usr/include so I
|>> don't really want to replace them..
|>> Julian
|>> p.s. usual "please reply directly" comment applies.. I'm on this list
|>> but get it in digest form..
|> Use the '+=' notation, e.g.
|> # Makefile
|> ...
|> CFLAGS+=	"--sysroot=...."
|> ...
| sorry I wasn't clear..
| I want to add something to the make command, not edit Makefiles.
| I could add something to or some similar Makefile
| include. but really I want to do it on a case by case basis.
| there is an averall Makefile (using gmake)  that effectively does:
| cd /usr/ports/$(PORT_DIR); $(BMAKE) $(ARGS) install clean
| (except it does a lot of them)
| I want to know what to add to $(ARGS) to make it use the correct include
| files.  my current "work-around" is to do:
| mv /usr/include /usr/include.hold; ln -s $(STAGING_DIR)/usr/include
| /usr/include
| cd /usr/ports/$(PORT_DIR); $(BMAKE) $(ARGS) install clean
| rm /usr/include; mv /usr/include.hold /usr/include
| this is *NOT* a clean solution :-)

If you want to change things on a port by port basis, you can:

1) use poudriere to build you a jail with a patch you provide, and build
ports with poudriere testport or poudriere bulk.
2) on each port's directory, you create a Makefile.local and put your
things in it.
3) in /etc/make.conf you use some kind of construct like:

.if ${.CURDIR:M*editors/vim}

Mathieu Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <>

More information about the freebsd-ports mailing list