manpagez: man pages & more
info gettext
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.4.12 ‘Makefile.in’ in ‘src/

Some of the modifications made in the main ‘Makefile.in’ will also be needed in the ‘Makefile.in’ from your package sources, which we assume here to be in the ‘src/’ subdirectory. Here are all the modifications needed in ‘src/Makefile.in’:

  1. In view of the ‘dist:’ goal, you should have these lines near the beginning of ‘src/Makefile.in’:
    PACKAGE = @PACKAGE@
    VERSION = @VERSION@
    
  2. If not done already, you should guarantee that top_srcdir gets defined. This will serve for cpp include files. Just add the line:
    top_srcdir = @top_srcdir@
    
  3. You might also want to define subdir as ‘src’, later allowing for almost uniform ‘dist:’ goals in all your ‘Makefile.in’. At list, the ‘dist:’ goal below assume that you used:
    subdir = src
    
  4. The main function of your program will normally call bindtextdomain (see see section Triggering gettext Operations), like this:
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
    

    To make LOCALEDIR known to the program, add the following lines to ‘Makefile.in’ if you are using Autoconf version 2.60 or newer:

    datadir = @datadir@
    datarootdir= @datarootdir@
    localedir = @localedir@
    DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
    

    or these lines if your version of Autoconf is older than 2.60:

    datadir = @datadir@
    localedir = $(datadir)/locale
    DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
    

    Note that @datadir@ defaults to ‘$(prefix)/share’, thus $(localedir) defaults to ‘$(prefix)/share/locale’.

  5. You should ensure that the final linking will use @LIBINTL@ or @LTLIBINTL@ as a library. @LIBINTL@ is for use without libtool, @LTLIBINTL@ is for use with libtool. An easy way to achieve this is to manage that it gets into LIBS, like this:
    LIBS = @LIBINTL@ @LIBS@
    

    In most packages internationalized with GNU gettext, one will find a directory ‘lib/’ in which a library containing some helper functions will be build. (You need at least the few functions which the GNU gettext Library itself needs.) However some of the functions in the ‘lib/’ also give messages to the user which of course should be translated, too. Taking care of this, the support library (say ‘libsupport.a’) should be placed before @LIBINTL@ and @LIBS@ in the above example. So one has to write this:

    LIBS = ../lib/libsupport.a @LIBINTL@ @LIBS@
    
  6. You should also ensure that directory ‘intl/’ will be searched for C preprocessor include files in all circumstances. So, you have to manage so both ‘-I../intl’ and ‘-I$(top_srcdir)/intl’ will be given to the C compiler.
  7. Your ‘dist:’ goal has to conform with others. Here is a reasonable definition for it:
    distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
    dist: Makefile $(DISTFILES)
    	for file in $(DISTFILES); do \
    	  ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir) || exit 1; \
    	done
    

Note that if you are using GNU automake, ‘Makefile.in’ is automatically generated from ‘Makefile.am’, and the first three changes and the last change are not necessary. The remaining needed ‘Makefile.am’ modifications are the following:

  1. To make LOCALEDIR known to the program, add the following to ‘Makefile.am’:
    <module>_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
    

    for each specific module or compilation unit, or

    AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
    

    for all modules and compilation units together. Furthermore, if you are using an Autoconf version older then 2.60, add this line to define ‘localedir’:

    localedir = $(datadir)/locale
    
  2. To ensure that the final linking will use @LIBINTL@ or @LTLIBINTL@ as a library, add the following to ‘Makefile.am’:
    <program>_LDADD = @LIBINTL@
    

    for each specific program, or

    LDADD = @LIBINTL@
    

    for all programs together. Remember that when you use libtool to link a program, you need to use @LTLIBINTL@ instead of @LIBINTL@ for that program.

  3. If you have an ‘intl/’ directory, whose contents is created by gettextize, then to ensure that it will be searched for C preprocessor include files in all circumstances, add something like this to ‘Makefile.am’:
    AM_CPPFLAGS = -I../intl -I$(top_srcdir)/intl
    

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on June 7, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.