Tizen 2.1 base
[external/libgpg-error.git] / src / Makefile.am
1 # Makefile.am for libgpg-error.
2 # Copyright (C) 2003, 2004 g10 Code GmbH
3
4 # This file is part of libgpg-error.
5
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.
10
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.
15
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
19
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. 
23
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
31
32
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
39
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
42
43 tmp_files = _mkerrcodes.h
44
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)
48
49
50 if HAVE_W32_SYSTEM
51 arch_sources = w32-gettext.h w32-gettext.c
52
53 LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
54      `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
55      sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
56
57 SUFFIXES = rc
58
59 .rc.o:
60         $(LTRCCOMPILE) -i $< -o $@
61
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
66
67 install-def-file:
68         $(INSTALL) gpg-error.def $(DESTDIR)$(libdir)/gpg-error-.def
69
70 uninstall-def-file:
71         -rm $(DESTDIR)$(libdir)/gpg-error.def
72
73 libgpg_error_la_DEPENDENCIES = $(gpg_error_res) gpg-error.def
74 intllibs = 
75
76 else
77 arch_sources =
78 gpg_error_res =
79 gpg_error_res_ldflag =
80 no_undefined =
81 export_symbols =
82 install-def-file:
83 uninstall-def-file:
84
85 intllibs = @LTLIBINTL@
86
87 endif
88
89
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)
93
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
96
97 libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
98 libgpg_error_la_LIBADD = $(intllibs)
99
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@
103
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 >$@
107
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 >$@
111
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 >$@
115
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 >$@
119
120 code-to-errno.h: Makefile mkerrnos.awk errnos.in
121         $(AWK) -f $(srcdir)/mkerrnos.awk $(srcdir)/errnos.in >$@
122
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 >$@
127         -rm _$@
128
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
133
134 code-from-errno.h: mkerrcodes Makefile
135         ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
136
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 >$@
141
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 > $@