Index: parrot-svn/languages/dotnet/Configure.pl
===================================================================
--- parrot-svn.orig/languages/dotnet/Configure.pl
+++ parrot-svn/languages/dotnet/Configure.pl
@@ -21,6 +21,7 @@ use Getopt::Long;
 
 # Parrot specific Perl 5 modules
 use Parrot::Config;
+use Parrot::Configure;
 
 # Parse command line.
 my ( $parrot_path, $mono_lib_path, $srm );
@@ -68,24 +69,18 @@ sub generate_makefile {
     # Generate class library make instructions.
     my $class_lib_make = generate_classlib_make($mono_lib_path);
 
-    # Read in makefile template.
-    open my $in_fh, '<', 'config/Makefile.in'
-        or die "Unable to open config/Makefile.in\n";
+    # Generate Makefile in two steps
+    my $conf = Parrot::Configure->new;
+    $conf->data()->slurp();
+    $conf->genfile('config/Makefile.in', 'config/Makefile.tmp');
+    # and read temp. makefile template to fill in ${trans_mono_lib_path}, ${trans_class_library}
+    open my $in_fh, '<', 'config/Makefile.tmp'
+        or die "Unable to open config/Makefile.tmp\n";
     my $makefile = join( '', <$in_fh> );
     close $in_fh;
 
-    # Sub in config data.
-    for ( keys %{$config} ) {
-        # warnings flags aren't substituted in Makefile.in; skip them
-        next if m/^-W/g;
-
-        $makefile =~ s/\${$_}/$config->{$_}/g;
-    }
-    $makefile =~ s/\$\{build_dir\}/$parrot_path/g;
-
     my $local_mono_lib_path = $mono_lib_path || q{};
     $makefile =~ s/\$\{trans_mono_lib_path\}/$local_mono_lib_path/g;
-
     $makefile =~ s/\$\{trans_class_library\}/$class_lib_make/g;
 
     # Write makefile.
Index: parrot-svn/languages/dotnet/config/Makefile.in
===================================================================
--- parrot-svn.orig/languages/dotnet/config/Makefile.in
+++ parrot-svn/languages/dotnet/config/Makefile.in
@@ -2,42 +2,45 @@
 # .NET CLI To PIR Translator
 # Copyright (C) Jonathan Worthington 2005, 2007
 # #############################################################################
-# Makefile
-# ########
-# THIS IS A GENERATED FILE! If you want to edit it, be sure you are editing the
-# template (config/Makefile.in).
-# #############################################################################
+# requires special treatment for: trans_mono_lib_path, trans_class_library
+# Configure.pl: generate_makefile
 
+HLLNAME       = dotnet # or net2pbc?
 
 # BUILD TOOLS AND UTILITIES
 # #########################
-PERL     = ${perl}
-RM_F     = ${rm_f}
-PARROT   = ${trans_parrot_path}${slash}parrot${exe}
-MONOLIB  = ${trans_mono_lib_path}
-PBCMERGE = ${trans_parrot_path}${slash}pbc_merge${exe}
-PBC_TO_EXE = ${trans_parrot_path}${slash}pbc_to_exe.exe
-PMCBUILD = $(PERL) ${build_dir}${slash}tools${slash}build${slash}dynpmc.pl
-OPSBUILD = $(PERL) ${build_dir}${slash}tools${slash}build${slash}dynoplibs.pl
-PARROT_DYNEXT  = ${build_dir}${slash}runtime${slash}parrot${slash}dynext
-#CONDITIONED_LINE(darwin):
-#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
-#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
-
+PERL          = @perl@
+RM_F          = @rm_f@
+CP            = @cp@
+MKPATH        = @mkpath@
+POD2MAN       = pod2man
+BUILD_DIR     = @build_dir@
+MONOLIB       = ${trans_mono_lib_path}
+#IF(cygwin):SHRPENV       = env PATH="@build_dir@/blib/lib:$(PATH)"
+#ELSIF(not win32):SHRPENV       = env LD_RUN_PATH="@build_dir@/blib/lib"
+PARROT        = $(SHRPENV) ../../parrot@exe@
+PBCMERGE      = $(SHRPENV) ../../pbc_merge@exe@
+PBC_TO_EXE    = $(SHRPENV) ../../pbc_to_exe@exe@
+BUILD_DYNPMC  = $(PERL) $(BUILD_DIR)/tools/build/dynpmc.pl
+RECONFIGURE   = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
+OPSBUILD      = $(PERL) $(BUILD_DIR)/tools/build/dynoplibs.pl
 
 # FILE EXTENSIONS
 # ###############
-O        = ${o}
-LOAD_EXT = ${load_ext}
-A        = ${a}
+LOAD_EXT      = @load_ext@
+O             = @o@
+A             = @a@
+EXE           = @exe@
 
 
 # DIRECTORIES AND FILES
 # #####################
-BIN_DIR   = @bin_dir@
-LIB_DIR   = @lib_dir@
-DOC_DIR   = @doc_dir@
-MANDIR	  = @mandir@
+BIN_DIR       = @bin_dir@
+LIB_DIR       = @lib_dir@
+DOC_DIR       = @doc_dir@
+MANDIR	      = @mandir@
+PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
+PARROT_LIB    = $(BUILD_DIR)/runtime/parrot/library
 PMCDIR    = pmc
 PMCS      = dotnetassembly dotnetclassmetadata dotnetmethodmetadata \
             dotnetfieldmetadata dotnetparammetadata dotnetsignature \
@@ -62,16 +65,18 @@ TRAN_PBC  = src/translator.pbc src/metho
 # BUILD TARGETS
 # #############
 
-all : pmc/dotnet$(LOAD_EXT) ops/dotnet_ops$(LOAD_EXT) src/it.pbc \
+build : net2pbc.pbc
+
+all : Makefile pmc/dotnet$(LOAD_EXT) ops/dotnet_ops$(LOAD_EXT) src/it.pbc \
       src/builtins.pbc src/translib.pbc net2pbc.pbc
 
-installable : net2pbc.pbc installable_net2pbc$exe
+installable : net2pbc.pbc installable_net2pbc$(EXE)
 
 pmc/dotnet$(LOAD_EXT) : $(PMC_FILES) pmc/structures.h pmc/tableinfo.h
-	@cd $(PMCDIR) && $(PMCBUILD) generate $(PMCS)
-	@cd $(PMCDIR) && $(PMCBUILD) compile $(PMCS)
-	@cd $(PMCDIR) && $(PMCBUILD) linklibs $(PMCS)
-	@cd $(PMCDIR) && $(PMCBUILD) copy "--destination=$(PARROT_DYNEXT)" $(PMCS)
+	@cd $(PMCDIR) && $(BUILD_DYNPMC) generate $(PMCS)
+	@cd $(PMCDIR) && $(BUILD_DYNPMC) compile $(PMCS)
+	@cd $(PMCDIR) && $(BUILD_DYNPMC) linklibs $(PMCS)
+	@cd $(PMCDIR) && $(BUILD_DYNPMC) copy "--destination=$(PARROT_DYNEXT)" $(PMCS)
 
 ops/dotnet_ops$(LOAD_EXT) : $(OPS_FILES)
 	@cd $(OPSDIR) && $(OPSBUILD) generate $(OPSLIB)
@@ -104,10 +109,10 @@ class-library : net2pbc.pbc
 Makefile: config/Makefile.in
 	$(PERL) Configure.pl
 
-net2pbc$exe : net2pbc.pbc
+net2pbc$(EXE) : net2pbc.pbc
 	$(PBC_TO_EXE) net2pbc.pbc
 
-installable_net2pbc$exe : net2pbc.pbc
+installable_net2pbc$(EXE) : net2pbc.pbc
 	$(PBC_TO_EXE) net2pbc.pbc --install
 
 
@@ -152,18 +157,18 @@ test : all
 
 # TODO: rename build_dir. basic run for missing libs
 installable_test : installable
-	./installable_net2pbc$exe
+	./installable_net2pbc$(EXE)
 
 install : all installable
-	cp installable_net2pbc$exe $(DESTDIR)$(BIN_DIR)/parrot-net2pbc@exe@
-	@cd $(PMCDIR) && $(PMCBUILD) copy "--destination=$(DESTDIR)$(LIB_DIR)/parrot/dynext" $(OPLIBS)
-	@cd $(PMCDIR) && $(PMCBUILD) copy "--destination=$(DESTDIR)$(LIB_DIR)/parrot/dynext" $(PMCS)
-	pod2man doc/running.pod > $(DESTDIR)$(MANDIR)/man1/parrot-net2pbc.1
-	mkdir $(DESTDIR)$(DOC_DIR)/languages/$(LANG)
-	cp $(DOCS) $(DESTDIR)$(DOC_DIR)/languages/$(LANG)
-	cp doc/*.pod $(DESTDIR)$(DOC_DIR)/languages/$(LANG)
-	mkdir $(DESTDIR)$(DOC_DIR)/languages/$(LANG)/constructs
-	cp doc/constructs/.pod $(DESTDIR)$(DOC_DIR)/languages/$(LANG)/constructs
+	$(CP) installable_net2pbc$(EXE) $(DESTDIR)$(BIN_DIR)/parrot-net2pbc$(EXE)
+	@cd $(PMCDIR) && $(BUILD_DYNPMC) copy "--destination=$(DESTDIR)$(LIB_DIR)/parrot/dynext" $(OPLIBS)
+	@cd $(PMCDIR) && $(BUILD_DYNPMC) copy "--destination=$(DESTDIR)$(LIB_DIR)/parrot/dynext" $(PMCS)
+	$(POD2MAN) doc/running.pod > $(DESTDIR)$(MANDIR)/man1/parrot-net2pbc.1
+	$(MKPATH) $(DESTDIR)$(DOC_DIR)/languages/$(LANG)
+	$(CP) $(DOCS) $(DESTDIR)$(DOC_DIR)/languages/$(LANG)
+	$(CP) doc/*.pod $(DESTDIR)$(DOC_DIR)/languages/$(LANG)
+	$(MKPATH) $(DESTDIR)$(DOC_DIR)/languages/$(LANG)/constructs
+	$(CP) doc/constructs/.pod $(DESTDIR)$(DOC_DIR)/languages/$(LANG)/constructs
 
 # CLEANUP TARGETS
 # ###############
@@ -193,10 +198,11 @@ CLEANERS = \
  "*.dll" \
  "src/*.pbc" \
  src/it.pir \
- src/builtins.pir
+ src/builtins.pir \
+ net2pbc$(EXE) installable_net2pbc$(EXE)
 
 clean:
 	$(RM_F) $(CLEANERS)
 
 realclean : clean
-	$(RM_F) Makefile config/N2PConfig.pm
+	$(RM_F) Makefile config/Makefile.tmp config/N2PConfig.pm
