]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - mkfiles.pl
Fix __uint128_t compile error on MinGW.
[PuTTY.git] / mkfiles.pl
index 9ec915a0dd608fa8d5a244b28d12451e1ba49b02..f4365198ef47eed8fd497008193de27010c6b3ee 100755 (executable)
@@ -458,10 +458,10 @@ if (defined $makefiles{'cygwin'}) {
               (join " ", map {"-I$dirpfx$_"} @srcdirs)) .
               "\n".
     "LDFLAGS = -mno-cygwin -s\n".
-    &splitline("RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1".
-      " --define WINVER=0x0400")."\n".
+    &splitline("RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 ".
+      "--define WINVER=0x0400 ".(join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
     "\n".
-    $makefile_extra{'cygwin'}->{'vars'} .
+    &def($makefile_extra{'cygwin'}->{'vars'}) .
     "\n".
     ".SUFFIXES:\n".
     "\n";
@@ -491,7 +491,7 @@ if (defined $makefiles{'cygwin'}) {
       }
     }
     print "\n";
-    print $makefile_extra{'cygwin'}->{'end'};
+    print &def($makefile_extra{'cygwin'}->{'end'});
     print "\nclean:\n".
     "\trm -f *.o *.exe *.res.o *.so *.map\n".
     "\n".
@@ -540,7 +540,7 @@ if (defined $makefiles{'borland'}) {
     "BCB = \$(MAKEDIR)\\..\n".
     "!endif\n".
     "\n".
-    $makefile_extra{'borland'}->{'vars'} .
+    &def($makefile_extra{'borland'}->{'vars'}) .
     "\n".
     ".c.obj:\n".
     &splitline("\tbcc32 -w-aus -w-ccc -w-par -w-pia \$(COMPAT)".
@@ -597,7 +597,7 @@ if (defined $makefiles{'borland'}) {
       }
     }
     print "\n";
-    print $makefile_extra{'borland'}->{'end'};
+    print &def($makefile_extra{'borland'}->{'end'});
     print "\nclean:\n".
     "\t-del *.obj\n".
     "\t-del *.exe\n".
@@ -636,9 +636,10 @@ if (defined $makefiles{'vc'}) {
       (join " ", map {"-I$dirpfx$_"} @srcdirs) .
       " /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500\n".
       "LFLAGS = /incremental:no /fixed\n".
-      "RCFLAGS = -DWIN32 -D_WIN32 -DWINVER=0x0400\n".
+      "RCFLAGS = ".(join " ", map {"-I$dirpfx$_"} @srcdirs).
+      " -DWIN32 -D_WIN32 -DWINVER=0x0400\n".
       "\n".
-      $makefile_extra{'vc'}->{'vars'} .
+      &def($makefile_extra{'vc'}->{'vars'}) .
       "\n".
       "\n";
     print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
@@ -679,7 +680,7 @@ if (defined $makefiles{'vc'}) {
        }
     }
     print "\n";
-    print $makefile_extra{'vc'}->{'end'};
+    print &def($makefile_extra{'vc'}->{'end'});
     print "\nclean: tidy\n".
       "\t-del *.exe\n\n".
       "tidy:\n".
@@ -1158,7 +1159,7 @@ if (defined $makefiles{'vstudio10'} || defined $makefiles{'vstudio12'}) {
             "      <SuppressStartupBanner>true</SuppressStartupBanner>\n" .
             "      <WarningLevel>Level3</WarningLevel>\n" .
             "      <AdditionalIncludeDirectories>" . (join ";", map {"..\\..\\$dirpfx$_"} @srcdirs) . ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n" .
-            "      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;SECURITY_WIN32;POSIX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" .
+            "      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;POSIX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" .
             "      <AssemblerListingLocation>.\\Release\\</AssemblerListingLocation>\n" .
             "      <PrecompiledHeaderOutputFile>.\\Release\\$windows_project.pch</PrecompiledHeaderOutputFile>\n" .
             "      <ObjectFileName>.\\Release\\</ObjectFileName>\n" .
@@ -1197,7 +1198,7 @@ if (defined $makefiles{'vstudio10'} || defined $makefiles{'vstudio12'}) {
             "      <MinimalRebuild>true</MinimalRebuild>\n" .
             "      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n" .
             "      <AdditionalIncludeDirectories>" . (join ";", map {"..\\..\\$dirpfx$_"} @srcdirs) . ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n" .
-            "      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SECURITY_WIN32;POSIX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" .
+            "      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;POSIX;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" .
             "      <AssemblerListingLocation>.\\Debug\\</AssemblerListingLocation>\n" .
             "      <PrecompiledHeaderOutputFile>.\\Debug\\$windows_project.pch</PrecompiledHeaderOutputFile>\n" .
             "      <ObjectFileName>.\\Debug\\</ObjectFileName>\n" .
@@ -1397,7 +1398,7 @@ if (defined $makefiles{'gtk'}) {
       print &splitline("\t\$(CC) \$(COMPAT) \$(CFLAGS) \$(XFLAGS) -c $d->{deps}->[0]\n");
     }
     print "\n";
-    print $makefile_extra{'gtk'}->{'end'};
+    print &def($makefile_extra{'gtk'}->{'end'});
     print "\nclean:\n".
     "\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U")) . "\n";
     print "\nFORCE:\n";
@@ -1472,7 +1473,8 @@ if (defined $makefiles{'unix'}) {
 }
 
 if (defined $makefiles{'am'}) {
-    $dirpfx = "\$(srcdir)/" . &dirpfx($makefiles{'am'}, "/");
+    die "Makefile.am in a subdirectory is not supported\n"
+        if &dirpfx($makefiles{'am'}, "/") ne "";
 
     ##-- Unix/autoconf Makefile.am
     open OUT, ">$makefiles{'am'}"; select OUT;
@@ -1481,12 +1483,15 @@ if (defined $makefiles{'am'}) {
     "#\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\n";
 
+    # 2014-02-22: as of automake-1.14 we begin to get complained at if
+    # we don't use this option
+    print "AUTOMAKE_OPTIONS = subdir-objects\n\n";
+
     # Complete list of source and header files. Not used by the
     # auto-generated parts of this makefile, but Recipe might like to
     # have it available as a variable so that mandatory-rebuild things
     # (version.o) can conveniently be made to depend on it.
-    @sources = ("allsources", "=",
-                map {"${dirpfx}$_"} sort keys %allsourcefiles);
+    @sources = ("allsources", "=", sort keys %allsourcefiles);
     print &splitline(join " ", @sources), "\n\n";
 
     @cliprogs = ("bin_PROGRAMS", "=");
@@ -1506,12 +1511,12 @@ if (defined $makefiles{'am'}) {
     print "endif\n\n";
 
     %objtosrc = ();
-    foreach $d (&deps("X", undef, $dirpfx, "/", "am")) {
+    foreach $d (&deps("X", undef, "", "/", "am")) {
       $objtosrc{$d->{obj}} = $d->{deps}->[0];
     }
 
     print &splitline(join " ", "AM_CPPFLAGS", "=",
-                     map {"-I$dirpfx$_"} @srcdirs), "\n";
+                     map {"-I\$(srcdir)/$_"} @srcdirs), "\n";
 
     @amcflags = ("\$(COMPAT)", "\$(XFLAGS)", "\$(WARNINGOPTS)");
     print "if HAVE_GTK\n";
@@ -1556,7 +1561,7 @@ if (defined $makefiles{'am'}) {
       print "endif\n" if $type eq "X";
       print "\n";
     }
-    print $makefile_extra{'am'}->{'end'};
+    print &def($makefile_extra{'am'}->{'end'});
     select STDOUT; close OUT;
 }
 
@@ -1583,11 +1588,11 @@ if (defined $makefiles{'lcc'}) {
       (join " ", map {"-I$dirpfx$_"} @srcdirs) .
       "\n".
     "# Resource compilation flags\n".
-    "RCFLAGS = \n".
+    "RCFLAGS = ".(join " ", map {"-I$dirpfx$_"} @srcdirs)."\n".
     "\n".
     "# Get include directory for resource compiler\n".
     "\n".
-    $makefile_extra{'lcc'}->{'vars'} .
+    &def($makefile_extra{'lcc'}->{'vars'}) .
     "\n";
     print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
     print "\n\n";
@@ -1618,7 +1623,7 @@ if (defined $makefiles{'lcc'}) {
       }
     }
     print "\n";
-    print $makefile_extra{'lcc'}->{'end'};
+    print &def($makefile_extra{'lcc'}->{'end'});
     print "\nclean:\n".
     "\t-del *.obj\n".
     "\t-del *.exe\n".
@@ -1649,7 +1654,7 @@ if (defined $makefiles{'osx'}) {
     "MLDFLAGS = -framework Cocoa\n".
     "ULDFLAGS =\n".
     "\n" .
-    $makefile_extra{'osx'}->{'vars'} .
+    &def($makefile_extra{'osx'}->{'vars'}) .
     "\n" .
     &splitline("all:" . join "", map { " $_" } &progrealnames("MX:U")) .
     "\n";
@@ -1909,7 +1914,7 @@ if ($do_unix) {
     system "./mkauto.sh";
     die "mkfiles.pl: mkauto.sh returned $?\n" if $? > 0;
     if ($do_unix == 1) {
-        chdir ($targetdir = dirname($makefiles{"am"}))
+        chdir ($targetdir = "unix")
             or die "$targetdir: chdir: $!\n";
     }
     system "./configure", @confargs;