step forward on compilation

Björn Döbel doebel at os.inf.tu-dresden.de
Mon Mar 31 09:25:58 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

> Anyway, as for including header files, I found that you can indeed
> make a directory at the base package level, called "include" - and
> put a Makefile in it just like it is done for the other projects
> (but I'm unsure what the Makefile actually does - perhaps if you
> specify the include directory as a target in the *package* 
> Makefile, you can drop it?).

You guessed correctly that there is some build system magic for
include directories. The intent is that headers in these include
directories get installed into an include/ subtree of your build
directory and you can then include them as

<l4/pkgname/xyz.h>

So staying with your example (l4/hs/task_scheduler.h), you'd have a
package hs in l4/pkg/hs. In there you put a subdir include/ (or
whatever you want to call it) and in there you'd implement your
task_scheduler.h file. Then you use a Makefile that includes
$(L4DIR)/mk/include.mk to trigger the install magic.\

You can find plenty of examples for this in l4/pkg as many of the L4
packages ship their own headers.


> And, you can't use the C++ ".hh" extension, but ".h" works, if you
> include them like this:
> 
> #include <l4/hs/task_scheduler.h>

Correct. By default only .h files get installed into the build tree.
If you have files with other extensions, you will have to tell the
build system by defining the EXTRA_TARGET make variable. For an
example see for instance l4/pkg/libloader/include/Makefile

> if your package is named "hs". In effect, this is quite the
> opposite of the #include "task_scheduler.hh", and then the -I flag
> to the compiler.

Was that a question?

> As for -std=c++11, I found that you can pass that not with CFLAGS,
> but close - this works:
> 
> CXXFLAGS += -std=c++11

Indeed, CFLAGS specifies parameters for the C compiler whereas
CXXFLAGS specifies those for the C++ compiler, so you want to put
- -std=c++11 into CXXFLAGS.

Bjoern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlM5GIYACgkQP5ijxgQLUNkviQCcCkQJpWxZh6FDsvm8PeDiKvNL
OrcAnRUg/wz0wpMdJQRqce7Nik0l82Z2
=tux0
-----END PGP SIGNATURE-----



More information about the l4-hackers mailing list