From a3349385d69e9009a34798928f2bad6549fc745a Mon Sep 17 00:00:00 2001
From: Joerg Wunsch <j@uriah.heep.sax.de>
Date: Thu, 25 Jan 2007 20:51:11 +0000
Subject: [PATCH] Rearrange everything so it is now built into a libavrdude.a
 library, and link main.c against that library.

Add AC_PROG_RANLIB to configure.ac as we are building a library now.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@723 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 avrdude/ChangeLog    |  7 +++++++
 avrdude/Makefile.am  | 16 ++++++++++++----
 avrdude/NEWS         |  4 ++++
 avrdude/configure.ac |  1 +
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog
index 374a8afe..e2b1d94e 100644
--- a/avrdude/ChangeLog
+++ b/avrdude/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-25 Joerg Wunsch <j@uriah.heep.sax.de>
+
+	* Makefile.am: Rearrange everything so it is now built into a
+	libavrdude.a library, and link main.c against that library.
+	* configure.ac: Add AC_PROG_RANLIB as we are building a library
+	now.
+
 2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
 
 	Major code cleanup.
diff --git a/avrdude/Makefile.am b/avrdude/Makefile.am
index 0318eac1..6d34dada 100644
--- a/avrdude/Makefile.am
+++ b/avrdude/Makefile.am
@@ -45,12 +45,18 @@ AM_YFLAGS    = -d
 
 avrdude_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\"
 
-avrdude_CFLAGS   = @ENABLE_WARNINGS@  
+libavrdude_a_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\"
 
-avrdude_LDADD  = @LIBUSB@ @LIBHID@
+avrdude_CFLAGS   = @ENABLE_WARNINGS@
+
+libavrdude_a_CFLAGS   = @ENABLE_WARNINGS@
+
+avrdude_LDADD  = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB@ @LIBHID@
 
 bin_PROGRAMS = avrdude
 
+noinst_LIBRARIES = libavrdude.a
+
 # automake thinks these generated files should be in the distribution,
 # but this might cause trouble for some users, so we rather don't want
 # to have them there.
@@ -66,7 +72,7 @@ dist-hook:
 	$(distdir)/config_gram.c \
 	$(distdir)/config_gram.h
 
-avrdude_SOURCES = \
+libavrdude_a_SOURCES = \
 	config_gram.y \
 	lexer.l \
 	avr.c \
@@ -98,7 +104,6 @@ avrdude_SOURCES = \
 	linux_ppdev.h \
 	lists.c \
 	lists.h \
-	main.c \
 	my_ddk_hidsdi.h \
 	par.c \
 	par.h \
@@ -135,6 +140,9 @@ avrdude_SOURCES = \
 	update.h \
 	update.c
 
+avrdude_SOURCES = \
+	main.c
+
 man_MANS = avrdude.1
 
 sysconf_DATA = avrdude.conf
diff --git a/avrdude/NEWS b/avrdude/NEWS
index b4497728..05317e66 100644
--- a/avrdude/NEWS
+++ b/avrdude/NEWS
@@ -9,6 +9,10 @@ Current:
 
   * Bugfixes.
 
+  * Source code rearranged so that the functionality is now built
+    into a libavrdude.a library where main.c is currently the only
+    existing frontend.
+
 Version 5.3.1:
 
   * Add support for the AVR Dragon (all modes: ISP, JTAG, HVSP, PP,
diff --git a/avrdude/configure.ac b/avrdude/configure.ac
index 398a733f..3f6949f1 100644
--- a/avrdude/configure.ac
+++ b/avrdude/configure.ac
@@ -39,6 +39,7 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_YACC
 AM_PROG_LEX
+AC_PROG_RANLIB
 
 # Checks for libraries.
 AC_CHECK_LIB([termcap], [tputs])