930
952
$objstr = &objects($p, "X.o", undef, undef);
931
953
print &splitline($prog . ": " . $objstr), "\n";
932
954
$libstr = &objects($p, undef, undef, "-lX");
933
print &splitline("\t\$(CC)" . $mw . " \$(${type}LDFLAGS) -o \$@ " .
934
$objstr . " $libstr", 69), "\n\n";
936
foreach $d (&deps("X.o", undef, $dirpfx, "/", "gtk")) {
937
print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
939
print &splitline("\t\$(CC) \$(COMPAT) \$(XFLAGS) \$(CFLAGS) -c $d->{deps}->[0]\n");
942
print $makefile_extra{'gtk'}->{'end'};
944
"\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U")) . "\n";
955
print &splitline("\t\$(CC)" . $mw . " -o \$@ " .
956
$objstr . " \$(${type}LDFLAGS) $libstr", 69), "\n\n";
958
foreach $d (&deps("X.o", undef, $dirpfx, "/", "gtk")) {
959
if ($forceobj{$d->{obj_orig}}) {
960
printf("%s: FORCE\n", $d->{obj});
962
print &splitline(sprintf("%s: %s", $d->{obj},
963
join " ", @{$d->{deps}})), "\n";
965
print &splitline("\t\$(CC) \$(COMPAT) \$(CFLAGS) \$(XFLAGS) -c $d->{deps}->[0]\n");
968
print $makefile_extra{'gtk'}->{'end'};
970
"\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U")) . "\n";
972
select STDOUT; close OUT;
975
if (defined $makefiles{'ac'}) {
976
$dirpfx = &dirpfx($makefiles{'ac'}, "/");
978
##-- Unix/autoconf makefile
979
open OUT, ">$makefiles{'ac'}"; select OUT;
981
"# Makefile.in for $project_name under Unix with Autoconf.\n".
982
"#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
983
"# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
984
# gcc command line option is -D not /D
985
($_ = $help) =~ s/([=" ])\/D/\1-D/gs;
991
&splitline("CFLAGS = \@CFLAGS\@ \@CPPFLAGS\@ \@DEFS\@ \@GTK_CFLAGS\@ " .
992
(join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
993
"XLDFLAGS = \@LDFLAGS\@ \@LIBS\@ \@GTK_LIBS\@\n".
994
"ULDFLAGS = \@LDFLAGS\@ \@LIBS\@\n".
995
"INSTALL=\@INSTALL\@\n",
996
"INSTALL_PROGRAM=\$(INSTALL)\n",
997
"INSTALL_DATA=\$(INSTALL)\n",
998
"prefix=\@prefix\@\n",
999
"exec_prefix=\@exec_prefix\@\n",
1000
"bindir=\@bindir\@\n",
1001
"mandir=\@mandir\@\n",
1002
"man1dir=\$(mandir)/man1\n",
1004
$makefile_extra{'gtk'}->{'vars'} .
1009
"all: \@all_targets\@\n".
1010
&splitline("all-cli:" . join "", map { " $_" } &progrealnames("U"))."\n".
1011
&splitline("all-gtk:" . join "", map { " $_" } &progrealnames("X"))."\n";
1013
foreach $p (&prognames("X:U")) {
1014
($prog, $type) = split ",", $p;
1015
$objstr = &objects($p, "X.o", undef, undef);
1016
print &splitline($prog . ": " . $objstr), "\n";
1017
$libstr = &objects($p, undef, undef, "-lX");
1018
print &splitline("\t\$(CC)" . $mw . " -o \$@ " .
1019
$objstr . " \$(${type}LDFLAGS) $libstr", 69), "\n\n";
1021
foreach $d (&deps("X.o", undef, $dirpfx, "/", "gtk")) {
1022
if ($forceobj{$d->{obj_orig}}) {
1023
printf("%s: FORCE\n", $d->{obj});
1025
print &splitline(sprintf("%s: %s", $d->{obj},
1026
join " ", @{$d->{deps}})), "\n";
1028
print &splitline("\t\$(CC) \$(COMPAT) \$(CFLAGS) \$(XFLAGS) -c $d->{deps}->[0]\n");
1031
print $makefile_extra{'gtk'}->{'end'};
1033
"\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U")) . "\n";
945
1035
select STDOUT; close OUT;
1204
1303
$objstr . " $libstr", 69), "\n\n";
1206
1305
foreach $d (&deps("X.o", undef, $dirpfx, "/")) {
1207
print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
1306
if ($forceobj{$d->{obj_orig}}) {
1307
printf("%s: FORCE\n", $d->{obj});
1309
print &splitline(sprintf("%s: %s", $d->{obj},
1310
join " ", @{$d->{deps}})), "\n";
1209
1312
$firstdep = $d->{deps}->[0];
1210
1313
if ($firstdep =~ /\.c$/) {
1211
print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(XFLAGS) \$(CFLAGS) -c \$<\n";
1314
print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS) -c \$<\n";
1212
1315
} elsif ($firstdep =~ /\.m$/) {
1213
print "\t\$(CC) -x objective-c \$(COMPAT) \$(FWHACK) \$(XFLAGS) \$(CFLAGS) -c \$<\n";
1316
print "\t\$(CC) -x objective-c \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS) -c \$<\n";
1216
1319
print "\n".$makefile_extra{'osx'}->{'end'};
1217
1320
print "\nclean:\n".
1218
"\trm -f *.o *.dmg". (join "", map { " $_" } &progrealnames("U")) . "\n";
1321
"\trm -f *.o *.dmg". (join "", map { " $_" } &progrealnames("U")) . "\n".
1219
1322
"\trm -rf *.app\n";
1220
1325
select STDOUT; close OUT;
1328
if (defined $makefiles{'devcppproj'}) {
1329
$dirpfx = &dirpfx($makefiles{'devcppproj'}, "\\");
1332
##-- Dev-C++ 5 projects
1334
# Note: All files created in this section are written in binary
1335
# mode to prevent any posibility of misinterpreted line endings.
1336
# I don't know if Dev-C++ is as touchy as MSVC with LF-only line
1337
# endings. But however, CRLF line endings are the common way on
1338
# Win32 machines where Dev-C++ is running.
1339
# Hence, in order for mkfiles.pl to generate CRLF project files
1340
# even when run from Unix, I make sure all files are binary and
1341
# explicitly write the CRLFs.
1343
# Create directories if necessary
1344
mkdir $makefiles{'devcppproj'}
1345
if(! -d $makefiles{'devcppproj'});
1346
chdir $makefiles{'devcppproj'};
1347
@deps = &deps("X.obj", "X.res", $dirpfx, "\\", "devcppproj");
1348
%all_object_deps = map {$_->{obj} => $_->{deps}} @deps;
1349
# Make dir names FAT/NTFS compatible
1350
my @srcdirs = @srcdirs;
1351
for ($i=0; $i<@srcdirs; $i++) {
1352
$srcdirs[$i] =~ s/\//\\/g;
1353
$srcdirs[$i] =~ s/\\$//;
1355
# Create the project files
1356
# Get names of all Windows projects (GUI and console)
1357
my @prognames = &prognames("G:C");
1358
foreach $progname (@prognames) {
1359
create_devcpp_project(\%all_object_deps, $progname);
1362
sub create_devcpp_project {
1363
my ($all_object_deps, $progname) = @_;
1364
# Construct program's dependency info (Taken from 'vcproj', seems to work right here, too.)
1369
%resource_files = ();
1370
@object_files = split " ", &objects($progname, "X.obj", "X.res", "X.lib");
1371
foreach $object_file (@object_files) {
1372
next if defined $seen_objects{$object_file};
1373
$seen_objects{$object_file} = 1;
1374
if($object_file =~ /\.lib$/io) {
1375
$lib_files{$object_file} = 1;
1378
$object_deps = $all_object_deps{$object_file};
1379
foreach $object_dep (@$object_deps) {
1380
if($object_dep =~ /\.c$/io) {
1381
$source_files{$object_dep} = 1;
1384
if($object_dep =~ /\.h$/io) {
1385
$header_files{$object_dep} = 1;
1388
if($object_dep =~ /\.(rc|ico)$/io) {
1389
$resource_files{$object_dep} = 1;
1394
$libs = join " ", sort keys %lib_files;
1395
@source_files = sort keys %source_files;
1396
@header_files = sort keys %header_files;
1397
@resources = sort keys %resource_files;
1398
($windows_project, $type) = split ",", $progname;
1399
mkdir $windows_project
1400
if(! -d $windows_project);
1401
chdir $windows_project;
1403
$subsys = ($type eq "G") ? "0" : "1"; # 0 = Win32 GUI, 1 = Win32 Console
1404
open OUT, ">$windows_project.dev"; binmode OUT; select OUT;
1406
"# DEV-C++ 5 Project File - $windows_project.dev\r\n".
1407
"# ** DO NOT EDIT **\r\n".
1409
# No difference between DEBUG and RELEASE here as in 'vcproj', because
1410
# Dev-C++ does not support mutiple compilation profiles in one single project.
1411
# (At least I can say this for Dev-C++ 5 Beta)
1413
"FileName=$windows_project.dev\r\n".
1414
"Name=$windows_project\r\n".
1418
# Multimon is disabled here, as Dev-C++ (Version 5 Beta) does not have multimon.h
1419
"Compiler=-W -D__GNUWIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNO_MULTIMON -D_MBCS_\@\@_\r\n".
1420
"CppCompiler=-W -D__GNUWIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNO_MULTIMON -D_MBCS_\@\@_\r\n".
1421
"Includes=" . (join ";", map {"..\\..\\$dirpfx$_"} @srcdirs) . "\r\n".
1422
"Linker=-ladvapi32 -lcomctl32 -lcomdlg32 -lgdi32 -limm32 -lshell32 -luser32 -lwinmm -lwinspool_\@\@_\r\n".
1424
"UnitCount=" . (@source_files + @header_files + @resources) . "\r\n".
1425
"Folders=\"Header Files\",\"Resource Files\",\"Source Files\"\r\n".
1427
"PrivateResource=${windows_project}_private.rc\r\n".
1428
"ResourceIncludes=..\\..\\..\\WINDOWS\r\n".
1429
"MakeIncludes=\r\n".
1430
"Icon=\r\n". # It's ok to leave this blank.
1432
"ObjectOutput=\r\n".
1433
"OverrideOutput=0\r\n".
1434
"OverrideOutputName=$windows_project.exe\r\n".
1435
"HostApplication=\r\n".
1437
"UseCustomMakefile=0\r\n".
1438
"CustomMakefile=\r\n".
1439
"IncludeVersionInfo=0\r\n".
1440
"SupportXPThemes=0\r\n".
1441
"CompilerSet=0\r\n".
1442
"CompilerSettings=0000000000000000000000\r\n".
1445
foreach $source_file (@source_files) {
1447
"[Unit$unit_count]\r\n".
1448
"FileName=..\\..\\$source_file\r\n".
1449
"Folder=Source Files\r\n".
1453
"Priority=1000\r\n".
1454
"OverrideBuildCmd=0\r\n".
1459
foreach $header_file (@header_files) {
1461
"[Unit$unit_count]\r\n".
1462
"FileName=..\\..\\$header_file\r\n".
1463
"Folder=Header Files\r\n".
1465
"CompileCpp=1\r\n". # Dev-C++ want's to compile all header files with both compilers C and C++. It does not hurt.
1467
"Priority=1000\r\n".
1468
"OverrideBuildCmd=0\r\n".
1473
foreach $resource_file (@resources) {
1474
if ($resource_file =~ /.*\.(ico|cur|bmp|dlg|rc2|rct|bin|rgs|gif|jpg|jpeg|jpe)/io) { # Default filter as in 'vcproj'
1475
$Compile = "0"; # Don't compile images and other binary resource files
1479
$CompileCpp = "1"; # Dev-C++ want's to compile all .rc files with both compilers C and C++. It does not hurt.
1482
"[Unit$unit_count]\r\n".
1483
"FileName=..\\..\\$resource_file\r\n".
1484
"Folder=Resource Files\r\n".
1485
"Compile=$Compile\r\n".
1486
"CompileCpp=$CompileCpp\r\n".
1488
"Priority=1000\r\n".
1489
"OverrideBuildCmd=0\r\n".
1494
#Note: By default, [VersionInfo] is not used.
1496
"[VersionInfo]\r\n".
1501
"LanguageID=1033\r\n".
1502
"CharsetID=1252\r\n".
1504
"FileVersion=0.1\r\n".
1505
"FileDescription=\r\n".
1506
"InternalName=\r\n".
1507
"LegalCopyright=\r\n".
1508
"LegalTrademarks=\r\n".
1509
"OriginalFilename=$windows_project.exe\r\n".
1510
"ProductName=$windows_project\r\n".
1511
"ProductVersion=0.1\r\n".
1512
"AutoIncBuildNr=0\r\n";
1513
select STDOUT; close OUT;