Some platforms broke because they used /bin/sh, which doesn't have the '-n' parameter for 'echo'.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
DPI5PVABXRFR63LWOESDTYCHDQOOB56H5OPW3ZHROVSM6VGVGX7QC
MFNPES4L57UNCQTA6B6Y6XVENPHD4NASXK2K2LVQ4XDV45WEQUQQC
FQJE5ECLUMBV62J2I3MUARRWTO25QJDD4W5WJS6OBAMRWJRK5JPQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
GL5T36G3A2LUTTYSL7ZQVUYONUCXL5DK36532FM6XRAQCLYDWW2QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
W3CTFURGDMRMT2EIH2CVUP3FM6Z3DBN5S5Q7N3DNREYUJKH6KIKAC
HYVYGSYBKN6CE7NGBGXAAXVNVR3FMIXQOR6ONVPLBDIISIKFDXQQC
#!/usr/bin/perl
use strict;
use warnings;
my $outfile = $ARGV[0];
my $cflags = $ARGV[1];
my $cflags_l = $ARGV[2];
my $ldflags = $ARGV[3];
$cflags =~ s/\"/\\"/g;
$cflags_l =~ s/\"/\\"/g;
$ldflags =~ s/\"/\\"/g;
while ($cflags =~ s/[ \t]{2,}/ /g) {}
while ($cflags_l =~ s/[ \t]{2,}/ /g) {}
while ($ldflags =~ s/[ \t]{2,}/ /g) {}
$cflags =~ s/^[ \t]+|[ \t]$//;
$cflags_l =~ s/^[ \t]+|[ \t]$//;
$ldflags =~ s/^[ \t]+|[ \t]$//;
my $prefix = "CRAWL";
my $smprefix = "crawl";
open OUT, ">", "$outfile" or die $!;
print OUT <<__eof__;
#ifndef __included_${smprefix}_compile_flags_h
#define __included_${smprefix}_compile_flags_h
#define ${prefix}_CFLAGS "${cflags}"
#define ${prefix}_CFLAGS_L "${cflags_l}"
#define ${prefix}_LDFLAGS "${ldflags}"
#endif
__eof__
close OUT or die $!;
$(QUIET_GEN)
@echo "// Automatically generated by makefile" > compflag.h
@echo "#ifndef __included_crawl_compiler_flags_h" >> compflag.h
@echo "#define __included_crawl_compiler_flags_h" >> compflag.h
@echo -n "#define CRAWL_CFLAGS \"" >> compflag.h
@echo -n $(CFLAGS) | sed 's/\"/\\"/g' >> compflag.h
@echo "\"" >> compflag.h
@echo -n "#define CRAWL_CFLAGS_L \"" >> compflag.h
@echo -n $(CFLAGS_L) | sed 's/\"/\\"/g' >> compflag.h
@echo "\"" >> compflag.h
@echo -n "#define CRAWL_LDFLAGS \"" >> compflag.h
@echo -n $(LDFLAGS) | sed 's/\"/\\"/g' >> compflag.h
@echo "\"" >> compflag.h
@echo "#endif" >> compflag.h
$(QUIET_GEN)util/gen-cflg.pl compflag.h "$(CFLAGS)" "$(CFLAGS_L)" "$(LDFLAGS)"