Browse Source

2008-08-23 Marcus Brinkmann <marcus@g10code.com>

	* src/Makefile.am [HAVE_W32_SYSTEM]: Build autonomous DLL.
Marcus Brinkmann 17 years ago
parent
commit
b80a85ece8
2 changed files with 62 additions and 17 deletions
  1. 4 0
      ChangeLog
  2. 58 17
      src/Makefile.am

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2008-08-23  Marcus Brinkmann  <marcus@g10code.com>
+
+	* src/Makefile.am [HAVE_W32_SYSTEM]: Build autonomous DLL.
+
 2008-08-23  Marcus Brinkmann  <marcus@g10code.com>
 
 	* src/agent.c (gnupg_allow_set_foregound_window)

+ 58 - 17
src/Makefile.am

@@ -68,38 +68,48 @@ scute_version_script_cmd =
 endif
 
 
-EXEEXT = .dll
+lib_LTLIBRARIES = libscute.la
 
 if HAVE_W32_SYSTEM
 
-bin_PROGRAMS = scute
+LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
+     `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
+     sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
 
-AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GPG_ERROR_CFLAGS@ -shared
+SUFFIXES: .rc .lo
 
-scute_SOURCES = $(sources) versioninfo.rc
+.rc.lo:
+	$(LTRCCOMPILE) -i $< -o $@
 
-scute_DEPENDENCIES = @LTLIBOBJS@ versioninfo.o libgpg-error.a libassuan.a
+scute_res = versioninfo.lo
+scute_res_ldflag = -Wl,.libs/versioninfo.o
 
-libgpg-error.a:
-	ln -s $$($(GPG_ERROR_CONFIG) --prefix)/lib/libgpg-error.a .
+no_undefined = -no-undefined
+export_symbols = -export-symbols $(srcdir)/scute.def
 
-libassuan.a:
-	ln -s $$($(LIBASSUAN_CONFIG) --prefix)/lib/libassuan.a .
+install-def-file:
+	$(INSTALL) $(srcdir)/scute.def $(DESTDIR)$(libdir)/scute.def
 
-clean-local:
-	rm -f libgpg-error.a libassuan.a
+uninstall-def-file:
+	-rm $(DESTDIR)$(libdir)/scute.def
 
+scute_deps = $(scute_res) scute.def
 
-scute_LDADD = @LTLIBOBJS@ $(srcdir)/scute.def -L. -lassuan -lgpg-error 
+else
 
-.rc.o:
-	$(RC) -I $(srcdir) -I . `test -f '$<' || echo '$(srcdir)/'`$< $@
+scute_res =
+scute_res_ldflag =
+no_undefined =
+export_symbols =
+install-def-file:
+uninstall-def-file:
 
-else
+scute_deps =
 
-lib_LTLIBRARIES = libscute.la
+endif
 
-libscute_la_LDFLAGS = $(scute_version_script_cmd) -version-info \
+libscute_la_LDFLAGS = $(scute_res_ldflag) $(no_undefined) $(export_symbols) \
+	$(scute_version_script_cmd) -version-info \
 	@LIBSCUTE_LT_CURRENT@:@LIBSCUTE_LT_REVISION@:@LIBSCUTE_LT_AGE@
 libscute_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libscute.vers $(scute_deps)
 libscute_la_LIBADD = @LTLIBOBJS@ @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@
@@ -108,4 +118,35 @@ libscute_la_CPPFLAGS = -I$(srcdir)/../include \
 	@LIBASSUAN_CFLAGS@ @GPG_ERROR_CFLAGS@
 libscute_la_SOURCES = $(sources)
 
+# The above rules only build a static library on W32.  We build the
+# DLL below, such that it is autonomous (does not link to any other
+# non-standard DLL).
+
+EXEEXT = .dll
+
+if HAVE_W32_SYSTEM
+
+bin_PROGRAMS = scute
+
+AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GPG_ERROR_CFLAGS@ -shared
+
+scute_SOURCES = dllmain.c $(sources) versioninfo.rc
+
+scute_DEPENDENCIES = @LTLIBOBJS@ versioninfo.o libgpg-error.a libassuan.a
+
+libgpg-error.a:
+	ln -s $$($(GPG_ERROR_CONFIG) --prefix)/lib/libgpg-error.a .
+
+libassuan.a:
+	ln -s $$($(LIBASSUAN_CONFIG) --prefix)/lib/libassuan.a .
+
+clean-local:
+	rm -f libgpg-error.a libassuan.a
+
+
+scute_LDADD = @LTLIBOBJS@ $(srcdir)/scute.def -L. -lassuan -lgpg-error -lws2_32
+
+#.rc.o:
+#	$(RC) -I $(srcdir) -I . `test -f '$<' || echo '$(srcdir)/'`$< $@
+
 endif