Blame src/Makefile.am

Packit fc043f
# Makefile.am for libgpg-error.
Packit fc043f
# Copyright (C) 2003, 2004, 2014 g10 Code GmbH
Packit fc043f
#
Packit fc043f
# This file is part of libgpg-error.
Packit fc043f
#
Packit fc043f
# libgpg-error is free software; you can redistribute it and/or modify
Packit fc043f
# it under the terms of the GNU Lesser General Public License as
Packit fc043f
# published by the Free Software Foundation; either version 2.1 of the
Packit fc043f
# License, or (at your option) any later version.
Packit fc043f
#
Packit fc043f
# libgpg-error is distributed in the hope that it will be useful,
Packit fc043f
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit fc043f
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit fc043f
# GNU Lesser General Public License for more details.
Packit fc043f
#
Packit fc043f
# You should have received a copy of the GNU Lesser General Public
Packit fc043f
# License along with this program; if not, see <https://www.gnu.org/licenses/>.
Packit fc043f
# SPDX-License-Identifier: LGPL-2.1+
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# We distribute the generated sources err-sources.h and err-codes.h,
Packit fc043f
# because they are needed to build the po directory, and they don't
Packit fc043f
# depend on the configuration anyway.
Packit fc043f
#
Packit fc043f
Packit fc043f
if HAVE_W32CE_SYSTEM
Packit fc043f
gpg_extra_headers = gpg-extra/errno.h
Packit fc043f
extra_cppflags = -idirafter gpg-extra
Packit fc043f
else
Packit fc043f
gpg_extra_headers =
Packit fc043f
extra_cppflags =
Packit fc043f
endif
Packit fc043f
Packit fc043f
localedir = $(datadir)/locale
Packit fc043f
Packit fc043f
bin_PROGRAMS = gpg-error
Packit fc043f
Packit fc043f
if HAVE_W32_SYSTEM
Packit fc043f
noinst_PROGRAMS = gen-w32-lock-obj
Packit fc043f
else
Packit fc043f
noinst_PROGRAMS = gen-posix-lock-obj
Packit fc043f
endif
Packit fc043f
Packit fc043f
# Distributed lock object definitions for cross compilation.
Packit fc043f
lock_obj_pub = \
Packit fc043f
        syscfg/lock-obj-pub.aarch64-unknown-linux-gnu.h     \
Packit fc043f
	syscfg/lock-obj-pub.aarch64-apple-darwin.h          \
Packit fc043f
        syscfg/lock-obj-pub.alpha-unknown-linux-gnu.h       \
Packit fc043f
        syscfg/lock-obj-pub.arm-unknown-linux-androideabi.h \
Packit fc043f
        syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h     \
Packit fc043f
	syscfg/lock-obj-pub.arm-apple-darwin.h              \
Packit fc043f
        syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h        \
Packit fc043f
	syscfg/lock-obj-pub.i386-apple-darwin.h             \
Packit fc043f
        syscfg/lock-obj-pub.i686-pc-gnu.h                   \
Packit fc043f
        syscfg/lock-obj-pub.i686-pc-kfreebsd-gnu.h          \
Packit fc043f
        syscfg/lock-obj-pub.i686-pc-linux-gnu.h             \
Packit fc043f
        syscfg/lock-obj-pub.m68k-unknown-linux-gnu.h        \
Packit fc043f
        syscfg/lock-obj-pub.mips-unknown-linux-gnu.h        \
Packit fc043f
        syscfg/lock-obj-pub.mips64el-unknown-linux-gnuabi64.h \
Packit fc043f
        syscfg/lock-obj-pub.mipsel-unknown-linux-gnu.h      \
Packit fc043f
	syscfg/lock-obj-pub.nios2-unknown-linux-gnu.h       \
Packit fc043f
        syscfg/lock-obj-pub.or1k-unknown-linux-gnu.h        \
Packit fc043f
        syscfg/lock-obj-pub.powerpc-unknown-linux-gnu.h     \
Packit fc043f
        syscfg/lock-obj-pub.powerpc64-unknown-linux-gnu.h   \
