[posted on planet.mozilla.org, but I figured it would be good to send
to dev-platform as well]

The DEPTH of me
---------------

When adding a new directory to the Mozilla codebase, one usually needs
to add a Makefile.in file, with some magic incantations at the beginning
of it:

    DEPTH = ../..
    topsrcdir = @top_srcdir@
    srcdir = @srcdir@
    VPATH = @srcdir@

    include $(DEPTH)/config/autoconf.mk

    etc.

Some even add:

    relativesrcdir = foo/bar

In the above, DEPTH and relativesrcdir both need to be carefully filled
depending where the Makefile.in is.

As of bug 774032, landed over the week-end (along with some now
hopefully fixed tree breakage for some people, sorry for the
inconvenience), there are two additional substitution variables for
Makefile.in that replace the need to be careful.

Now the boilerplate for a new Makefile.in is:

    DEPTH = @DEPTH@
    topsrcdir = @top_srcdir@
    srcdir = @srcdir@
    VPATH = @srcdir@

    include $(DEPTH)/config/autoconf.mk

    etc.

And, if needed,

    relativesrcdir = @relativesrcdir@


Forget about autoconf.mk.in
---------------------------

When you add a flag somewhere in configure.in and need to use it in code
or in the build system, you use AC_SUBST or AC_DEFINE. While using
AC_DEFINE in configure.in is usually sufficient for its purpose, using
AC_SUBST requires to add some boilerplate in config/autoconf.mk.in, in
the form:

    VARIABLE_NAME = @VARIABLE_NAME@

Here’s the news for you: these days are over. With bug 742795, now on
mozilla-central, autoconf.mk is auto-generated. No need to touch
config/autoconf.mk.in anymore.


Cheers,

Mike
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to