Next: lib/gettext.h, Previous: Makefile, Up: Adjusting Files [Contents][Index]
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
:
dist:
’ goal, you should have these lines near the
beginning of src/Makefile.in
:
PACKAGE = @[email protected] VERSION = @[email protected]
top_srcdir
gets defined. This will serve for cpp
include files. Just add
the line:
top_srcdir = @[email protected]
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
The main
function of your program will normally call
bindtextdomain
(see see Triggering), like this:
bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE);
On native Windows platforms, the main
function may call
wbindtextdomain
instead of bindtextdomain
.
To make LOCALEDIR known to the program, add the following lines to
Makefile.in
:
datadir = @[email protected] datarootdir= @[email protected] localedir = @[email protected] DEFS = -DLOCALEDIR=\"$(localedir)\" @[email protected]
Note that @[email protected]
defaults to ‘$(prefix)/share
’, and
$(localedir)
defaults to ‘$(prefix)/share/locale
’.
You should ensure that the final linking will use @[email protected]
or
@[email protected]
as a library. @[email protected]
is for use without
libtool
, @[email protected]
is for use with libtool
. An
easy way to achieve this is to manage that it gets into LIBS
, like
this:
LIBS = @[email protected] @[email protected]
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 @[email protected]
and
@[email protected]
in the above example. So one has to write this:
LIBS = ../lib/libsupport.a @[email protected] @[email protected]
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:
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
To ensure that the final linking will use @[email protected]
or
@[email protected]
as a library, add the following to
Makefile.am
:
<program>_LDADD = @[email protected]
for each specific program, or
LDADD = @[email protected]
for all programs together. Remember that when you use libtool
to link a program, you need to use @[email protected] instead of @[email protected]
for that program.
Next: lib/gettext.h, Previous: Makefile, Up: Adjusting Files [Contents][Index]