Index: kefile
===================================================================
--- /Makefile	(revision 221)
+++ 	(revision )
@@ -1,38 +1,0 @@
-# $Id$
-
-# This Makefile is used only for packaging releases out of Subversion.
-################################################################################
-
-SVN_URL=svn+ssh://pascal.sentinelchicken.org/home/projects/subversion/reglookup
-SUB_DIRS=$(wildcard releases/*) trunk
-
-FILES=$(REGLOOKUP)
-.PHONY: all $(SUB_DIRS) clean doc
-export
-
-
-RELEASE_NAME=reglookup-trunk
-RELEASE_DEST=.
-
-all:
-	@echo "Please choose one target out of: $(SUB_DIRS)."
-
-
-$(SUB_DIRS):
-	rm -rf .release
-	mkdir .release
-	svn export $(SVN_URL)/$@/ .release/$(RELEASE_NAME)
-	#XXX: Can this be less of a hack?
-	cd .release/$(RELEASE_NAME)/doc && make release
-	cd .release\
-		&& tar cf $(RELEASE_NAME).tar $(RELEASE_NAME)\
-		&& gzip -9 $(RELEASE_NAME).tar
-	mv .release/$(RELEASE_NAME).tar.gz $(RELEASE_DEST)
-
-
-doc:
-	doxygen doc/Doxyfile.regfi
-
-clean:
-	rm -rf .release
-	rm -rf doc/regfi
Index: /SConstruct
===================================================================
--- /SConstruct	(revision 221)
+++ /SConstruct	(revision 222)
@@ -9,7 +9,11 @@
 win32_targets=('reglookup-win32-trunk.zip',)
 doc_targets=('reglookup-doc-trunk.tar.gz',)
+all_targets = source_targets+win32_targets+doc_targets 
 
 def target2version(target):
-    return target.split('-')[2].split('.')[0]
+    chunks = target.split('-')
+    if len(chunks) != 3:
+        return None
+    return chunks[2].split('.')[0]
 
 def version2input(version):
@@ -31,5 +35,5 @@
 rm -rf .release && mkdir -p .release/%s
 cp %s/src/*.exe .release/%s
-cp win32/libiconv/bin/*.dll win32/libpthreads/bin/*.dll win32/libtalloc/bin/*.dll .release/%s
+cp win32/libiconv/bin/*.dll win32/libpthreads/bin/*.dll win32/libtalloc/bin/*.dll trunk/lib/*.dll .release/%s
 cd .release && zip -r %s.zip %s
 mv .release/%s.zip . && rm -rf .release
@@ -73,7 +77,12 @@
                             libtalloc_path+'lib']
             env['LIBS']=['m', libpthread_name, 'iconv', 'regfi', 'talloc']
+            
+            # Third-party dependencies
+            extra_obj=['%s/lib/lib%s.a' % (libpthreads_path, libpthread_name),
+                       libiconv_path+'/lib/libiconv.dll.a',
+                       libtalloc_path+'/lib/libtalloc.dll.a']
 
-            
-            # Libraries
+            # Build libregfi.dll
+            #   Core regfi source
             lib_src = [input_prefix+'lib/regfi.c',
                        input_prefix+'lib/winsec.c',
@@ -81,10 +90,20 @@
                        input_prefix+'lib/lru_cache.c',
                        input_prefix+'lib/void_stack.c']
-            libregfi_static = env.Library(lib_src)
+            regfi_o = env.Object(lib_src)
 
-            extra_obj=['%s/lib/lib%s.a' % (libpthreads_path, libpthread_name),
-                       libiconv_path+'/lib/libiconv.dll.a',
-                       libtalloc_path+'/lib/libtalloc.dll.a',
-                       input_prefix+'lib/libregfi.a',]
+            regfi_obj = []
+            for s in lib_src:
+                regfi_obj.append(s[0:-1]+'o')
+
+            env.Command(input_prefix+'lib/libregfi.o', regfi_o+extra_obj,
+                        'i586-mingw32msvc-dlltool --export-all-symbols'
+                        +' --dllname libregfi.dll -e $TARGET'
+                        +' -l %slib/libregfi.dll.a %s' 
+                        % (input_prefix, ' '.join(regfi_obj)))
+
+            env.Command(input_prefix+'lib/libregfi.dll',
+                        input_prefix+'lib/libregfi.o',
+                        'i586-mingw32msvc-gcc --shared -o $TARGET $SOURCE %s'
+                        % ' '.join(regfi_obj+extra_obj))
 
             # Executables
@@ -99,8 +118,4 @@
         elif t in doc_targets:
             ret_val += doc_cmds % (t_base,t_base,t_base,t_base,t_base)
-
-        else:
-            return '#ERROR: cannot build "%s".  Acceptable targets: %s'\
-                   % (t, repr(source_targets+win32_targets+doc_targets))
         
     return ret_val
@@ -117,8 +132,14 @@
 env['BUILDERS']['Release'] = release_builder
 
+if len(COMMAND_LINE_TARGETS) == 0:
+    print('Acceptable targets: %s' % repr(all_targets))
 
 for target in COMMAND_LINE_TARGETS:
+    AlwaysBuild(target)
+    if target not in all_targets:
+        print('ERROR: cannot build "%s".  Acceptable targets: %s'
+              % (target, repr(all_targets)))
+        break
     env.Release(target, Dir(version2input(target2version(target))))
 
-
 Default(None)
Index: unk/Makefile
===================================================================
--- /trunk/Makefile	(revision 221)
+++ 	(revision )
@@ -1,76 +1,0 @@
-# $Id$
-
-# Installation prefixes.  Change to install elsewhere.
-
-PREFIX=/usr/local
-BIN_PREFIX=$(PREFIX)/bin
-DOC_PREFIX=$(PREFIX)/share/doc/reglookup
-MAN_PREFIX=$(PREFIX)/man
-
-################################################################################
-
-CC=gcc
-OPTS=-std=gnu99 -pedantic -Wall -ggdb
-#OPTS=-std=gnu99 -pedantic -Wall
-INC:=-I$(PWD)/include -I/usr/local/include 
-LIB=-L/usr/local/lib -lm -lpthread
-BIN_EXT=
-EXTRA_OBJ=
-
-UNAME := $(shell uname)
-ifneq ($(UNAME),Linux) 	
-  LIB:=$(LIB) -liconv
-endif
-
-
-################################################################################
-# MinGW cross-compiling build settings
-ifdef BUILD_MINGW
-
-## These may need to be changed
-CC=i586-mingw32msvc-cc
-LIBICONV_PATH=/usr/local/src/libiconv-1.9.2-1-lib
-
-## These probably do not need to be changed
-BIN_EXT=.exe
-INC:=$(INC) -I$(LIBICONV_PATH)/include
-EXTRA_OBJ=$(LIBICONV_PATH)/lib/libiconv.dll.a
-
-endif
-################################################################################
-
-
-BUILD=$(CURDIR)/build
-BUILD_BIN=$(BUILD)/bin
-BUILD_DOC=$(BUILD)/doc
-
-BUILD_TREE=$(BUILD_BIN) $(BUILD_DOC)
-SUB_DIRS=lib src doc bin
-
-FILES=$(REGLOOKUP)
-.PHONY: $(SUB_DIRS) clean
-export
-
-
-all: $(BUILD_TREE) $(SUB_DIRS)
-
-#XXX: This should be more generalized.
-install: all
-	mkdir -p $(BIN_PREFIX)
-	mkdir -p $(DOC_PREFIX)
-	mkdir -p $(MAN_PREFIX)/man1
-	$(MAKE) -C bin install
-	$(MAKE) -C src install
-	$(MAKE) -C doc install
-
-
-$(SUB_DIRS):
-	$(MAKE) -C $@
-
-$(BUILD_TREE):
-	mkdir -p $@
-
-clean:
-	$(MAKE) -C src clean
-	$(MAKE) -C lib clean
-	rm -rf $(BUILD)/*
