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 25if HAVE_W32CE_SYSTEM 26gpg_extra_headers = gpg-extra/errno.h 27extra_cppflags = -idirafter gpg-extra 28else 29gpg_extra_headers = 30extra_cppflags = 31endif 32 33localedir = $(datadir)/locale 34bin_PROGRAMS = gpg-error 35lib_LTLIBRARIES = libgpg-error.la 36include_HEADERS = gpg-error.h 37bin_SCRIPTS = gpg-error-config 38m4datadir = $(datadir)/aclocal 39m4data_DATA = gpg-error.m4 40 41EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ 42 mkerrnos.awk errnos.in README \ 43 mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \ 44 mkheader.awk gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \ 45 err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 \ 46 gpg-error.def.in versioninfo.rc.in 47 48BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \ 49 err-sources-sym.h err-codes-sym.h errnos-sym.h gpg-error.h \ 50 gpg-error.def extra-h.in mkw32errmap.map.c 51 52tmp_files = _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c 53 54CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \ 55 gpg-error.h mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \ 56 mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \ 57 gpg-extra/errno.h extra-h.in $(tmp_files) 58 59if HAVE_W32_SYSTEM 60arch_sources = w32-gettext.c 61 62RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 63 -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS) $(CPPFLAGS) 64LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) 65 66SUFFIXES = .rc .lo 67 68.rc.lo: 69 $(LTRCCOMPILE) -i "$<" -o "$@" 70 71gpg_error_res = versioninfo.lo 72no_undefined = -no-undefined 73export_symbols = -export-symbols gpg-error.def 74 75install-def-file: gpg-error.def 76 $(INSTALL) gpg-error.def $(DESTDIR)$(libdir)/gpg-error.def 77 78uninstall-def-file: 79 -rm $(DESTDIR)$(libdir)/gpg-error.def 80 81libgpg_error_la_DEPENDENCIES = $(gpg_error_res) gpg-error.def 82intllibs = 83 84else 85arch_sources = 86gpg_error_res = 87no_undefined = 88export_symbols = 89install-def-file: 90uninstall-def-file: 91 92intllibs = @LTLIBINTL@ 93 94endif 95 96 97libgpg_error_la_LDFLAGS = -version-info \ 98 @LIBGPG_ERROR_LT_CURRENT@:@LIBGPG_ERROR_LT_REVISION@:@LIBGPG_ERROR_LT_AGE@ \ 99 $(no_undefined) $(export_symbols) 100 101libgpg_error_la_SOURCES = gpg-error.h gettext.h $(arch_sources) \ 102 init.c init.h strsource.c strerror.c code-to-errno.c code-from-errno.c 103 104# Note that RCCOMPILE needs the same defines as ..._la_CPPFLAGS but 105# without the extra_cppflags because they may include am -idirafter 106# which is not supported by the RC compiler. 107libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags) 108libgpg_error_la_LIBADD = $(gpg_error_res) $(intllibs) 109 110gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c 111gpg_error_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags) 112gpg_error_LDADD = ./libgpg-error.la @LTLIBINTL@ 113 114# We build err-sources.h and err-codes.h in the source directory. 115# This is needed because gettext does only look into the source 116# directory to find the files listed in po/POTFILE.in. To make these 117# rules work we also need to depend on Makefile.am and not on the 118# generated files Makefile.in or Makefile. 119$(srcdir)/err-sources.h: Makefile.am mkstrtable.awk err-sources.h.in 120 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 \ 121 $(srcdir)/err-sources.h.in >$@ 122 123err-sources-sym.h: Makefile mkstrtable.awk err-sources.h.in 124 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \ 125 $(srcdir)/err-sources.h.in >$@ 126 127$(srcdir)/err-codes.h: Makefile.am mkstrtable.awk err-codes.h.in 128 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 \ 129 $(srcdir)/err-codes.h.in >$@ 130 131err-codes-sym.h: Makefile mkstrtable.awk err-codes.h.in 132 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \ 133 $(srcdir)/err-codes.h.in >$@ 134 135code-to-errno.h: Makefile mkerrnos.awk errnos.in 136 $(AWK) -f $(srcdir)/mkerrnos.awk $(srcdir)/errnos.in >$@ 137 138# It is correct to use $(CPP). We want the host's idea of the error codes. 139mkerrcodes.h: Makefile mkerrcodes.awk $(gpg_extra_headers) 140 $(AWK) -f $(srcdir)/mkerrcodes1.awk $(srcdir)/errnos.in >_$@ 141 $(CPP) $(extra_cppflags) _$@ | grep GPG_ERR_ | \ 142 $(AWK) -f $(srcdir)/mkerrcodes.awk >$@ 143 -rm _$@ 144 145if HAVE_W32CE_SYSTEM 146# It is correct to use $(CPP). We want the host's idea of the error codes. 147mkw32errmap.tab.h: Makefile mkw32errmap.c 148 $(CPP) -DRESOLVE_MACROS $(srcdir)/mkw32errmap.c | \ 149 grep '{&mkw32errmap_marker' >$@ 150mkw32errmap.map.c: mkw32errmap 151 ./mkw32errmap --map > $@ 152gpg-extra/errno.h: mkw32errmap 153 -$(MKDIR_P) gpg-extra 154 ./mkw32errmap > $@ 155else 156mkw32errmap.map.c: 157 echo "/*dummy*/" > $@ 158endif 159 160# We use CC proper for preprocessing thus we have to convince it that 161# the data is really to be preprocessed. 162gpg-error.def: Makefile gpg-error.def.in 163 cat $(srcdir)/gpg-error.def.in >_$@.h 164 $(CPP) $(DEFAULT_INCLUDES) $(INCLUDES) $(extra_cppflags) _$@.h | \ 165 grep -v '^#' >$@ 166 -rm _$@.h 167 168# It is correct to use $(CC_FOR_BUILD) here. We want to run the 169# program at build time. 170mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile 171 $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c 172 173if HAVE_W32CE_SYSTEM 174# It is correct to use $(CC_FOR_BUILD) here. We want to run the 175# program at build time. 176mkw32errmap: mkw32errmap.c mkw32errmap.tab.h Makefile 177 $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c 178endif 179 180code-from-errno.h: mkerrcodes Makefile 181 ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@ 182 183errnos-sym.h: Makefile mkstrtable.awk errnos.in 184 $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \ 185 -v prefix=GPG_ERR_ -v namespace=errnos_ \ 186 $(srcdir)/errnos.in >$@ 187 188extra-h.in: Makefile w32-add.h w32ce-add.h 189 -rm extra-h.in 190if HAVE_W32_SYSTEM 191 cat $(srcdir)/w32-add.h >>extra-h.in 192endif 193if HAVE_W32CE_SYSTEM 194 cat $(srcdir)/w32ce-add.h >>extra-h.in 195endif 196 echo EOF >>extra-h.in 197 198gpg-error.h: Makefile mkheader.awk err-sources.h.in err-codes.h.in \ 199 errnos.in extra-h.in gpg-error.h.in 200 $(AWK) -f $(srcdir)/mkheader.awk \ 201 $(srcdir)/err-sources.h.in \ 202 $(srcdir)/err-codes.h.in \ 203 $(srcdir)/errnos.in \ 204 extra-h.in \ 205 $(srcdir)/gpg-error.h.in > $@ 206 207 208install-data-local: 209if HAVE_W32CE_SYSTEM 210 -$(MKDIR_P) "$(DESTDIR)$(includedir)/gpg-extra" 211 $(INSTALL_DATA) gpg-extra/errno.h \ 212 "$(DESTDIR)$(includedir)/gpg-extra/errno.h" 213else 214 : 215endif 216