5fd79ddd2e1d392a6ebfa26638ad9f5a92441983
[gpgme.git] / gpgme / Makefile.am
1 # Copyright (C) 2000 Werner Koch (dd9jn)
2 # Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
3
4 # This file is part of GPGME.
5
6 # GPGME is free software; you can redistribute it and/or modify it
7 # 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 # GPGME is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
14 # 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 ## Process this file with automake to produce Makefile.in
21
22 EXTRA_DIST = gpgme-config.in gpgme.m4 mkstatus libgpgme.vers \
23              versioninfo.rc.in gpgme.de
24 BUILT_SOURCES = status-table.h
25 MOSTLYCLEANFILES = status-table.h
26 bin_SCRIPTS = gpgme-config
27 m4datadir = $(datadir)/aclocal
28 m4data_DATA = gpgme.m4
29 include_HEADERS = gpgme.h
30
31 if HAVE_PTHREAD
32 ltlib_gpgme_pthread = libgpgme-pthread.la
33 else
34 ltlib_gpgme_pthread =
35 endif
36 if HAVE_PTH
37 ltlib_gpgme_pth = libgpgme-pth.la
38 else
39 ltlib_gpgme_pth =
40 endif
41
42 noinst_LTLIBRARIES = libgpgme-real.la
43 lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_pthread) $(ltlib_gpgme_pth)
44
45 if HAVE_LD_VERSION_SCRIPT
46 libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers
47 else
48 libgpgme_version_script_cmd =
49 endif
50
51 if BUILD_ASSUAN
52 assuan_cppflags = -I$(top_srcdir)/assuan
53 assuan_libobjs = ../assuan/libassuan.la
54 else
55 assuan_cppflags =
56 assuan_libobjs =
57 endif
58
59 if HAVE_DOSISH_SYSTEM
60 system_components = w32-util.c w32-sema.c w32-io.c
61 else
62 system_components = ath.h posix-util.c posix-sema.c posix-io.c
63 endif
64
65 if HAVE_GPGSM
66 gpgsm_components = engine-gpgsm.c
67 else
68 gpgsm_components =
69 endif
70
71 libgpgme_real_la_SOURCES =                                              \
72         gpgme.h util.h conversion.c get-env.c context.h ops.h           \
73         data.h data.c data-fd.c data-stream.c data-mem.c data-user.c    \
74         data-compat.c                                                   \
75         signers.c                                                       \
76         wait.c wait-global.c wait-private.c wait-user.c wait.h          \
77         op-support.c                                                    \
78         encrypt.c encrypt-sign.c decrypt.c decrypt-verify.c verify.c    \
79         sign.c passphrase.c progress.c                                  \
80         key.c keylist.c trust-item.c trustlist.c                        \
81         import.c export.c genkey.c delete.c edit.c                      \
82         engine.h engine-backend.h engine.c rungpg.c status-table.h      \
83         $(gpgsm_components) sema.h priv-io.h $(system_components)       \
84         debug.c debug.h gpgme.c version.c error.c
85
86 # libgpgme_la_SOURCES = ath.h ath.c
87 if HAVE_PTH
88   ath_pth_src = ath-pth-compat.c
89 else
90   ath_pth_src =
91 endif
92 if HAVE_PTHREAD
93   ath_pthread_src = ath-pthread-compat.c
94 else
95   ath_pthread_src =
96 endif
97 libgpgme_la_SOURCES = ath.h ath-compat.c $(ath_pth_src) $(ath_pthread_src)
98 libgpgme_pthread_la_SOURCES = ath.h ath-pthread.c
99 libgpgme_pth_la_SOURCES = ath.h ath-pth.c
100
101 AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@
102
103 libgpgme_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
104         @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
105 libgpgme_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
106         @LTLIBOBJS@ $(srcdir)/libgpgme.vers
107 libgpgme_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
108         @GPG_ERROR_LIBS@
109
110 libgpgme_pthread_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
111         @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
112 libgpgme_pthread_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
113         @LTLIBOBJS@ $(srcdir)/libgpgme.vers
114 libgpgme_pthread_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
115         -lpthread @GPG_ERROR_LIBS@
116
117 libgpgme_pth_la_CPPFLAGS = $(AM_CPPFLAGS) @PTH_CPPFLAGS@
118 libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \
119         $(libgpgme_version_script_cmd) -version-info \
120         @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
121 libgpgme_pth_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
122         @LTLIBOBJS@ $(srcdir)/libgpgme.vers
123 libgpgme_pth_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
124         @PTH_LIBS@ @GPG_ERROR_LIBS@
125
126 status-table.h : gpgme.h
127         $(srcdir)/mkstatus < $(srcdir)/gpgme.h > status-table.h
128
129 # Special code to build a DLL.  The current libtool (1.5.6) is not
130 # able to do this properly; we better use gcc's built in magic.  
131 if HAVE_W32_SYSTEM
132
133 w32_o_files = ath-compat.o conversion.o data-compat.o data-fd.o \
134               data-mem.o data-stream.o data-user.o data.o debug.o \
135               decrypt-verify.o decrypt.o delete.o edit.o encrypt-sign.o \
136               encrypt.o engine-gpgsm.o engine.o error.o export.o genkey.o \
137               get-env.o gpgme.o import.o key.o keylist.o memrchr.o \
138               op-support.o passphrase.o progress.o putc_unlocked.o \
139               rungpg.o sign.o signers.o trust-item.o trustlist.o \
140               ttyname_r.o vasprintf.o verify.o version.o \
141               w32-io.o w32-sema.o w32-util.o \
142               wait-global.o wait-private.o wait-user.o wait.o
143
144 all-local: gpgme.dll gpgme.dll.a
145
146 install-exec-hook:
147         cp gpgme.dll gpgme.dll.a $(DESTDIR)$(libdir)/
148         $(STRIP) $(DESTDIR)$(libdir)/gpgme.dll
149
150 gpgme.dll gpgme.dll.a: gpgme.def $(w32_o_files) versioninfo.o
151         $(CC) -shared -o gpgme.dll gpgme.def $(w32_o_files) \
152            versioninfo.o @GPG_ERROR_LIBS@ -Wl,--out-implib,gpgme.dll.a
153
154
155 .rc.o:
156         $(WINDRES) `test -f '$<' || echo '$(srcdir)/'`$< $@
157
158 endif