Packit fc043f
	syscfg/lock-obj-pub.powerpc64le-unknown-linux-gnu.h \
Packit fc043f
	syscfg/lock-obj-pub.powerpc-unknown-linux-gnuspe.h  \
Packit fc043f
	syscfg/lock-obj-pub.riscv64-unknown-linux-gnu.h     \
Packit fc043f
        syscfg/lock-obj-pub.s390x-ibm-linux-gnu.h           \
Packit fc043f
        syscfg/lock-obj-pub.sh3-unknown-linux-gnu.h         \
Packit fc043f
        syscfg/lock-obj-pub.sh4-unknown-linux-gnu.h         \
Packit fc043f
        syscfg/lock-obj-pub.sparc-unknown-linux-gnu.h       \
Packit fc043f
        syscfg/lock-obj-pub.sparc64-unknown-linux-gnu.h     \
Packit fc043f
	syscfg/lock-obj-pub.x86_64-apple-darwin.h           \
Packit fc043f
        syscfg/lock-obj-pub.x86_64-pc-kfreebsd-gnu.h        \
Packit fc043f
        syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h           \
Packit fc043f
        syscfg/lock-obj-pub.x86_64-pc-linux-gnux32.h        \
Packit fc043f
        syscfg/lock-obj-pub.x86_64-pc-linux-musl.h          \
Packit fc043f
	syscfg/lock-obj-pub.tilegx-unknown-linux-gnu.h      \
Packit fc043f
	syscfg/lock-obj-pub.ia64-unknown-linux-gnu.h        \
Packit fc043f
	syscfg/lock-obj-pub.mingw32.h
Packit fc043f
Packit fc043f
Packit fc043f
lib_LTLIBRARIES = libgpg-error.la
Packit fc043f
nodist_include_HEADERS = gpg-error.h gpgrt.h
Packit fc043f
bin_SCRIPTS = gpg-error-config
Packit fc043f
nodist_bin_SCRIPTS = gpgrt-config
Packit fc043f
m4datadir = $(datadir)/aclocal
Packit fc043f
m4data_DATA = gpg-error.m4 gpgrt.m4
Packit fc043f
Packit fc043f
EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \
Packit fc043f
	mkerrnos.awk errnos.in README \
Packit fc043f
	mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \
Packit fc043f
	mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \
Packit fc043f
	err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 gpgrt.m4 \
Packit fc043f
	gpg-error.vers gpg-error.def.in \
Packit fc043f
        versioninfo.rc.in gpg-error.w32-manifest.in \
Packit fc043f
	$(lock_obj_pub)
Packit fc043f
Packit fc043f
BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
Packit fc043f
	err-sources-sym.h err-codes-sym.h errnos-sym.h gpg-error.h gpgrt.h \
Packit fc043f
	gpgrt-config gpg-error.def mkw32errmap.map.c
Packit fc043f
Packit fc043f
tmp_files = _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c
Packit fc043f
Packit fc043f
CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
Packit fc043f
	gpg-error.h gpgrt.h gpgrt-config \
Packit fc043f
        mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
Packit fc043f
	mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
Packit fc043f
	gpg-extra/errno.h mkheader $(tmp_files) lock-obj-pub.native.h
Packit fc043f
Packit fc043f
Packit fc043f
#
Packit fc043f
# {{{ Begin Windows part
Packit fc043f
#
Packit fc043f
if HAVE_W32_SYSTEM
Packit fc043f
arch_sources = w32-gettext.c w32-lock.c w32-lock-obj.h w32-thread.c \
Packit fc043f
	       w32-iconv.c w32-estream.c w32-reg.c spawn-w32.c
Packit fc043f
RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
Packit fc043f
            -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS) $(CPPFLAGS)
Packit fc043f
LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
Packit fc043f
Packit fc043f
SUFFIXES = .rc .lo
Packit fc043f
Packit fc043f
.rc.lo:
Packit fc043f
	$(LTRCCOMPILE) -i "$<" -o "$@"
