Improve support for non-colour displays by adding a mask of attributes to
[u/mdw/putty] / mkfiles.pl
index a669d21..b92dcb1 100755 (executable)
@@ -11,7 +11,7 @@ use FileHandle;
 
 open IN, "Recipe" or die "unable to open Recipe file\n";
 
-@incdirs = ("", "unix/");
+@incdirs = ("", "unix/", "mac/");
 
 $help = ""; # list of newline-free lines of help text
 %programs = (); # maps prog name + type letter to listref of objects/resources
@@ -57,7 +57,8 @@ while (<IN>) {
     $i = shift @objs;
     if ($groups{$i}) {
       foreach $j (@{$groups{$i}}) { unshift @objs, $j; }
-    } elsif (($i eq "[G]" or $i eq "[C]" or $i eq "[X]") and defined $prog) {
+    } elsif (($i eq "[G]" or $i eq "[C]" or
+             $i eq "[X]" or $i eq "[U]") and defined $prog) {
       $type = substr($i,1,1);
     } else {
       push @$listref, $i;
@@ -255,6 +256,16 @@ sub progrealnames {
   return @ret;
 }
 
+sub manpages {
+  my ($types,$suffix) = @_;
+
+  # assume that all UNIX programs have a man page
+  if($suffix eq "1" && $types =~ /X/) {
+    return map("$_.1", &progrealnames($types));
+  }
+  return ();
+}
+
 # Now we're ready to output the actual Makefiles.
 
 ##-- CygWin makefile
@@ -341,7 +352,7 @@ print
 "MAKEFILE = Makefile.bor\n".
 "\n".
 "# C compilation flags\n".
-"CFLAGS = -DWINVER=0x0401\n".
+"CFLAGS = -D_WINDOWS -DWINVER=0x0401\n".
 "\n".
 "# Get include directory for resource compiler\n".
 "!if !\$d(BCB)\n".
@@ -503,21 +514,30 @@ print
 "CC = \$(TOOLPATH)cc\n".
 "\n".
 &splitline("CFLAGS = -Wall -g -I. -I.. `gtk-config --cflags`")."\n".
-"LDFLAGS = `gtk-config --libs`\n".
+"XLDFLAGS = `gtk-config --libs`\n".
+"ULDFLAGS =#\n".
+"INSTALL=install\n",
+"INSTALL_PROGRAM=\$(INSTALL)\n",
+"INSTALL_DATA=\$(INSTALL)\n",
+"prefix=/usr/local\n",
+"exec_prefix=\$(prefix)\n",
+"bindir=\$(exec_prefix)/bin\n",
+"mandir=\$(prefix)/man\n",
+"man1dir=\$(mandir)/man1\n",
 "\n".
 ".SUFFIXES:\n".
 "\n".
 "%.o:\n".
 "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(XFLAGS) \$(CFLAGS) -c \$<\n".
 "\n";
-print &splitline("all:" . join "", map { " $_" } &progrealnames("X"));
+print &splitline("all:" . join "", map { " $_" } &progrealnames("XU"));
 print "\n\n";
-foreach $p (&prognames("X")) {
+foreach $p (&prognames("XU")) {
   ($prog, $type) = split ",", $p;
   $objstr = &objects($p, "X.o", undef, undef);
   print &splitline($prog . ": " . $objstr), "\n";
   $libstr = &objects($p, undef, undef, "-lX");
-  print &splitline("\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " .
+  print &splitline("\t\$(CC)" . $mw . " \$(${type}LDFLAGS) -o \$@ " .
                    $objstr . " $libstr", 69), "\n\n";
 }
 &deps("X.o", undef, "../", "/");
@@ -528,6 +548,13 @@ print
 "FORCE:\n".
 "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(XFLAGS) \$(CFLAGS) \$(VER) -c ../version.c\n".
 "clean:\n".
-"\trm -f *.o". (join "", map { " $_" } &progrealnames("X")) . "\n".
+"\trm -f *.o". (join "", map { " $_" } &progrealnames("XU")) . "\n".
+"\n",
+"install:\n",
+map("\t\$(INSTALL_PROGRAM) -m 755 $_ \$(bindir)/$_\n", &progrealnames("XU")),
+map("\t\$(INSTALL_DATA) -m 644 $_ \$(man1dir)/$_\n", &manpages("XU", "1")),
+"\n",
+"install-strip:\n",
+"\t\$(MAKE) install INSTALL_PROGRAM=\"\$(INSTALL_PROGRAM) -s\"\n",
 "\n";
 select STDOUT; close OUT;