move towards using system CPP

buildcfg.txt: rework OR relationship to be CPP-compliant
	remove tools/simplecpp
	Makefile: CPP=/usr/bin/cpp
stop redundant rebuilds
	remove all from PHONY in lumps/cph/misc-lumps/Makefile
clean up build output
	add a newline to lumps/cph/misc-lumps/colormap.pl
add a clean target, to:
	./Makefile
	./lumps/Makefile
	./lumps/cph/misc-lumps/Makefile
This commit is contained in:
Jon Dowland 2006-06-12 20:36:32 +00:00
parent 8822fbc02c
commit 5e2593f7df
6 changed files with 15 additions and 155 deletions

View file

@ -1,7 +1,7 @@
WADS_DIR=wads/ WADS_DIR=wads/
CPP=tools/simplecpp CPP=/usr/bin/cpp
DEUTEX=deutex DEUTEX=deutex
DEUTEX_BASIC_ARGS=-fullsnd -rate accept -rgb 0 255 255 DEUTEX_BASIC_ARGS=-fullsnd -rate accept -rgb 0 255 255
DEUTEX_ARGS=$(DEUTEX_BASIC_ARGS) -doom2 bootstrap/ DEUTEX_ARGS=$(DEUTEX_BASIC_ARGS) -doom2 bootstrap/
@ -139,4 +139,6 @@ $(WADS_DIR)/doom1.wad : wadinfo_sw.txt force $(WADS_DIR)
dist : $(OBJS) dist : $(OBJS)
./makepkgs $(OBJS) ./makepkgs $(OBJS)
clean:
rm -f ./wadinfo.txt deutex.log
make -C lumps clean

View file

@ -14,6 +14,7 @@
#endif #endif
#ifdef DOOM2 #ifdef DOOM2
#define ULTDOOM_OR_DOOM2
#undef SHAREWARE #undef SHAREWARE
#undef ULTDOOM #undef ULTDOOM
#endif #endif
@ -24,6 +25,7 @@
#ifdef ULTDOOM #ifdef ULTDOOM
#undef SHAREWARE #undef SHAREWARE
#define ULTDOOM_OR_DOOM2
#endif #endif
; List of levels ; List of levels
@ -932,12 +934,9 @@ CWILV30 0 0
CWILV31 0 0 CWILV31 0 0
#endif /* #ifdef DOOM2 */ #endif /* #ifdef DOOM2 */
#ifdef ULTDOOM || DOOM2 #ifdef ULTDOOM_OR_DOOM2
; interpic is used by ultimate doom and doom2 ; interpic is used by ultimate doom and doom2
INTERPIC 0 0 INTERPIC 0 0
#endif #endif
; sprites list ; sprites list
@ -949,7 +948,7 @@ INTERPIC 0 0
; In FreeDM, all monsters are replaced by a simple silhouette. When ; In FreeDM, all monsters are replaced by a simple silhouette. When
; the monster is killed, it just disappears. These are all single ; the monster is killed, it just disappears. These are all single
; frame graphics. It is assumed that most deathmatch levels are played ; frame graphics. It is assumed that most deathmatch levels are played
; without monsters, but it's helpful to have these silhouettes ; without monsters, but it is helpful to have these silhouettes
; for people that forgot to set -nomonsters. ; for people that forgot to set -nomonsters.
BOS2A0 = nomonst BOS2A0 = nomonst

View file

@ -9,3 +9,5 @@ freedoom.lmp: force
force: force:
clean:
make -C cph/misc-lumps clean

View file

@ -14,4 +14,7 @@ dist : doom-misc-lumps-$(VERSION).tar.gz
doom-misc-lumps-$(VERSION).tar.gz : $(SOURCES) doom-misc-lumps-$(VERSION).tar.gz : $(SOURCES)
tar czf $@ $(SOURCES) tar czf $@ $(SOURCES)
.PHONY : all dist clean:
rm -f playpal.lmp colormap.lmp doom-misc-lumps-$(VERSION).tar.gz
.PHONY : dist clean

View file

@ -77,6 +77,7 @@ foreach my $i (0..31) {
print map { pack("C",$_) } @$p; print map { pack("C",$_) } @$p;
print STDERR "."; print STDERR ".";
} }
print STDERR "\n";
# And now INVERSECOLORMAP # And now INVERSECOLORMAP
{ {
my $p = darkenedpalette( my $p = darkenedpalette(

View file

@ -1,147 +0,0 @@
#!/usr/bin/env perl
#
# simple cpp-style preprocessor
#
# By Simon Howard
#
# Understands:
#
# #define NAME
#
# Set an option
# You can use -D on the command line too
#
# #undef NAME
#
# Unset an option if it is set
#
# #if .. #endif / #ifdef .. #endif
#
# Specify a list of options set, eg #ifdef DOOM2 || ULTDOOM || SHAREWARE
# The block is only displayed if one of the options is set
#
# #ifn .. #endif / #ifndef .. #endif
#
# Similarly specify a list of options
# The block is displayed if none of the options are set
#
# #include "filename"
#
# include the contents of a file
use strict;
my @readstack;
my %defines;
sub parse_cmdline {
foreach (@ARGV) {
if (/^-D/) {
my ($define) = /^-D(.*)$/;
$defines{$define} = 1;
}
}
}
# add contents of stdin to read stack
sub read_stdin {
my @lines = <STDIN>;
chomp @lines;
@readstack = (@readstack, reverse(@lines));
}
# add contents of a file to stack
sub read_file {
my ($filename) = @_;
open(FILE, $filename) or die "cant open $filename: $!";
my @lines = <FILE>;
close(FILE);
chomp @lines;
@readstack = (@readstack, reverse(@lines));
}
# recursive block reading function
# if 'ignore' argument is 1, contents are ignored
sub readblock {
my ($ignore) = @_;
while (scalar @readstack > 0) {
$_ = pop @readstack;
next if (/^\s*$/);
if (/^\#include\s+\".*\"\s*$/ ) {
if (!$ignore) {
my ($filename) = /^\#include\s+\"(.*)\"\s*/;
read_file $filename;
}
} elsif (/^\#define\s/ ) {
if (!$ignore) {
my ($name) = /^\#define\s*(\w+)/;
$defines{$name} = 1;
}
} elsif (/^\#undef\s/ ) {
if (!$ignore) {
my ($name) = /^\#undef\s*(\w+)/;
$defines{$name} = undef;
}
} elsif (/^\#(if|ifdef|ifn|ifndef)\s/) {
my ($type, $defines) = /^\#(\w+)\s+(.*)/;
$defines =~ s/\s*$//;
my @definelist = split(/\s*\|\|\s*/, $defines);
my $ev;
if ($type =~ /^(if|ifdef)$/) {
$ev = 0;
foreach (@definelist) {
$ev = 1 if $defines{$_};
}
} elsif ($type =~ /^(ifn|ifndef)$/) {
$ev = 1;
foreach (@definelist) {
$ev = 0 if $defines{$_};
}
} else { die "what type?"; }
my $result = readblock($ignore || !$ev);
die if $result == -1;
if ($result == 1) {
# block ended on an else
# call again for the second block
my $result = readblock($ignore || $ev);
die if $result != 0;
}
} elsif (/^\#endif/) {
return 0;
} elsif (/^\#else/) {
return 1;
} elsif (/^\#/) {
die "invalid # command";
} else {
print "$_\n" if !$ignore;
}
}
return -1;
}
parse_cmdline;
read_stdin;
die if (readblock(0) != -1);