diff options
Diffstat (limited to 'atari')
-rw-r--r-- | atari/Makefile.st | 175 | ||||
-rw-r--r-- | atari/config.h | 63 | ||||
-rw-r--r-- | atari/mkconf.g | 4 | ||||
-rw-r--r-- | atari/system.c | 6 |
4 files changed, 146 insertions, 102 deletions
diff --git a/atari/Makefile.st b/atari/Makefile.st index 38e3eadc..d3c8104a 100644 --- a/atari/Makefile.st +++ b/atari/Makefile.st @@ -1,145 +1,126 @@ -# Makefile for GNU Awk - sample ST version. -# This makefile for ST version of gcc compiler and associated libraries. +# Makefile for GNU Awk - ST version. # -# This is a subset of the full Makefile cut down for Atari ST -# gcc compiler is assumed -# It is known to work with gulam shell. -# It may need some customization depending on your setup! -# Replace with it 'Makefile' from the source directory. -# -# You need sed.ttp for an automatic creation of config.h file! -# Check gulam script mkconf.g in atari directory. -# In a pinch you may create one by checking config/atari file and -# editing config.in by hand. +# This makefile hand edited from Makefile automatically generated +# by configure - gcc 2.x.x compiler with TOS version of libraries +# and modified system(). +# Check comments in this Makefile and adjust to your needs!! # # Copyright (C) 1986, 1988-1992 the Free Software Foundation, Inc. -# +# # This file is part of GAWK, the GNU implementation of the # AWK Progamming Language. -# +# # GAWK is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # GAWK is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# - -# cross-compiler -CC= cgcc -# native -CC= gcc -# comment out the following two lines if you do not want use -# 16-bit wide ints -WIDTH = -mshort -EXT=16 - -# for gcc 1.40 -OPTIMIZE= -O -fstrength-reduce -fcombine-regs -fomit-frame-pointer -# for gcc 2.2.2 -#OPTIMIZE= -O2 -fstrength-reduce -fomit-frame-pointer -PROFILE= #-pg -DEBUG= #-DMALLOCDEBUG #-DDEBUG #-DFUNC_TRACE #-DMPROF -LINKSTATIC= #-Bstatic -WARN= #-W -Wunused -Wimplicit -Wreturn-type -Wcomment # for gcc only - -# Parser to use on grammar - any one of the following will work -#PARSER = yacc -PARSER = byacc -#PARSER = bison -y +# +# You should have received a copy of the GNU General Public License +# along with GAWK; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +srcdir = . +VPATH = . + +# CC = gcc +CC = cgcc # when cross-compiling +#YACC = byacc +YACC = bison -y # basename of parser output - adjust to your parser requirements -POUTPUT = awk_tab +YOUTPUT = awk_tab -# Set LIBS to any libraries that are machine specific -LIBS = -lpml$(EXT) -FLAGS=-G -Xlinker -x $(WIDTH) +# WIDTH and EXT have to be both defined or both undefined +# WIDTH = -mshort +# EXT = 16 +LIBS = -lpml$(EXT) +LIBOBJS = strncasecmp.o +ST_LIBOBJS = stack.o tmpnam.o system.o -CFLAGS= -DGAWK $(FLAGS) $(DEBUG) $(LINKSTATIC) $(PROFILE) $(OPTIMIZE) $(WARN) +# CFLAGS= -g -DGAWK -DHAVE_CONFIG_H $(WIDTH) -I. -I.. +CFLAGS= -DGAWK -DHAVE_CONFIG_H $(WIDTH) -O2 -I. -I.. -Wall \ + -fomit-frame-pointer # -pipe # +# keep only global symbols and use long symbol names +# xstrip -k in target gawk.ttp removes all symbols but _stksize +# allowing for stack size manipulations without recompiling (with fixstk) +LDFLAGS= -Xlinker -x -G $(WIDTH) # object files AWKOBJS = main.o eval.o builtin.o msg.o iop.o io.o field.o array.o \ - node.o version.o missing.o re.o # getopt.o + node.o version.o re.o getopt.o getopt1.o ALLOBJS = $(AWKOBJS) awktab.o # GNUOBJS -# GNU stuff that gawk uses as library routines. -GNUOBJS= regex.o dfa.o $(ALLOCA) - -# source and documentation files -SRC = main.c eval.c builtin.c msg.c version.c \ - iop.c io.c field.c array.c node.c missing.c re.c getopt.c - -ALLSRC= $(SRC) awktab.c - -AWKSRC= awk.h awk.y $(ALLSRC) patchlevel.h protos.h config.in getopt.h +# GNU stuff that gawk uses as library routines. +GNUOBJS= rx.o dfa.o -GNUSRC = alloca.c alloca.s dfa.c dfa.h regex.c regex.h +all: gawk.ttp -COPIES = missing/system.c missing/tzset.c \ - missing/memcmp.c missing/memcpy.c missing/memset.c \ - missing/random.c missing/strcase.c missing/strchr.c \ - missing/strerror.c missing/strtod.c \ - missing/strftime.c missing/strftime.3 +gawk.ttp: $(ALLOBJS) $(GNUOBJS) $(REOBJS) $(LIBOBJS) $(ST_LIBOBJS) + $(CC) -o $@ $(LDFLAGS) \ + $(ALLOBJS) $(GNUOBJS) $(REOBJS) $(LIBOBJS) $(ST_LIBOBJS) $(LIBS) + toglclr -fload $@ +# xstrip -k $@ -SUPPORT = support/texindex.c support/texinfo.tex +$(AWKOBJS) $(GNUOBJS): awk.h dfa.h regex.h config.h -DOCS= gawk.1 gawk.texi +# cheat with defines to force an inclusion of a proper code +getopt.o: getopt.h + $(CC) $(CFLAGS) -D_LIBC -D__alloca=__builtin_alloca -c getopt.c -INFOFILES= gawk.info gawk.info-* \ - gawk.aux gawk.cp gawk.cps gawk.fn gawk.fns gawk.ky gawk.kys \ - gawk.pg gawk.pgs gawk.toc gawk.tp gawk.tps gawk.vr gawk.vrs +getopt1.o: getopt.h -MISC = NEWS COPYING FUTURES Makefile.* PROBLEMS README* PORTS POSIX \ - mungeconf configure ACKNOWLEDGMENT LIMITATIONS +main.o: patchlevel.h -OTHERS= pc/* atari/* vms/* +awktab.c: awk.y + $(YACC) -v awk.y + sed '/^extern char .malloc(), .realloc();$$/d' $(YOUTPUT).c >awktab.c + rm $(YOUTPUT).c -ALLDOC= gawk.dvi $(INFOFILES) +# rules for $(LIBOBJS) and $(ST_LIBOBJS) -ALLFILES= $(AWKSRC) $(GNUSRC) $(COPIES) $(MISC) $(DOCS) $(ALLDOC) $(OTHERS) \ - $(SUPPORT) +strncasecmp.o: missing/strncasecmp.c config.h + $(CC) $(CFLAGS) -c missing/strncasecmp.c -# set this for a version of toglclr you are using -TOGLFLAGS = -fload +stack.o: atari/stack.c + $(CC) $(CFLAGS) -c atari/stack.c + +tmpnam.o: atari/tmpnam.c + $(CC) $(CFLAGS) -c atari/tmpnam.c -# rules to build gawk -gawk.ttp: $(ALLOBJS) $(GNUOBJS) $(REOBJS) - $(CC) -o $@ $(CFLAGS) $(ALLOBJS) $(GNUOBJS) $(REOBJS) $(LIBS) - toglclr $(TOGLFLAGS) $@ +# this is an optional replacement for a library module. +system.o: atari/system.c + $(CC) $(CFLAGS) -c atari/system.c -$(AWKOBJS) regex.o dfa.o: awk.h dfa.h regex.h +clean: + rm -rf gawk.ttp *.o core -getopt.o: getopt.h +distclean: clean + rm -f Makefile *.orig *.rej */*.orig */*.rej awk.output gmon.out \ + make.out y.output config.h config.status -main.o: patchlevel.h +mostlyclean: clean -awktab.c: awk.y - $(PARSER) -v awk.y - sed '/^extern char .malloc(), .realloc();$$/d' $(POUTPUT).c >awktab.c - rm $(POUTPUT).c - -config.h: config.in - @echo You must provide a config.h! - @echo Run \"./configure\" to build it for known systems - @echo or copy config.in to config.h and edit it.; exit 1 +realclean: distclean + rm -f awktab.c $(ALLDOC) gawk.dvi: gawk.texi tex gawk.texi; texindex gawk.?? + tex gawk.texi; texindex gawk.?? tex gawk.texi + rm -f gawk.?? gawk.??? gawk.info: gawk.texi makeinfo gawk.texi -clean: - rm *.o *.orig *.rej */*.orig */*.rej - -cleaner: clean - rm gawk.ttp awktab.c +# not really (or not with every shell) - but you have an idea +test: gawk + cd test; $(MAKE) -k -clobber: clean - rm $(ALLDOC) gawk.log +check: test diff --git a/atari/config.h b/atari/config.h new file mode 100644 index 00000000..bac95acd --- /dev/null +++ b/atari/config.h @@ -0,0 +1,63 @@ +/* + * config.h for Atari ST. + * Assumes gcc compiler and TOS libraries. + * Edited by hand from a config.h generated automatically by configure. + */ + +/* Default path for Awk library */ +#define DEFPATH ".,c:\\lib\\awk,c:\\gnu\\lib\\awk" +/* Path separator in use */ +#define ENVSEP ',' +#define SZTC (size_t) +#define INTC (int) + +#define HAVE_STRING_H 1 /* have <string.h> */ +#ifdef HAVE_STRING_H +#undef NEED_MEMORY_H /* need <memory.h> to declare memcpy() et al. */ +#endif + +#define STDC_HEADERS 1 /* have the usual ANSI header files */ +#undef HAVE_UNISTD_H /* have <unistd.h> */ +#undef HAVE_ALLOCA_H /* have <alloca.h> -- only used if bison is used */ +#undef HAVE_SIGNUM_H /* have <signum.h> */ +#undef REGEX_MALLOC /* don't use alloca in regex.c */ + +#define HAVE_VPRINTF 1 /* have vprintf() */ + +#define HAVE_RANDOM 1 /* have random(), or using missing/random.c */ + +#define HAVE_STRCHR 1 /* have strchr() and strrchr() */ +#ifndef HAVE_STRCHR +#ifdef HAVE_RINDEX /* use index() and rindex() if present */ +#define strchr index +#define strrchr rindex +#endif +#endif + +#define HAVE_FMOD 1 /* have fmod(), otherwise use modf() */ + +#define HAVE_MEMCPY 1 /* have memcpy() et al. */ + +#define HAVE_ST_BLKSIZE 1 /* have st_blksize member in the stat(2) structure */ + +#define HAVE_STRFTIME 1 + +#define HAVE_STRINGIZE 1 /* have ANSI "stringizing" capability */ + +#undef __CHAR_UNSIGNED__ /* default char is signed */ + +#define RETSIGTYPE void /* type used in signal() */ +#define SPRINTF_RET int /* type returned by sprintf() */ + +#undef _ALL_SOURCE /* on AIX, used to get some BSD functions */ +/* + * srandom already has a prototype defined - don't redefine it + */ +#define SRANDOM_PROTO 1 + +#undef _POSIX_SOURCE /* on Minix, used to get Posix functions */ +#undef _MINIX /* on Minix, used to get Posix functions */ +#undef _POSIX_1_SOURCE /* on Minix, define to 2 */ + + + diff --git a/atari/mkconf.g b/atari/mkconf.g index f551218f..385559b3 100644 --- a/atari/mkconf.g +++ b/atari/mkconf.g @@ -5,14 +5,14 @@ # if { -e ..\config\atari } sed -n -f mkscrpt.sed ..\config\atari > sedscr - sed -f sedscr ..\config.h-d > config.h + sed -f sedscr ..\config.in > config.h sed -n '/^#echo./s///p' ..\config\atari rm sedscr mv config.h .. ef echo "'..\config\atari' was lost somewhere" echo "Either construct one based on the examples in the config directory," - echo "or, in source directory, copy config.h-dist to config.h and edit it." + echo "or, in source directory, copy config.in to config.h and edit it." exit 1 endif exit 0 diff --git a/atari/system.c b/atari/system.c index 41552e5b..b74ae92f 100644 --- a/atari/system.c +++ b/atari/system.c @@ -19,16 +19,16 @@ #define _COOKIE(x) puts(x);putchar('\n') #endif -void static +static void parse_args(char *cmdln, register char **argv) { register char *p; static char delim[] = " \t\r\n"; - if(p = strtok(cmdln, delim)) { + if(NULL != (p = strtok(cmdln, delim))) { do { *argv++ = p; - } while(p = strtok(NULL, delim)); + } while(NULL != (p = strtok(NULL, delim))); } } |