Packit fc043f
Packit fc043f
gpg_error_res = versioninfo.lo
Packit fc043f
no_undefined = -no-undefined
Packit fc043f
export_symbols = -export-symbols gpg-error.def
Packit fc043f
# i686-w64-mingw32.gcc version 4.9.1 takes the long long helper
Packit fc043f
# functions from libgcc_s_sjlj-1.dll and not from a static libgcc.  As
Packit fc043f
# a plain C program we do not use exception handler and thus there is
Packit fc043f
# no need to use this DLL.  Thus we force gcc to link that statically.
Packit fc043f
extra_ltoptions = -XCClinker -static-libgcc
Packit fc043f
Packit fc043f
versioninfo.lo : gpg-error.w32-manifest
Packit fc043f
Packit fc043f
install-def-file: gpg-error.def
Packit fc043f
	-$(INSTALL) -d $(DESTDIR)$(libdir)
Packit fc043f
	$(INSTALL) gpg-error.def $(DESTDIR)$(libdir)/gpg-error.def
Packit fc043f
Packit fc043f
uninstall-def-file:
Packit fc043f
	-rm $(DESTDIR)$(libdir)/gpg-error.def
Packit fc043f
Packit fc043f
libgpg_error_la_DEPENDENCIES = $(gpg_error_res) gpg-error.def
Packit fc043f
intllibs =
Packit fc043f
socklibs = -lws2_32
Packit fc043f
Packit fc043f
#
Packit fc043f
# }}} End Windows part
Packit fc043f
#
Packit fc043f
else
Packit fc043f
#
Packit fc043f
# {{{ Begin Unix part
Packit fc043f
#
Packit fc043f
arch_sources = posix-lock.c posix-lock-obj.h posix-thread.c spawn-posix.c
Packit fc043f
gpg_error_res =
Packit fc043f
no_undefined =
Packit fc043f
export_symbols =
Packit fc043f
extra_ltoptions =
Packit fc043f
Packit fc043f
install-def-file:
Packit fc043f
uninstall-def-file:
Packit fc043f
Packit fc043f
intllibs = @LTLIBINTL@
Packit fc043f
socklibs =
Packit fc043f
Packit fc043f
endif
Packit fc043f
#
Packit fc043f
# }}} End Unix part
Packit fc043f
#
Packit fc043f
Packit fc043f
if HAVE_LD_VERSION_SCRIPT
Packit fc043f
  libgpg_error_vers_opt = -Wl,--version-script=$(srcdir)/gpg-error.vers
Packit fc043f
else
Packit fc043f
  libgpg_error_vers_opt =
Packit fc043f
endif
Packit fc043f
Packit fc043f
libgpg_error_la_LDFLAGS = \
Packit fc043f
  $(no_undefined) $(export_symbols) $(libgpg_error_vers_opt) \
Packit fc043f
  $(extra_ltoptions) -version-info \
Packit fc043f
  @LIBGPG_ERROR_LT_CURRENT@:@LIBGPG_ERROR_LT_REVISION@:@LIBGPG_ERROR_LT_AGE@
Packit fc043f
Packit fc043f
libgpg_error_la_SOURCES = gettext.h $(arch_sources) \
Packit fc043f
	gpgrt-int.h init.c init.h version.c lock.h thread.h \
Packit fc043f
	estream.c estream-printf.c estream-printf.h \
Packit fc043f
	strsource.c strerror.c code-to-errno.c code-from-errno.c \
Packit fc043f
	visibility.c visibility.h \
Packit fc043f
	sysutils.c \
Packit fc043f
	syscall-clamp.c \
Packit fc043f
	logging.c \
Packit fc043f
	b64dec.c b64enc.c \
Packit fc043f
	argparse.c
