X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/6ed3635b174797a39019e151b7af6d6288583601..b5752f1beb634f58852f8f3b32dc603f91a7b35f:/mkfiles.pl diff --git a/mkfiles.pl b/mkfiles.pl index a2b4dd9c..635f8f7d 100755 --- a/mkfiles.pl +++ b/mkfiles.pl @@ -29,12 +29,18 @@ close IN; foreach $i (split '\n',$store{'gui-apps'}) { $i =~ s/^# //; + $speciallibs = [split ' ', $i]; + $i = shift @$speciallibs; # take off project name $gui{$i} = 1; + $libs{$i} = $speciallibs; } foreach $i (split '\n',$store{'console-apps'}) { $i =~ s/^# //; - $gui{$i} = -0; + $speciallibs = [split ' ', $i]; + $i = shift @$speciallibs; # take off project name + $gui{$i} = 0; + $libs{$i} = $speciallibs; } sub project { @@ -70,11 +76,12 @@ print "# You may also need to tell windres where to find include files:\n". "# RCINC = --include-dir c:\\cygwin\\include\\\n". "\n". -"CFLAGS = -g -O2 -D_WINDOWS -DDEBUG\n". -"RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400\n". -"LIBS = -ladvapi32 -luser32 -lgdi32 -lwsock32 -lcomctl32 -lcomdlg32\n". +"CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT -D_NO_OLDNAMES -I.\n". +"LDFLAGS = -mno-cygwin -s\n". +"RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400 --define MINGW32_FIX=1\n". +"LIBS = -ladvapi32 -luser32 -lgdi32 -lwsock32 -lcomctl32 -lcomdlg32 -lwinmm\n". "OBJ=o\n". -"RES=o\n". +"RES=res.o\n". "\n"; print $store{"objdefs"}; print @@ -82,14 +89,20 @@ print ".SUFFIXES:\n". "\n". "%.o: %.c\n". -"\t\$(CC) \$(FWHACK) \$(CFLAGS) -c \$<\n". +"\t\$(CC) \$(COMPAT) \$(FWHACK) \$(XFLAGS) \$(CFLAGS) -c \$<\n". "\n". -"%.o: %.rc\n". +"%.res.o: %.rc\n". "\t\$(RC) \$(FWHACK) \$(RCFL) \$(RCFLAGS) \$< \$\@\n". "\n"; +print "all:"; +print map { " $_.exe" } @projects; +print "\n\n"; foreach $p (@projects) { print $p, ".exe: ", &project($p), "\n"; - print "\t\$(CC) \$(LDFLAGS) -o \$@ " . &project($p), " \$(LIBS)\n\n"; + my $mw = $gui{$p} ? " -mwindows" : ""; + $libstr = ""; + foreach $lib (@{$libs{$p}}) { $libstr .= " -l$lib"; } + print "\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " . &project($p), " \$(LIBS)$libstr\n\n"; } print $store{"dependencies"}; print @@ -106,7 +119,7 @@ select STDOUT; close OUT; ##-- Borland makefile open OUT, ">Makefile.bor"; select OUT; print -"# Makefile for PuTTY under Borland C.\n"; +"# Makefile for PuTTY under Borland C++.\n"; # bcc32 command line option is -D not /D ($_ = $store{"help"}) =~ s/=\/D/=-D/gs; print $_; @@ -116,19 +129,16 @@ print "# so that the .rsp files still depend on the correct makefile.\n". "MAKEFILE = Makefile.bor\n". "\n". -"# Stop windows.h including winsock2.h which would conflict with winsock 1\n". -"CFLAGS = -DWIN32_LEAN_AND_MEAN\n". -"\n". "# Get include directory for resource compiler\n". "!if !\$d(BCB)\n". "BCB = \$(MAKEDIR)\\..\n". "!endif\n". "\n". ".c.obj:\n". -"\tbcc32 \$(COMPAT) \$(FWHACK) \$(CFLAGS) /c \$*.c\n". +"\tbcc32 -w-aus -w-ccc -w-par \$(COMPAT) \$(FWHACK) \$(XFLAGS) \$(CFLAGS) /c \$*.c\n". ".rc.res:\n". -"\tbrc32 \$(FWHACK) \$(RCFL) -i \$(BCB)\\include \\\n". -"\t\t-r -DWIN32 -D_WIN32 -DWINVER=0x0400 \$*.rc\n". +"\tbrcc32 \$(FWHACK) \$(RCFL) -i \$(BCB)\\include \\\n". +"\t\t-r -DNO_WINRESRC_H -DWIN32 -D_WIN32 -DWINVER=0x0400 \$*.rc\n". "\n". "OBJ=obj\n". "RES=res\n". @@ -140,17 +150,24 @@ print map { " $_.exe" } @projects; print "\n\n"; foreach $p (@projects) { print $p, ".exe: ", &project($p), " $p.rsp\n"; - $tw = $gui{$p} ? " -tW" : ""; - print "\tbcc32$tw -e$p.exe \@$p.rsp\n"; - print "\tbrc32 -fe$p.exe " . (join " ", &project("resources.$p")) . "\n\n"; + $ap = $gui{$p} ? " -aa" : " -ap"; + print "\tilink32$ap -Gn -L\$(BCB)\\lib \@$p.rsp\n\n"; } foreach $p (@projects) { print $p, ".rsp: \$(MAKEFILE)\n"; - $arrow = ">"; - foreach $i (&projlist("objects.$p")) { - print "\techo \$($i) $arrow $p.rsp\n"; - $arrow = ">>"; + $c0w = $gui{$p} ? "c0w32" : "c0x32"; + print "\techo $c0w + > $p.rsp\n"; + @objlines = &projlist("objects.$p"); + for ($i=0; $i<=$#objlines; $i++) { + $plus = ($i < $#objlines ? " +" : ""); + print "\techo \$($objlines[$i])$plus >> $p.rsp\n"; } + print "\techo $p.exe >> $p.rsp\n"; + @libs = @{$libs{$p}}; + unshift @libs, "cw32", "import32"; + $libstr = join ' ', @libs; + print "\techo nul,$libstr, >> $p.rsp\n"; + print "\techo " . (join " ", &project("resources.$p")) . " >> $p.rsp\n"; print "\n"; } print $store{"dependencies"}; @@ -166,7 +183,9 @@ print "\tdel *.res\n". "\tdel *.pch\n". "\tdel *.aps\n". -"\tdel *.ilk\n". +"\tdel *.il*\n". "\tdel *.pdb\n". -"\tdel *.rsp\n"; +"\tdel *.rsp\n". +"\tdel *.tds\n". +"\tdel *.\$\$\$\$\$\$\n"; select STDOUT; close OUT;