1 # Makefile.am for libgpg-error.
2 # Copyright (C) 2003, 2004 g10 Code GmbH
4 # This file is part of libgpg-error.
6 # libgpg-error is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as
8 # published by the Free Software Foundation; either version 2.1 of the
9 # License, or (at your option) any later version.
11 # libgpg-error is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 # We distribute the generated sources err-sources.h and err-codes.h,
21 # because they are needed to build the po directory, and they don't
22 # depend on the configuration anyway.
24 localedir = $(datadir)/locale
25 bin_PROGRAMS = gpg-error
26 lib_LTLIBRARIES = libgpg-error.la
27 include_HEADERS = gpg-error.h
28 bin_SCRIPTS = gpg-error-config
29 m4datadir = $(datadir)/aclocal
30 m4data_DATA = gpg-error.m4
33 EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \
34 mkerrnos.awk errnos.in README \
35 mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \
36 mkheader.awk gpg-error.h.in \
37 err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 \
38 gpg-error.def versioninfo.rc.in
40 BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
41 err-sources-sym.h err-codes-sym.h errnos-sym.h gpg-error.h
43 tmp_files = _mkerrcodes.h
45 CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
46 gpg-error.h mkerrcodes mkerrcodes.h \
47 err-sources-sym.h err-codes-sym.h errnos-sym.h $(tmp_files)
51 arch_sources = w32-gettext.h w32-gettext.c
53 LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
54 `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
55 sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
60 $(LTRCCOMPILE) -i $< -o $@
62 gpg_error_res = versioninfo.o
63 gpg_error_res_ldflag = -Wl,$(gpg_error_res)
64 no_undefined = -no-undefined
65 export_symbols = -export-symbols $(srcdir)/gpg-error.def
68 $(INSTALL) gpg-error.def $(DESTDIR)$(libdir)/gpg-error-.def
71 -rm $(DESTDIR)$(libdir)/gpg-error.def
73 libgpg_error_la_DEPENDENCIES = $(gpg_error_res) gpg-error.def
79 gpg_error_res_ldflag =
85 intllibs = @LTLIBINTL@
90 libgpg_error_la_LDFLAGS = $(gpg_error_res_ldflag) -version-info \
91 @LIBGPG_ERROR_LT_CURRENT@:@LIBGPG_ERROR_LT_REVISION@:@LIBGPG_ERROR_LT_AGE@ \
92 $(no_undefined) $(export_symbols)
94 libgpg_error_la_SOURCES = gpg-error.h gettext.h $(arch_sources) \
95 init.c strsource.c strerror.c code-to-errno.c code-from-errno.c
97 libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
98 libgpg_error_la_LIBADD = $(intllibs)
100 gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c $(arch_sources)
101 gpg_error_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
102 gpg_error_LDADD = ./libgpg-error.la @LTLIBINTL@
104 err-sources.h: Makefile mkstrtable.awk err-sources.h.in
105 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 \
106 $(srcdir)/err-sources.h.in >$@
108 err-sources-sym.h: Makefile mkstrtable.awk err-sources.h.in
109 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
110 $(srcdir)/err-sources.h.in >$@
112 err-codes.h: Makefile mkstrtable.awk err-codes.h.in
113 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 \
114 $(srcdir)/err-codes.h.in >$@
116 err-codes-sym.h: Makefile mkstrtable.awk err-codes.h.in
117 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
118 $(srcdir)/err-codes.h.in >$@
120 code-to-errno.h: Makefile mkerrnos.awk errnos.in
121 $(AWK) -f $(srcdir)/mkerrnos.awk $(srcdir)/errnos.in >$@
123 # It is correct to use $(CPP). We want the host's idea of the error codes.
124 mkerrcodes.h: Makefile mkerrcodes.awk
125 $(AWK) -f $(srcdir)/mkerrcodes1.awk $(srcdir)/errnos.in >_$@
126 $(CPP) _$@ | grep GPG_ERR_ | $(AWK) -f $(srcdir)/mkerrcodes.awk >$@
129 # It is correct to use $(CC_FOR_BUILD) here. We want to run the
130 # program at build time.
131 mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
132 $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
134 code-from-errno.h: mkerrcodes Makefile
135 ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
137 errnos-sym.h: Makefile mkstrtable.awk errnos.in
138 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
139 -v prefix=GPG_ERR_ -v namespace=errnos_ \
140 $(srcdir)/errnos.in >$@
142 gpg-error.h: Makefile mkheader.awk \
143 err-sources.h.in err-codes.h.in errnos.in gpg-error.h.in
144 $(AWK) -f $(srcdir)/mkheader.awk \
145 $(srcdir)/err-sources.h.in \
146 $(srcdir)/err-codes.h.in \
147 $(srcdir)/errnos.in \
148 $(srcdir)/gpg-error.h.in > $@