Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2016 09:45:00 -0700
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        Demetrius Siluanius <dsiluanius@gmail.com>, freebsd-hackers@freebsd.org
Subject:   Re: bsd.incs.mk: include subdirectories
Message-ID:  <73a9d590-c845-910e-12ff-dd1580b81500@FreeBSD.org>
In-Reply-To: <CAEP0=Oa%2BXyNBOUb4SYUBzqG%2BioV9QZe-iwoUXGppqAoHUAai3w@mail.gmail.com>
References:  <CAEP0=Oa%2BXyNBOUb4SYUBzqG%2BioV9QZe-iwoUXGppqAoHUAai3w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5/11/16 1:08 PM, Demetrius Siluanius wrote:
> Hello everyone!
>=20
> Recently I started porting a number of my projects to BSD world. I real=
ized it
> would be great if I could use a native make(1) tool instead of GNU make=
. I'm
> really impressed how easy it is to create a makefile for a library with=
 almost
> a single '.include bsd.lib.mk' statement. Thank you guys for such an am=
azing
> build system!
>=20
> The only thing I couldn't deal with is when headers must be placed into
> subdirectories. For simplicity let's assume that project's headers hier=
archy is
> the following one:
>     include/
>         mylib/
>             A/
>                 A0.h
>                 A1.h
>             B/
>                 B0.h
>                 B1.h
>             base.h
>=20
> The only header that will be used is "mylib/base.h", but it includes ot=
her
> headers using statements '#include "A/A0.h". What should I do to instal=
l files
> like this? I can't really understand what's happening inside of bsd.inc=
s.mk
> file, but I guess there should be something simpler than overriding the=
 default
> 'installincludes' target.
>=20
> I could't find any relevant information; I tried to find an example Mak=
efile
> which could have a similar headers hierarchy, but didn't succeed. Could=
 you
> help me, please? Thank you!


If I understand correctly then you want something like this in the Makefi=
le:

INCSGROUPS=3D A B INCS

INCS=3D base.h
INCSDIR=3D /usr/include/mylib

A=3D A0.h A1.h
ADIR=3D ${INCSDIR}/A

B=3D B0.h B1.h
BDIR=3D ${INCSDIR}/B

The trick is that INCSGROUPS defines a <var> and you can use <var>DIR
<var>MODE <var>GRP <var>OWN and <var> to define multiple groups of
includes and where and how they should be installed.  The default value
for INCSGROUPS is just 'INCS' which is why INCSDIR and INCSOWN, etc, work=
.

Regards,
Bryan Drewery



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?73a9d590-c845-910e-12ff-dd1580b81500>