utils/gentables.c
utils/ln-dir.sh
utils/make_access_cnf.sh
-utils/mkcmds.sh.SH
+utils/mkcmds.pl
utils/penn-install
utils/update-cnf.pl
utils/update.pl
autogen: hdrs/cmds.h hdrs/funs.h hdrs/switches.h
hdrs/cmds.h: src/cmds.c src/command.c src/cque.c src/help.c src/set.c src/sql.c Patchlevel
- (cd utils; sh mkcmds.sh commands)
+ (perl utils/mkcmds.pl commands)
hdrs/switches.h: src/SWITCHES Patchlevel
- (cd utils; sh mkcmds.sh switches)
+ (perl utils/mkcmds.pl switches)
src/switchinc.c: src/SWITCHES Patchlevel
- (cd utils; sh mkcmds.sh switches)
+ (perl utils/mkcmds.pl switches)
-hdrs/funs.h: src/fun*.c src/bsd.c src/conf.c src/extmail.c src/help.c src/wiz.c src/sql.c Patchlevel
- (cd utils; sh mkcmds.sh functions)
-
-hdrs/patches.h: patches/*
- (cd utils; sh mkcmds.sh patches)
+hdrs/funs.h: src/fun*.c src/bsd.c src/conf.c src/cque.c src/extmail.c src/help.c src/wiz.c src/sql.c Patchlevel
+ (perl utils/mkcmds.pl functions)
install: localized all game/restart
-rm -f game/netmush
# REQUIRES GNU INDENT! DON'T INDENT WITH ANYTHING ELSE!
indent:
- @(cd src; make indent)
+# @(cd src; make indent)
protoize:
(cd src; make protoize "CCFLAGS=$(CCFLAGS)")
distclean:
(cd hdrs; rm -f *.orig *~ \#* *.rej *.bak funs.h cmds.h buildinf.h patches.h)
- (cd utils; rm -f *.orig *~ \#* *.rej *.bak mkcmds.sh)
+ (cd utils; rm -f *.orig *~ \#* *.rej *.bak)
(cd game; rm -rf *.log netmush info_slave *.orig *.rej *~ *.bak mush.cnf)
(cd os2; rm -rf *.rej *.orig *~ *.bak)
(cd src; make distclean; rm -f Makefile)
dist.tar: indent distclean versions touchswitches autogen
makedist -c cobramush
tar -cvf /tmp/dist.tar cobramush
- -pgp -sb /tmp/dist.tar
+# CobraMUSH does not pgp sign distributions at this moment
+# -pgp -sb /tmp/dist.tar
-rm -rf cobramush
-CSRImalloc.tar.Z:
- (cd src/CSRI; make clean)
- (tar -cvFFf /tmp/CSRImalloc.tar `cat exclude.tar`)
- compress /tmp/CSRImalloc.tar
-
globalinstall: install
(cd game/txt; make clean compose.sh)
$(INSTALLDIR) $(GLOBAL_INSTALL)
$(INSTALL) src/netmud $(DEB_INSTALL)/netmush
$(INSTALL) src/console $(DEB_INSTALL)/console
$(INSTALL) src/info_slave $(DEB_INSTALL)/info_slave
- $(INSTALL) utils/penn-install $(DEB_BIN)/penn-install
+ $(INSTALL) utils/cobramush-install $(DEB_BIN)/cobramush-install
$(CHMOD) a+rX -R $(DEB_INSTALL)
- $(CHMOD) a+rX $(DEB_BIN)/penn-install
+ $(CHMOD) a+rX $(DEB_BIN)/cobramush-install
@echo "** Files installed in $(DEB_INSTALL)."
- @echo "** You can run penn-install to create a user directory."
+ @echo "** You can run cobramush-install to create a user directory."
!NO!SUBS!
chmod 644 Makefile
echo "********************************************************"; \
fi
-../hdrs/patches.h:
- if [ ! -f ../hdrs/patches.h ]; then \
- (cd ../utils; sh mkcmds.sh patches); \
- fi
../po/pennmush.pot: $(C_FILES) $(H_FILES)
xgettext -d pennmush -kT -o ../po/pennmush.pot $(C_FILES) $(H_FILES)
bsd.o: ../hdrs/command.h
bsd.o: ../hdrs/switches.h
bsd.o: ../hdrs/version.h
-bsd.o: ../hdrs/patches.h
bsd.o: ../hdrs/mysocket.h
bsd.o: ../hdrs/ident.h
bsd.o: ../hdrs/strtree.h
notify.o: ../hdrs/parse.h
notify.o: ../hdrs/access.h
notify.o: ../hdrs/version.h
-notify.o: ../hdrs/patches.h
notify.o: ../hdrs/mysocket.h
notify.o: ../hdrs/ident.h
notify.o: ../hdrs/strtree.h
version.o: ../hdrs/bufferq.h
version.o: ../confmagic.h
version.o: ../hdrs/version.h
-version.o: ../hdrs/patches.h
version.o: ../hdrs/buildinf.h
warnings.o: ../config.h
warnings.o: ../hdrs/copyrite.h
#include "access.h"
#include "command.h"
#include "version.h"
-#include "patches.h"
#include "mysocket.h"
#include "ident.h"
#include "strtree.h"
queue_string_eol(call_by, tprintf("Size: %d", db_top));
queue_string_eol(call_by, tprintf("Version: CobraMUSH v%s [%s]", VERSION,
VBRANCH));
-#ifdef PATCHES
- queue_string_eol(call_by, tprintf("Patches: %s", PATCHES));
-#endif
+
queue_string_eol(call_by, "### End INFO");
}
#include "parse.h"
#include "access.h"
#include "version.h"
-#include "patches.h"
#include "mysocket.h"
#include "ident.h"
#include "strtree.h"
-/* AUTOGENERATED FILE. DO NOT EDIT */
+/* AUTOGENERATED FILE. DO NOT EDIT! */
SWITCH_VALUE switch_list[] = {
{"ACCESS", SWITCH_ACCESS},
{"ADD", SWITCH_ADD},
#include "externs.h"
#include "version.h"
-#include "patches.h"
#ifndef WIN32
#include "buildinf.h"
#endif
notify_format(player, T("Last restarted: %s"), buff);
notify_format(player, "CobraMUSH v%s [%s]", VERSION, VBRANCH);
-#ifdef PATCHES
- notify_format(player, "Patches: %s", PATCHES);
-#endif
#ifdef WIN32
notify_format(player, T("Build date: %s"), __DATE__);
#else
--- /dev/null
+#!/usr/bin/perl -w
+# perl version of the old mkcmds.sh script. Runs faster by simply not running
+# a bazillion child processes. Also uses SelfLoader to avoid compiling functions
+# that are never used, since it's usually invoked with at most 1 argument.
+#
+
+use SelfLoader;
+use File::Compare;
+use File::Copy;
+use strict; # Please ma'am may I have another?
+
+# SelfLoaded functions
+use subs qw/make_patches make_switches make_cmds make_funs/;
+# Always present functions
+use subs qw/maybemove temp_header temp_source scan_files_for_pattern/;
+
+print "Starting...\n";
+
+# Main loop, dispatch for each command line argument.
+foreach my $command (@ARGV) {
+ if ($command eq "switches") {
+ make_switches;
+ } elsif ($command eq "commands") {
+ print "Commands\n";
+ make_cmds;
+ } elsif ($command eq "functions") {
+ make_funs;
+ } elsif ($command eq "all") {
+# make_patches;
+ make_switches;
+ make_cmds;
+ make_funs;
+ } else {
+ warn "Unknown option '${command}'\n";
+ }
+}
+
+# Return name of a temp file in hdrs/
+sub temp_header {
+ return "hdrs/temp.$$.h";
+}
+
+# Return name of a temp file in src/
+sub temp_source {
+ return "src/temp.$$.c";
+}
+
+# maybemove(file1, file2) copies file1 to file 2 if they are different,
+# otherwise just deletes file1 and leaves file2 unchanged.
+sub maybemove {
+ my $from = shift;
+ my $to = shift;
+
+ if (compare $from, $to) {
+ if (move $from, $to) {
+ print "File ${to} updated.\n";
+ } else {
+ warn "Couldn't rename ${from} to ${to}: $!\n";
+ }
+ } else {
+ print "File ${to} unchanged.\n";
+ unlink $from;
+ }
+}
+
+# scan_files_for_pattern(glob-pattern, re) searches all files matching
+# glob-pattern for lines matching re, and returns a sorted list of
+# $1's for each matching line.
+sub scan_files_for_pattern {
+ my $filepattern = shift;
+ my $re = shift;
+ my @idents;
+
+ foreach my $file (glob $filepattern) {
+ open FILE, "<", $file
+ or die "Cannot open ${file} for reading: $!\n";
+ while (<FILE>) {
+ chomp;
+ push @idents, $1 if m/$re/;
+ }
+ close FILE;
+ }
+
+ return sort @idents;
+}
+
+
+END {
+ # Make sure temp files get deleted.
+ my @files = (temp_header(), temp_source());
+ foreach my $file (@files) {
+ unlink $file if -f $file;
+ }
+}
+
+__DATA__
+
+sub make_switches {
+ print "Rebuilding command switch file and header.\n";
+ my $auto_msg = "/* AUTOGENERATED FILE. DO NOT EDIT! */\n";
+
+ my $temphdr = temp_header;
+ my $tempsrc = temp_source;
+
+ open CMDHDR, "<", "hdrs/command.h" or
+ die "Unable to open hdrs/command.h for reading: $!\n";
+ my $numbytes = 20;
+ while (<CMDHDR>) {
+ if (m/^#define\s+NUM_BYTES\s+(\d+)/o) {
+ $numbytes = $1;
+ last;
+ }
+ }
+ close CMDHDR;
+
+ my $MAXSWITCHES = $numbytes * 8;
+
+ my @switches = scan_files_for_pattern "src/SWITCHES", qr/^(.+)/;
+
+ warn "Too many switches defined!\n" if length @switches > $MAXSWITCHES;
+
+ open HDR, ">", $temphdr or
+ die "Unable to open $temphdr for writing: $!\n";
+ open SRC, ">", $tempsrc or
+ die "Unable to open $tempsrc for writing: $1\n";
+
+ print HDR $auto_msg;
+ print HDR "#ifndef SWITCHES_H\n";
+ print HDR "#define SWITCHES_H\n";
+
+ print SRC $auto_msg;
+ print SRC "SWITCH_VALUE switch_list[] = {\n";
+
+ my $n = 1;
+ foreach my $switch (@switches) {
+ print HDR "#define SWITCH_${switch} ${n}\n";
+ print SRC " {\"${switch}\", SWITCH_${switch}},\n";
+ $n++;
+ }
+
+ print SRC " {NULL, 0}\n";
+ print SRC "};\n";
+ close SRC;
+
+ print HDR "#endif /* SWITCHES_H */\n";
+ close HDR;
+
+ maybemove $temphdr, "hdrs/switches.h";
+ maybemove $tempsrc, "src/switchinc.c";
+}
+
+# I really should combine this and make_funs into one function that does
+# the work with specific files/regexps/defines passed as arguments
+
+sub make_cmds {
+ my $auto_msg = "/* AUTOGENERATED FILE. DO NOT EDIT! */\n";
+
+ print "Rebuilding command prototype header.\n";
+
+ my $tempfile = temp_header;
+
+ my @commands =
+ scan_files_for_pattern "src/*.c", qr/^\s*COMMAND\s?\(([^\)]+)\)*/;
+
+ open HDR, ">", $tempfile
+ or die "Can't open ${tempfile} for writing: $!\n";
+
+ print HDR $auto_msg;
+ print HDR "#ifndef CMDS_H\n";
+ print HDR "#define CMDS_H\n";
+
+ foreach my $command (@commands) {
+ print HDR "COMMAND_PROTO(${command});\n";
+ }
+
+ print HDR "#endif /* CMDS_H */\n";
+ close HDR;
+
+ maybemove $tempfile, "hdrs/cmds.h";
+
+}
+
+sub make_funs {
+ my $auto_msg = "/* AUTOGENERATED FILE. DO NOT EDIT! */\n";
+
+ print "Rebuilding function prototype header.\n";
+
+ my $tempfile = temp_header;
+
+ my @functions =
+ scan_files_for_pattern "src/*.c", qr/^\s*FUNCTION\(([^\)]+)\)/;
+
+ open HDR, ">", $tempfile
+ or die "Can't open ${tempfile} for writing: $!\n";
+
+ print HDR $auto_msg;
+ print HDR "#ifndef FUNS_H\n";
+ print HDR "#define FUNS_H\n";
+
+ foreach my $function (@functions) {
+ print HDR "FUNCTION_PROTO(${function});\n";
+ }
+
+ print HDR "#endif /* FUNS_H */\n";
+ close HDR;
+
+ maybemove $tempfile, "hdrs/funs.h";
+}
+
+++ /dev/null
-case $CONFIG in
-'')
- if test -f config.sh; then TOP=.;
- elif test -f ../config.sh; then TOP=..;
- elif test -f ../../config.sh; then TOP=../..;
- elif test -f ../../../config.sh; then TOP=../../..;
- elif test -f ../../../../config.sh; then TOP=../../../..;
- else
- echo "Can't find config.sh."; exit 1
- fi
- . $TOP/config.sh
- ;;
-esac
-: This forces SH files to create target in same directory as SH file.
-: This is so that make depend always knows where to find SH derivatives.
-case "$0" in
-*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
-esac
-echo "Extracting mkcmds.sh (with variable substitutions)"
-: This section of the file will have variable substitutions done on it.
-: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
-: Protect any dollar signs and backticks that you do not want interpreted
-: by putting a backslash in front. You may delete these comments.
-$spitshell >mkcmds.sh <<!GROK!THIS!
-$startsh
-echo=$echo
-n=$n
-c=$c
-!GROK!THIS!
-
-: In the following dollars and backticks do not need the extra backslash.
-$spitshell >>mkcmds.sh <<'!NO!SUBS!'
-#
-# Make various tables and header files.
-# We run this from the utils directory.
-#
-if [ -f "../nocmds" ]; then
- $echo "Not building"
- exit
-fi
-
-case $1 in
- patches)
-if [ -d ../patches ]; then
- $echo "Rebuilding list of installed Patches"
- for bu in ../patches/*; do
- case $bu in
- *~) ;; # Ignore these
- *)
- name=`grep "^# Patch name:" $bu | sed 's/[^:]*://'`
- ver=`grep "^# Patch version:" $bu | sed 's/[^:]*://'`
- name=`$echo $name`
- ver=`$echo $ver`
- if [ "X$name" != "X" ]; then
- if [ "X$ver" != "X" ]; then
- pat="${pat}${name}(${ver}) "
- else
- pat="${pat}${name} "
- fi
- fi
- ;;
- esac
- done
- pat=`$echo $pat`
-fi
-
-rm -f ../hdrs/temp.$$.h
-rm -f ../src/temp.$$.c
-
-$echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h
-$echo "#ifndef _PATCH_H" >> ../hdrs/temp.$$.h
-$echo "#define _PATCH_H" >> ../hdrs/temp.$$.h
-if [ "X$pat" = "X" ]; then
- $echo "#undef PATCHES" >> ../hdrs/temp.$$.h
-else
- $echo "#define PATCHES \"$pat\"" >> ../hdrs/temp.$$.h
-fi
-$echo "#endif /* _PATCH_H */" >> ../hdrs/temp.$$.h
-cmp -s ../hdrs/patches.h ../hdrs/temp.$$.h
-cmpstat=$?
-if [ $cmpstat -eq 0 ]; then
- rm -f ../hdrs/temp.$$.h
-else
- mv -f ../hdrs/temp.$$.h ../hdrs/patches.h
-fi
-
-;;
-switches)
-
-$echo "Rebuilding command switch file"
-snum=1
-$echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../src/temp.$$.c
-$echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h
-$echo "SWITCH_VALUE switch_list[] = {" >> ../src/temp.$$.c
-for s in `cat ../src/SWITCHES | sort`; do
- $echo "#define SWITCH_$s $snum" >> ../hdrs/temp.$$.h
- $echo $n " {$c" >> ../src/temp.$$.c
- $echo $n "\"$s\", SWITCH_$s$c" >> ../src/temp.$$.c
- $echo $n "}$c" >> ../src/temp.$$.c
- $echo "," >> ../src/temp.$$.c
- $echo $n "."
- snum=`expr $snum + 1`
-done
-$echo " {NULL, 0}" >> ../src/temp.$$.c
-$echo "};" >> ../src/temp.$$.c
-$echo ""
-
-# NUM_BYTES from command.h * 8.
-if [ $snum -gt 176 ]; then
- $echo "You have too many switches defined!"
-fi
-
-mv -f ../hdrs/temp.$$.h ../hdrs/switches.h
-mv -f ../src/temp.$$.c ../src/switchinc.c
-
-;;
-commands)
-
-$echo "Rebuilding command prototype file"
-$echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h
-for c in `grep "^COMMAND *(" ../src/*.c | grep -v cmd_local_silly | cut -f2 -d\( | cut -f1 -d\) | sort | uniq`; do
- $echo >>../hdrs/temp.$$.h "COMMAND_PROTO($c);"
- $echo $n "."
-done
-$echo ""
-cmp -s ../hdrs/cmds.h ../hdrs/temp.$$.h
-cmpstat=$?
-if [ $cmpstat -eq 0 ]; then
- rm -f ../hdrs/temp.$$.h
-else
- mv -f ../hdrs/temp.$$.h ../hdrs/cmds.h
-fi
-
-if [ -d "../win32" ]; then
- cp ../hdrs/cmds.h ../win32/cmds.h
-fi
-
-;;
-functions)
-
-$echo "Rebuilding function prototype file"
-$echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h
-for c in `grep "^FUNCTION *(" ../src/*.c | grep -v local_fun_silly | cut -f2 -d\( | cut -f1 -d\) | sort | uniq`; do
- $echo >>../hdrs/temp.$$.h "FUNCTION_PROTO($c);"
- $echo $n "."
-done
-$echo ""
-cmp -s ../hdrs/funs.h ../hdrs/temp.$$.h
-cmpstat=$?
-if [ $cmpstat -eq 0 ]; then
- rm -f ../hdrs/temp.$$.h
-else
- mv -f ../hdrs/temp.$$.h ../hdrs/funs.h
-fi
-
-if [ -d "../win32" ]; then
- cp ../hdrs/funs.h ../win32/funs.h
-fi
-;;
-esac
-!NO!SUBS!
-chmod 755 mkcmds.sh
-$eunicefix mkcmds.sh