This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: trunk patch: documenting how to build plugins.

On Wed, Jun 17, 2009 at 09:04, Basile

> The last sentence explains that some plugin could indeed need the source or
> build tree. This could happen because of gengtype, or because the plugin
> might want to use some feature or function of GCC which is not declared
> inside the plugin/include directory. IIRC the plugin dogma (which I agree
> with) is : there is no stable GCC internal API!

Sure, but the header files should be in plugin/include just the
same.  The only time a build tree is needed should be for
gengtype usage.

> +If plugins are enabled, GCC installs the headers needed to build a
> +plugin (somehwere in the installation tree, e.g. under
> +@code{/usr/local}).


> In particular a @code{plugin} directory has been
> +installed, and it contains a @code{plugin/include} sub-directory with
> +all the header files useful for building plugins.

Rephrase as 'In particular, a @file{plugin/include} directory is
installed, containing all the header files needed to build

> +
> +On most systems, you can query this @code{plugin} directory by
> +invoking @code{@var{gcc} -print-file-name=plugin} (replace if needed


> +@var{gcc} with the appropriate program path).


> +
> +The following GNU Makefile except shows how to build a simple plugin:


> +@smallexample
> +GCC=gcc
> +PLUGIN_SOURCE_FILES= plugin1.c plugin2.c
> +GCCPLUGINS_DIR:= $(shell $(GCC) -print-file-name=plugin)
> +CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -O2
> +
> +   $(GCC) -shared $^ -o $@
> +@end smallexample
> +
> +A single source file plugin could even be built with @code{gcc -I`gcc

s/could even be/may be/

> +-print-file-name=plugin`/include -fPIC -shared -O2 plugin.c -o
>}, using backquote shell syntax to query the @code{plugin}


> +Some complex plugins (e.g. those needing @code{gengtype} or using GCC
> +stuff outside of @code{plugin/ionclude}) could require both source and
> +build directories of GCC.

No.  The only plugins that need src/bld trees are those using
gengtype.  Rephrase as "Plugins needing to use @command{gengtype}
require a GCC build directory for the same version of GCC that
they will be linked against."

OK with those changes.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]