Index: src/gnc-module/Makefile.am
===================================================================
--- src/gnc-module/Makefile.am	(revision 14741)
+++ src/gnc-module/Makefile.am	(working copy)
@@ -50,24 +50,27 @@
 SCM_FILE_LINKS += ${gncmod_DATA}
 endif
 
-.scm-links: 
-	rm -f gnucash g-wrapped
-	$(LN_S) -f . gnucash
-	$(LN_S) -f . g-wrapped
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
+.scm-links:
+	$(RM) -rf gnucash g-wrapped
+	mkdir -p  gnucash g-wrapped
+	( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
 	touch .scm-links
 
-gw-gnc-module.scm gw-gnc-module.c gw-gnc-module.h: \
-  .scm-links gw-gnc-module-spec.scm ${top_builddir}/config.status
+clean-local:
+	$(RM) -rf gnucash g-wrapped
+
+.INTERMEDIATE: gwrap-files
+
+gw-gnc-module.scm gw-gnc-module.c gw-gnc-module.h: gwrap-files
+
+gwrap-files: .scm-links gw-gnc-module-spec.scm ${top_builddir}/config.status
 	FLAVOR=gnome $(GUILE) -c \
 	  "(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
 	  (primitive-load \"./gw-gnc-module-spec.scm\") \
 	  (gw:generate-wrapset \"gw-gnc-module\")"
+	touch $@
+	( cd g-wrapped; $(LN_S) ../gw-*.scm . )
 
 BUILT_SOURCES = gw-gnc-module.scm gw-gnc-module.h gw-gnc-module.c
-CLEANFILES = $(BUILT_SOURCES) .scm-links g-wrapped gnucash \
+CLEANFILES = $(BUILT_SOURCES) .scm-links \
 	${SCM_FILE_LINKS} gw-gnc-module.html