Packit fc043f
Packit fc043f
Packit fc043f
nodist_libgpg_error_la_SOURCES = gpg-error.h
Packit fc043f
Packit fc043f
# libgpg_error_la_DEPENDENCIES = \
Packit fc043f
#        $(srcdir)/gpg-error.vers
Packit fc043f
Packit fc043f
# Note that RCCOMPILE needs the same defines as ..._la_CPPFLAGS but
Packit fc043f
# without the extra_cppflags because they may include am -idirafter
Packit fc043f
# which is not supported by the RC compiler.
Packit fc043f
libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags)
Packit fc043f
libgpg_error_la_LIBADD = $(gpg_error_res) $(intllibs) $(socklibs) $(LIBTHREAD)
Packit fc043f
Packit fc043f
gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c
Packit fc043f
gpg_error_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
Packit fc043f
                     -DLOCALEDIR=\"$(localedir)\" $(extra_cppflags)
Packit fc043f
gpg_error_LDADD = ./libgpg-error.la $(LTLIBINTL)
Packit fc043f
Packit fc043f
# We build err-sources.h and err-codes.h in the source directory.
Packit fc043f
# This is needed because gettext does only look into the source
Packit fc043f
# directory to find the files listed in po/POTFILE.in.  To make these
Packit fc043f
# rules work we also need to depend on Makefile.am and not on the
Packit fc043f
# generated files Makefile.in or Makefile.
Packit fc043f
$(srcdir)/err-sources.h: Makefile.am mkstrtable.awk err-sources.h.in
Packit fc043f
	$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 \
Packit fc043f
		$(srcdir)/err-sources.h.in >$@
Packit fc043f
Packit fc043f
err-sources-sym.h: Makefile mkstrtable.awk err-sources.h.in
Packit fc043f
	$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
Packit fc043f
		$(srcdir)/err-sources.h.in >$@
Packit fc043f
Packit fc043f
$(srcdir)/err-codes.h: Makefile.am mkstrtable.awk err-codes.h.in
Packit fc043f
	$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 \
Packit fc043f
		$(srcdir)/err-codes.h.in >$@
Packit fc043f
Packit fc043f
err-codes-sym.h: Makefile mkstrtable.awk err-codes.h.in
Packit fc043f
	$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
Packit fc043f
		$(srcdir)/err-codes.h.in >$@
Packit fc043f
Packit fc043f
code-to-errno.h: Makefile mkerrnos.awk errnos.in
Packit fc043f
	$(AWK) -f $(srcdir)/mkerrnos.awk $(srcdir)/errnos.in >$@
Packit fc043f
Packit fc043f
# It is correct to use $(CPP).  We want the host's idea of the error codes.
Packit fc043f
mkerrcodes.h: Makefile mkerrcodes.awk $(gpg_extra_headers)
Packit fc043f
	$(AWK) -f $(srcdir)/mkerrcodes1.awk $(srcdir)/errnos.in >_$@
Packit fc043f
	$(CPP) $(CPPFLAGS) $(extra_cppflags) -P _$@ | grep GPG_ERR_ | \
Packit fc043f
               $(AWK) -f $(srcdir)/mkerrcodes.awk >$@
Packit fc043f
	-rm _$@
Packit fc043f
Packit fc043f
if HAVE_W32CE_SYSTEM
Packit fc043f
# It is correct to use $(CPP).  We want the host's idea of the error codes.
Packit fc043f
mkw32errmap.tab.h: Makefile mkw32errmap.c
Packit fc043f
	$(CPP) -DRESOLVE_MACROS $(srcdir)/mkw32errmap.c | \
Packit fc043f
	      grep '{&mkw32errmap_marker' >$@
Packit fc043f
mkw32errmap.map.c: mkw32errmap
Packit fc043f
	./mkw32errmap --map > $@
Packit fc043f
gpg-extra/errno.h: mkw32errmap
Packit fc043f
	-$(MKDIR_P) gpg-extra
Packit fc043f
	./mkw32errmap > $@
Packit fc043f
else
Packit fc043f
mkw32errmap.map.c:
Packit fc043f
	echo "/*dummy*/" > $@
Packit fc043f
endif
Packit fc043f
Packit fc043f
# We use CC proper for preprocessing thus we have to convince it that
Packit fc043f
# the data is really to be preprocessed.
Packit fc043f
gpg-error.def: Makefile gpg-error.def.in
Packit fc043f
	cat $(srcdir)/gpg-error.def.in >_$@.h
