diff --git a/ChangeLog b/ChangeLog
index 7dd67fbc7d6814f9bed15fe51bccd8851c3c250a..6051a2239ecf79f876fd68a69c3610220551f1ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-22  Niels M�ller  <nisse@lysator.liu.se>
+
+	* Makefile.in ($(des_headers)): Create files in $(srcdir).
+
 2008-11-28  Niels M�ller  <nisse@lysator.liu.se>
 
 	* testsuite/cxx-test.cxx: Include <cstdio>.
diff --git a/Makefile.in b/Makefile.in
index 666642952aeb449a591f5cc7b4185e486986af0d..aca4fda0311c08dfe5cc95a4b175b3ae65c3e6c7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -19,6 +19,7 @@ SUBDIRS = tools testsuite examples
 include config.make
 
 PRE_CPPFLAGS = -I.
+# FIXME: Add configuration of LIBEXT?
 LIBTARGETS = libnettle.a @IF_HOGWEED@ libhogweed.a
 SHLIBTARGETS = $(LIBNETTLE_FORLINK) @IF_HOGWEED@ $(LIBHOGWEED_FORLINK)
 
@@ -178,8 +179,9 @@ des_headers = parity.h rotors.h keymap.h
 # Generate DES headers.
 $(des_headers): desdata.c
 	$(MAKE) desdata$(EXEEXT)
-	./desdata$(EXEEXT) $(@F) > $@T
-	test -s $@T && mv -f $@T $@
+	f="$(srcdir)/`basename $@`"; \
+	  ./desdata$(EXEEXT) $(@F) > $${f}T; \
+	  test -s $${f}T && mv -f $${f}T $$f
 
 des.$(OBJEXT): des.c des.h $(des_headers)
 
@@ -302,7 +304,7 @@ uninstall-here: uninstall-info uninstall-headers uninstall-static \
 	        @IF_SHARED@ uninstall-shared
 
 uninstall-static:
-	for f in $(STATIC_LIBS) ; do \
+	for f in $(LIBTARGETS) ; do \
 	  rm -f $(DESTDIR)$(libdir)/$$f ; \
 	done