-@echo off
-if "%1" == "go32" goto h8300
-if "%1" == "h8/300" goto h8300
-echo Specify one of [ go32 h8/300 ] on command line
-goto exit
-
-:go32
-echo Configuring gas for go32
-copy config\i386.md md
-copy config\out-i386.c aux-output.c
-copy config\tm-i386gas.h tm.h
-copy config\float.h-ieee float.h
-copy config\xm-i386.h config.h
-copy Makefile.dos Makefile
-goto exit
-
-:h8300
-echo Configuring gas for H8/300
-copy config\ho-go32.h host.h
-copy config\tc-h8300.c targ-cpu.c
-copy config\tc-h8300.h targ-cpu.h
-copy config\te-generic.h targ-env.h
-copy config\objcoffbfd.h obj-format.h
-copy config\objcoffbfd.c obj-format.c
-copy config\atof-ieee.c atof-targ.c
-copy Makefile.dos Makefile
-
-:exit
+@echo off\r
+if "%1" == "h8/300" goto h8300\r
+\r
+echo Configuring gas for go32\r
+update config/tc-i386.c targ-cpu.c\r
+update config/tc-i386.h targ-cpu.h\r
+update config/te-go32.h targ-env.h\r
+update config/obj-coff.h obj-format.h\r
+update config/obj-coff.c obj-format.c\r
+update config/atof-ieee.c atof-targ.c\r
+goto common\r
+\r
+:h8300\r
+echo Configuring gas for H8/300\r
+copy config\ho-go32.h host.h\r
+copy config\tc-h8300.c targ-cpu.c\r
+copy config\tc-h8300.h targ-cpu.h\r
+copy config\te-generic.h targ-env.h\r
+copy config\objcoffbfd.h obj-format.h\r
+copy config\objcoffbfd.c obj-format.c\r
+copy config\atof-ieee.c atof-targ.c\r
+\r
+:common\r
+\r
+echo # Makefile generated by "configure.bat"> Makefile.2\r
+echo all.dos : as.new gasp.new>> Makefile.2\r
+\r
+if exist config.sed del config.sed\r
+\r
+echo "s/@srcdir@/./g ">> config.sed\r
+echo "s/@target_alias@/go32/ ">> config.sed\r
+echo "s/@prefix@// ">> config.sed\r
+echo "s/@CC@/gcc/g ">> config.sed\r
+echo "s/@OPCODES_LIB@/..\/opcodes\/libopcodes.a/g ">> config.sed\r
+echo "s/@BFDLIB@/..\/bfd\/libbfd.a/g ">> config.sed\r
+echo "s/@ALL_OBJ_DEPS@/..\/bfd\/bfd.h/g ">> config.sed\r
+\r
+echo "/^all[ ]*:/ a\ ">> config.sed\r
+echo "dummy: ">> config.sed\r
+\r
+echo "s/\/usr[^ ]*.h//g ">> config.sed\r
+\r
+echo "/^config.h[ ]*:/ d ">> config.sed\r
+echo "s/^Makefile/not-Makefile/ ">> config.sed\r
+\r
+sed -e "s/^\"//" -e "s/\"$//" -e "s/[ ]*$//" config.sed > config2.sed\r
+sed -f config2.sed Makefile.in >> Makefile.2\r
+update Makefile.2 Makefile\r
+del Makefile.2\r
+del config.sed\r
+del config2.sed\r
+\r
+echo #ifndef GAS_VERSION> config.new\r
+sed -n "/^VERSION=/p" Makefile.in | sed -e "s/VERSION=/#define GAS_VERSION \"/" -e "s/$/\"/">> config.new\r
+type config\go32.cfg >> config.new\r
+echo #endif>> config.new\r
+update config.new config.h\r