Packit fc043f
	$(CPP) $(DEFAULT_INCLUDES) $(INCLUDES) $(extra_cppflags) _$@.h | \
Packit fc043f
	  grep -v '^#' >$@
Packit fc043f
	-rm _$@.h
Packit fc043f
Packit fc043f
# It is correct to use $(CC_FOR_BUILD) here.  We want to run the
Packit fc043f
# program at build time.
Packit fc043f
mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
Packit fc043f
	$(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
Packit fc043f
Packit fc043f
if HAVE_W32CE_SYSTEM
Packit fc043f
# It is correct to use $(CC_FOR_BUILD) here.  We want to run the
Packit fc043f
# program at build time.
Packit fc043f
mkw32errmap: mkw32errmap.c mkw32errmap.tab.h Makefile
Packit fc043f
	$(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
Packit fc043f
endif
Packit fc043f
Packit fc043f
code-from-errno.h: mkerrcodes Makefile
Packit fc043f
	./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
Packit fc043f
Packit fc043f
errnos-sym.h: Makefile mkstrtable.awk errnos.in
Packit fc043f
	$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
Packit fc043f
		-v prefix=GPG_ERR_ -v namespace=errnos_ \
Packit fc043f
		$(srcdir)/errnos.in >$@
Packit fc043f
Packit fc043f
Packit fc043f
mkheader: mkheader.c Makefile
Packit fc043f
	$(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
Packit fc043f
Packit fc043f
parts_of_gpg_error_h = 	 	\
Packit fc043f
	gpg-error.h.in  	\
Packit fc043f
	err-sources.h.in 	\
Packit fc043f
	err-codes.h.in 	 	\
Packit fc043f
	errnos.in 	 	\
Packit fc043f
	w32-add.h	 	\
Packit fc043f
	w32ce-add.h      	\
Packit fc043f
	$(lock_obj_pub)
Packit fc043f
Packit fc043f
# If we are cross-compiling or building on Windows we better make sure
Packit fc043f
# that no stale native lock include file will be found by mkheader.
Packit fc043f
if FORCE_USE_SYSCFG
Packit fc043f
pre_mkheader_cmds = if test -f lock-obj-pub.native.h; \
Packit fc043f
                    then rm lock-obj-pub.native.h; fi
Packit fc043f
else
Packit fc043f
pre_mkheader_cmds = :
Packit fc043f
parts_of_gpg_error_h += ./lock-obj-pub.native.h
Packit fc043f
Packit fc043f
./lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h
Packit fc043f
	./gen-posix-lock-obj >$@
Packit fc043f
endif
Packit fc043f
Packit fc043f
# We also depend on versioninfo.rc because that is build by
Packit fc043f
# config.status and thus has up-to-date version numbers.
Packit fc043f
gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) \
Packit fc043f
             versioninfo.rc ../config.h
Packit fc043f
	$(pre_mkheader_cmds)
Packit fc043f
	./mkheader $(host_os) $(host_triplet)  $(srcdir)/gpg-error.h.in \
Packit fc043f
                   ../config.h $(PACKAGE_VERSION) $(VERSION_NUMBER) >$@
Packit fc043f
Packit fc043f
gpgrt.h: gpg-error.h
Packit fc043f
	cp gpg-error.h gpgrt.h
Packit fc043f
Packit fc043f
gpgrt-config: gpg-error-config
Packit fc043f
	cp gpg-error-config gpgrt-config
Packit fc043f
Packit fc043f
install-data-local:
Packit fc043f
if HAVE_W32CE_SYSTEM
Packit fc043f
	-$(MKDIR_P) "$(DESTDIR)$(includedir)/gpg-extra"
Packit fc043f
	$(INSTALL_DATA) gpg-extra/errno.h \
Packit fc043f
                         "$(DESTDIR)$(includedir)/gpg-extra/errno.h"
Packit fc043f
else
Packit fc043f
        :
Packit fc043f
endif