From f6adc8a9e1821f9f033ee964d486c7c7dd0b4372 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 20 Jan 2004 20:35:27 +0000 Subject: [PATCH] Alexey Savelyev's mkfiles.pl patch to support lcc-win32. This has caused a small amount of extra inconvenience at the tops of .rc files, but it's been positive overall since lcc has managed to point out some pedantic errors (typically static/extern mismatches between function prototypes and definitions) which everything else missed. [originally from svn r3744] --- mkfiles.pl | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pageant.c | 4 +++- pageant.rc | 6 ++++++ printing.c | 1 + puttygen.rc | 6 ++++++ win_res.rc | 6 ++++++ windlg.c | 1 + window.c | 9 ++++---- 8 files changed, 86 insertions(+), 6 deletions(-) diff --git a/mkfiles.pl b/mkfiles.pl index f9c48c0a..be9f01ff 100755 --- a/mkfiles.pl +++ b/mkfiles.pl @@ -988,3 +988,62 @@ foreach $arch (qw(PPC Carbon)) { } } select STDOUT; close OUT; + +##-- lcc makefile +open OUT, ">Makefile.lcc"; select OUT; +print +"# Makefile for PuTTY under lcc.\n". +"#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n". +"# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n"; +# lcc command line option is -D not /D +($_ = $help) =~ s/=\/D/=-D/gs; +print $_; +print +"\n". +"# If you rename this file to `Makefile', you should change this line,\n". +"# so that the .rsp files still depend on the correct makefile.\n". +"MAKEFILE = Makefile.lcc\n". +"\n". +"# C compilation flags\n". +"CFLAGS = -D_WINDOWS\n". +"\n". +"# Get include directory for resource compiler\n". +"\n". +".c.obj:\n". +&splitline("\tlcc -O -p6 \$(COMPAT) \$(FWHACK)". + " \$(XFLAGS) \$(CFLAGS) \$*.c",69)."\n". +".rc.res:\n". +&splitline("\tlrc \$(FWHACK) \$(RCFL) -r \$*.rc",69)."\n". +"\n"; +print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("GC")); +print "\n\n"; +foreach $p (&prognames("GC")) { + ($prog, $type) = split ",", $p; + $objstr = &objects($p, "X.obj", "X.res", undef); + print &splitline("$prog.exe: " . $objstr ), "\n"; + $subsystemtype = undef; + if ($prog eq "pageant" || $prog eq "putty" ||$prog eq "puttygen" || $prog eq "puttytel") { + $subsystemtype = "-subsystem windows"; } + my $libss = "shell32.lib wsock32.lib ws2_32.lib winspool.lib winmm.lib imm32.lib"; + print &splitline("\tlcclnk $subsystemtype -o $prog.exe $objstr $libss"); + print "\n\n"; +} + + +foreach $d (&deps("X.obj", "X.res", "", "\\")) { + print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})), + "\n"; +} +print +"\n". +"version.o: FORCE\n". +"# Hack to force version.o to be rebuilt always\n". +"FORCE:\n". +"\tlcc \$(FWHACK) \$(VER) \$(CFLAGS) /c version.c\n\n". +"clean:\n". +"\t-del *.obj\n". +"\t-del *.exe\n". +"\t-del *.res\n"; + +select STDOUT; close OUT; + diff --git a/pageant.c b/pageant.c index 9d39e46d..3ac9ca71 100644 --- a/pageant.c +++ b/pageant.c @@ -13,6 +13,8 @@ #include "misc.h" #include "tree234.h" +#include + #ifndef NO_SECURITY #include #endif @@ -49,7 +51,7 @@ static HMENU systray_menu, session_menu; static int already_running; static int requested_help; -static char *help_path; +char *help_path; static char *putty_path; #define IDM_PUTTY 0x0060 diff --git a/pageant.rc b/pageant.rc index 41050368..be532fbd 100644 --- a/pageant.rc +++ b/pageant.rc @@ -1,4 +1,8 @@ /* Some compilers, like Borland, don't have winresrc.h */ +#ifdef __LCC__ +#include +#else + #ifndef NO_WINRESRC_H #ifndef MSVC4 #include @@ -7,6 +11,8 @@ #endif #endif +#endif /* end #ifdef __LCC__ + /* Some systems don't define this, so I do it myself if necessary */ #ifndef RT_MANIFEST #define RT_MANIFEST 24 diff --git a/printing.c b/printing.c index 6248881d..b8696520 100644 --- a/printing.c +++ b/printing.c @@ -3,6 +3,7 @@ */ #include "putty.h" +#include struct printer_enum_tag { int nprinters; diff --git a/puttygen.rc b/puttygen.rc index e1e0e088..ffef2eca 100644 --- a/puttygen.rc +++ b/puttygen.rc @@ -1,4 +1,8 @@ /* Some compilers, like Borland, don't have winresrc.h */ +#ifdef __LCC__ +#include +#else + #ifndef NO_WINRESRC_H #ifndef MSVC4 #include @@ -7,6 +11,8 @@ #endif #endif +#endif /* end #ifdef __LCC__ + /* Some systems don't define this, so I do it myself if necessary */ #ifndef RT_MANIFEST #define RT_MANIFEST 24 diff --git a/win_res.rc b/win_res.rc index d1fb112f..cd8bc3c2 100644 --- a/win_res.rc +++ b/win_res.rc @@ -1,4 +1,8 @@ /* Some compilers, like Borland, don't have winresrc.h */ +#ifdef __LCC__ +#include +#else + #ifndef NO_WINRESRC_H #ifndef MSVC4 #include @@ -7,6 +11,8 @@ #endif #endif +#endif /* end #ifdef __LCC__ + /* Some systems don't define this, so I do it myself if necessary */ #ifndef TCS_MULTILINE #define TCS_MULTILINE 0x0200 diff --git a/windlg.c b/windlg.c index a7c3776c..9c24449b 100644 --- a/windlg.c +++ b/windlg.c @@ -13,6 +13,7 @@ #include #include +#include #ifdef MSVC4 #define TVINSERTSTRUCT TV_INSERTSTRUCT diff --git a/window.c b/window.c index 9a9a5ce4..f13f0d4f 100644 --- a/window.c +++ b/window.c @@ -110,7 +110,6 @@ static struct unicode_data ucsdata; static int session_closed; static const struct telnet_special *specials; -static int specials_menu_position; static struct { HMENU menu; @@ -4601,7 +4600,7 @@ char *get_window_title(void *frontend, int icon) /* * See if we're in full-screen mode. */ -int is_full_screen() +static int is_full_screen() { if (!IsZoomed(hwnd)) return FALSE; @@ -4640,7 +4639,7 @@ static int get_fullscreen_rect(RECT * ss) * Go full-screen. This should only be called when we are already * maximised. */ -void make_full_screen() +static void make_full_screen() { DWORD style; RECT ss; @@ -4674,7 +4673,7 @@ void make_full_screen() /* * Clear the full-screen attributes. */ -void clear_full_screen() +static void clear_full_screen() { DWORD oldstyle, style; @@ -4704,7 +4703,7 @@ void clear_full_screen() /* * Toggle full-screen mode. */ -void flip_full_screen() +static void flip_full_screen() { if (is_full_screen()) { ShowWindow(hwnd, SW_RESTORE);