gettext: src/Makefile
1
1 13.4.12 ‘Makefile.in’ in ‘src/’
1 -------------------------------
1
1 Some of the modifications made in the main ‘Makefile.in’ will also be
1 needed in the ‘Makefile.in’ from your package sources, which we assume
1 here to be in the ‘src/’ subdirectory. Here are all the modifications
1 needed in ‘src/Makefile.in’:
1
1 1. In view of the ‘dist:’ goal, you should have these lines near the
1 beginning of ‘src/Makefile.in’:
1
1 PACKAGE = @PACKAGE@
1 VERSION = @VERSION@
1
1 2. If not done already, you should guarantee that ‘top_srcdir’ gets
1 defined. This will serve for ‘cpp’ include files. Just add the
1 line:
1
1 top_srcdir = @top_srcdir@
1
1 3. You might also want to define ‘subdir’ as ‘src’, later allowing for
1 almost uniform ‘dist:’ goals in all your ‘Makefile.in’. At list,
1 the ‘dist:’ goal below assume that you used:
1
1 subdir = src
1
1 4. The ‘main’ function of your program will normally call
1 ‘bindtextdomain’ (see ⇒Triggering), like this:
1
1 bindtextdomain (PACKAGE, LOCALEDIR);
1 textdomain (PACKAGE);
1
1 To make LOCALEDIR known to the program, add the following lines to
1 ‘Makefile.in’ if you are using Autoconf version 2.60 or newer:
1
1 datadir = @datadir@
1 datarootdir= @datarootdir@
1 localedir = @localedir@
1 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
1
1 or these lines if your version of Autoconf is older than 2.60:
1
1 datadir = @datadir@
1 localedir = $(datadir)/locale
1 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
1
1 Note that ‘@datadir@’ defaults to ‘$(prefix)/share’, thus
1 ‘$(localedir)’ defaults to ‘$(prefix)/share/locale’.
1
1 5. You should ensure that the final linking will use ‘@LIBINTL@’ or
1 ‘@LTLIBINTL@’ as a library. ‘@LIBINTL@’ is for use without
1 ‘libtool’, ‘@LTLIBINTL@’ is for use with ‘libtool’. An easy way to
1 achieve this is to manage that it gets into ‘LIBS’, like this:
1
1 LIBS = @LIBINTL@ @LIBS@
1
1 In most packages internationalized with GNU ‘gettext’, one will
1 find a directory ‘lib/’ in which a library containing some helper
1 functions will be build. (You need at least the few functions
1 which the GNU ‘gettext’ Library itself needs.) However some of the
1 functions in the ‘lib/’ also give messages to the user which of
1 course should be translated, too. Taking care of this, the support
1 library (say ‘libsupport.a’) should be placed before ‘@LIBINTL@’
1 and ‘@LIBS@’ in the above example. So one has to write this:
1
1 LIBS = ../lib/libsupport.a @LIBINTL@ @LIBS@
1
1 6. You should also ensure that directory ‘intl/’ will be searched for
1 C preprocessor include files in all circumstances. So, you have to
1 manage so both ‘-I../intl’ and ‘-I$(top_srcdir)/intl’ will be given
1 to the C compiler.
1
1 7. Your ‘dist:’ goal has to conform with others. Here is a reasonable
1 definition for it:
1
1 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
1 dist: Makefile $(DISTFILES)
1 for file in $(DISTFILES); do \
1 ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir) || exit 1; \
1 done
1
1 Note that if you are using GNU ‘automake’, ‘Makefile.in’ is
1 automatically generated from ‘Makefile.am’, and the first three changes
1 and the last change are not necessary. The remaining needed
1 ‘Makefile.am’ modifications are the following:
1
1 1. To make LOCALEDIR known to the program, add the following to
1 ‘Makefile.am’:
1
1 <module>_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
1
1 for each specific module or compilation unit, or
1
1 AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
1
1 for all modules and compilation units together. Furthermore, if
1 you are using an Autoconf version older then 2.60, add this line to
1 define ‘localedir’:
1
1 localedir = $(datadir)/locale
1
1 2. To ensure that the final linking will use ‘@LIBINTL@’ or
1 ‘@LTLIBINTL@’ as a library, add the following to ‘Makefile.am’:
1
1 <program>_LDADD = @LIBINTL@
1
1 for each specific program, or
1
1 LDADD = @LIBINTL@
1
1 for all programs together. Remember that when you use ‘libtool’ to
1 link a program, you need to use @LTLIBINTL@ instead of @LIBINTL@
1 for that program.
1
1 3. If you have an ‘intl/’ directory, whose contents is created by
1 ‘gettextize’, then to ensure that it will be searched for C
1 preprocessor include files in all circumstances, add something like
1 this to ‘Makefile.am’:
1
1 AM_CPPFLAGS = -I../intl -I$(top_srcdir)/intl
1