};
# HACK: One of the source files in `charset' is auto-generated by
-# sbcsgen.pl. We need to generate that _now_, before attempting
-# dependency analysis.
-eval 'chdir "charset"; require "sbcsgen.pl"; chdir ".."; select STDOUT;';
+# sbcsgen.pl, and licence.h is likewise generated by licence.pl. We
+# need to generate those _now_, before attempting dependency analysis.
+eval 'chdir "charset"; require "./sbcsgen.pl"; chdir ".."; select STDOUT;';
+eval 'require "./licence.pl"; select STDOUT;';
@srcdirs = ("./");
if ($_[0] eq "!specialobj" and &mfval($_[1])) { $specialobj{$_[1]}->{$_[2]} = 1; next;}
if ($_[0] eq "!cflags" and &mfval($_[1])) {
($rest = $_) =~ s/^\s*\S+\s+\S+\s+\S+\s*//; # find rest of input line
- $rest = 1 if $rest eq "";
+ if ($rest eq "") {
+ # Make sure this file doesn't get lumped together with any
+ # other file's cflags.
+ $rest = "F" . $_[2];
+ } else {
+ # Give this file a specific set of cflags, but permit it to
+ # go together with other files using the same set.
+ $rest = "C" . $rest;
+ }
$cflags{$_[1]}->{$_[2]} = $rest;
next;
}
} elsif (($i =~ /^\[([A-Z]*)\]$/) and defined $prog) {
$type = substr($i,1,(length $i)-2);
die "unrecognised program type for $prog [$type]\n"
- if ! grep { $type eq $_ } qw(G C X U MX UT);
+ if ! grep { $type eq $_ } qw(G C X U MX XT UT);
} else {
push @$listref, $i;
}
if (defined $makefiles{'cygwin'}) {
$dirpfx = &dirpfx($makefiles{'cygwin'}, "/");
- ##-- CygWin makefile
+ ##-- MinGW/CygWin makefile (called 'cygwin' for historical reasons)
open OUT, ">$makefiles{'cygwin'}"; select OUT;
print
- "# Makefile for $project_name under Cygwin, MinGW, or Winelib.\n".
+ "# Makefile for $project_name under MinGW, Cygwin, or Winelib.\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";
# gcc command line option is -D not /D
"# You can define this path to point at your tools if you need to\n".
"# TOOLPATH = c:\\cygwin\\bin\\ # or similar, if you're running Windows\n".
"# TOOLPATH = /pkg/mingw32msvc/i386-mingw32msvc/bin/\n".
+ "# TOOLPATH = i686-w64-mingw32-\n".
"CC = \$(TOOLPATH)gcc\n".
"RC = \$(TOOLPATH)windres\n".
"# Uncomment the following two lines to compile under Winelib\n".
"# You may also need to tell windres where to find include files:\n".
"# RCINC = --include-dir c:\\cygwin\\include\\\n".
"\n".
- &splitline("CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT".
- " -D_NO_OLDNAMES -DNO_MULTIMON -DNO_HTMLHELP -DNO_SECUREZEROMEMORY " .
+ &splitline("CFLAGS = -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT".
+ " -D_NO_OLDNAMES " .
(join " ", map {"-I$dirpfx$_"} @srcdirs)) .
"\n".
- "LDFLAGS = -mno-cygwin -s\n".
+ "LDFLAGS = -s\n".
&splitline("RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 ".
"--define WINVER=0x0400 ".(join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
"\n".
"# C compilation flags\n".
"CFLAGS = /nologo /W3 /O1 " .
(join " ", map {"-I$dirpfx$_"} @srcdirs) .
- " /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500\n".
- "LFLAGS = /incremental:no /fixed\n".
+ " /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500 /D_CRT_SECURE_NO_WARNINGS\n".
+ "LFLAGS = /incremental:no /dynamicbase /nxcompat\n".
"RCFLAGS = ".(join " ", map {"-I$dirpfx$_"} @srcdirs).
" -DWIN32 -D_WIN32 -DWINVER=0x0400\n".
"\n".
print "$objlines[$i]\n";
}
print "<<\n";
- print "\tlink \$(LFLAGS) \$(XLFLAGS) -out:\$(BUILDDIR)$prog.exe -map:\$(BUILDDIR)$prog.map -nologo -subsystem:$subsys \@$inlinefilename\n\n";
+ print "\tlink \$(LFLAGS) \$(XLFLAGS) -out:\$(BUILDDIR)$prog.exe -map:\$(BUILDDIR)$prog.map -nologo -subsystem:$subsys\$(SUBSYSVER) \@$inlinefilename\n\n";
}
foreach $d (&deps("\$(BUILDDIR)X.obj", "\$(BUILDDIR)X.res", $dirpfx, "\\", "vc")) {
$extradeps = $forceobj{$d->{obj_orig}} ? ["*.c","*.h","*.rc"] : [];
"# building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0 x11'\n".
"# if you want to enforce 2.0. The default is to try 2.0 and fall back\n".
"# to 1.2 if it isn't found.\n".
- "GTK_CONFIG = sh -c 'pkg-config gtk+-2.0 x11 \$\$0 2>/dev/null || gtk-config \$\$0'\n".
+ "GTK_CONFIG = sh -c 'pkg-config gtk+-3.0 x11 \$\$0 2>/dev/null || pkg-config gtk+-2.0 x11 \$\$0 2>/dev/null || gtk-config \$\$0'\n".
"\n".
"-include Makefile.local\n".
"\n".
".SUFFIXES:\n".
"\n".
"\n";
- print &splitline("all:" . join "", map { " $_" } &progrealnames("X:U:UT"));
+ print &splitline("all:" . join "", map { " $_" }
+ &progrealnames("X:XT:U:UT"));
print "\n\n";
- foreach $p (&prognames("X:U:UT")) {
+ foreach $p (&prognames("X:XT:U:UT")) {
($prog, $type) = split ",", $p;
+ ($ldflags = $type) =~ s/T$//;
$objstr = &objects($p, "X.o", undef, undef);
print &splitline($prog . ": " . $objstr), "\n";
$libstr = &objects($p, undef, undef, "-lX");
print &splitline("\t\$(CC) -o \$@ " .
- $objstr . " \$(${type}LDFLAGS) $libstr", 69), "\n\n";
+ $objstr . " \$(${ldflags}LDFLAGS) $libstr", 69), "\n\n";
}
foreach $d (&deps("X.o", undef, $dirpfx, "/", "gtk")) {
if ($forceobj{$d->{obj_orig}}) {
print "\n";
print &def($makefile_extra{'gtk'}->{'end'});
print "\nclean:\n".
- "\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U:UT")) . "\n";
+ "\trm -f *.o". (join "", map { " $_" } &progrealnames("X:XT:U:UT")) . "\n";
print "\nFORCE:\n";
select STDOUT; close OUT;
}
print "endif\n\n";
@noinstcliprogs = ("noinst_PROGRAMS", "=");
- foreach $p (&prognames("UT")) {
+ foreach $p (&prognames("XT:UT")) {
($prog, $type) = split ",", $p;
push @noinstcliprogs, $prog;
}
%amspeciallibs = ();
foreach $obj (sort { $a cmp $b } keys %{$cflags{'am'}}) {
+ my $flags = $cflags{'am'}->{$obj};
+ $flags = "" if $flags !~ s/^C//;
print "lib${obj}_a_SOURCES = ", $objtosrc{$obj}, "\n";
print &splitline(join " ", "lib${obj}_a_CFLAGS", "=", @amcflags,
- $cflags{'am'}->{$obj}), "\n";
+ $flags), "\n";
$amspeciallibs{$obj} = "lib${obj}.a";
}
print &splitline(join " ", "noinst_LIBRARIES", "=",
sort { $a cmp $b } values %amspeciallibs), "\n\n";
- foreach $p (&prognames("X:U:UT")) {
+ foreach $p (&prognames("X:XT:U:UT")) {
($prog, $type) = split ",", $p;
- print "if HAVE_GTK\n" if $type eq "X";
+ print "if HAVE_GTK\n" if $type eq "X" || $type eq "XT";
@progsources = ("${prog}_SOURCES", "=");
%sourcefiles = ();
@ldadd = ();
}
push @progsources, sort { $a cmp $b } keys %sourcefiles;
print &splitline(join " ", @progsources), "\n";
- if ($type eq "X") {
+ if ($type eq "X" || $type eq "XT") {
push @ldadd, "\$(GTK_LIBS)";
}
if (@ldadd) {
print &splitline(join " ", "${prog}_LDADD", "=", @ldadd), "\n";
}
- print "endif\n" if $type eq "X";
+ print "endif\n" if $type eq "X" || $type eq "XT";
print "\n";
}
print &def($makefile_extra{'am'}->{'end'});