From f3dbdc76153a0ac51340b81e4d935cc5ce3142ab Mon Sep 17 00:00:00 2001 From: Matt Jenkins Date: Thu, 14 Jul 2016 00:06:12 +0100 Subject: [PATCH] Got Yacc compiling and running --- rootfs.manifest | 1 + src/cmd/Makefile | 2 +- src/cmd/yacc/Makefile | 49 ++++++++++++++++++++++++------------------- src/cmd/yacc/dextern | 15 ++++++++++++- src/cmd/yacc/files | 3 ++- src/cmd/yacc/y1.c | 1 + 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/rootfs.manifest b/rootfs.manifest index 57c4e90..2bcedb6 100644 --- a/rootfs.manifest +++ b/rootfs.manifest @@ -605,6 +605,7 @@ file /bin/whoami file /bin/write mode 02755 file /bin/xargs +file /bin/yacc file /bin/zcat link /bin/[ diff --git a/src/cmd/Makefile b/src/cmd/Makefile index d5784b6..d03daee 100644 --- a/src/cmd/Makefile +++ b/src/cmd/Makefile @@ -17,7 +17,7 @@ SUBDIR = adb adc-demo aout ar as awk basic calendar cc chflags \ ranlib re renice retroforth scm sed setty sh sl smallc \ smlrc smux stty sysctl test uname wiznet xargs \ zmodem gtest msec cron compress date2 tip \ - talloc uucp + talloc uucp yacc # /sbin SUBDIR += chown chroot disktool fsck getty init \ diff --git a/src/cmd/yacc/Makefile b/src/cmd/yacc/Makefile index 24f3204..030084f 100644 --- a/src/cmd/yacc/Makefile +++ b/src/cmd/yacc/Makefile @@ -1,24 +1,31 @@ -# -# @(#)Makefile 4.2.1 (2.11BSD) 1996/10/24 -# -DESTDIR= -SEPFLAG= -i -CFLAGS=-O -SRCS = Makefile dextern files yaccpar \ - y1.c y2.c y3.c y4.c \ - yaccdiffs yaccnews +#========================================== +# Makefile: makefile for yacc +# Copyright 2012 Majenko Technolohies +# (matt@majenko.co.uk +# Last Modified: 29/01/2012 +#========================================== -all: yacc +TOPSRC = $(shell cd ../../..; pwd) +include $(TOPSRC)/target.mk -yacc: y1.o y2.o y3.o y4.o - $(CC) ${SEPFLAG} -o yacc y?.o -y1.o y2.o y3.o y4.o: dextern files -install: yacc yaccpar - install -s yacc $(DESTDIR)/usr/bin - install -c yaccpar $(DESTDIR)/usr/share/misc -clean : - -rm -f *.o yacc +OBJS = y1.o y2.o y3.o y4.o +SRCS = y1.c y2.c y3.c y4.c -srcs: $(SRCS) -$(SRCS): - sccs get $@ +all: yacc + +yacc: ${OBJS} + ${CC} ${LDFLAGS} -o yacc.elf ${OBJS} ${LIBS} + ${OBJDUMP} -S yacc.elf > yacc.dis + ${SIZE} yacc.elf + ${ELF2AOUT} yacc.elf $@ + +clean: + -rm -f yacc ${OBJS} yacc.elf yacc.dis + +install: all + install yacc $(DESTDIR)/bin/ + +y1.o: y1.c dextern +y2.o: y2.c dextern +y3.o: y3.c dextern +y4.o: y4.c dextern diff --git a/src/cmd/yacc/dextern b/src/cmd/yacc/dextern index 295da7a..60be484 100644 --- a/src/cmd/yacc/dextern +++ b/src/cmd/yacc/dextern @@ -33,7 +33,7 @@ # ifdef MEDIUM # define ACTSIZE 4000 # define MEMSIZE 5200 -# define NSTATES 600 +# define NSTATES 750 # define NTERMS 127 # define NPROD 400 # define NNONTERM 200 @@ -43,6 +43,19 @@ # define WSETSIZE 250 # endif +# ifdef TINY +# define ACTSIZE 1000 +# define MEMSIZE 1300 +# define NSTATES 750 +# define NTERMS 127 +# define NPROD 200 +# define NNONTERM 50 +# define TEMPSIZE 200 +# define CNAMSZ 1000 +# define LSETSIZE 250 +# define WSETSIZE 100 +# endif + # define NAMESIZE 50 # define NTYPES 63 diff --git a/src/cmd/yacc/files b/src/cmd/yacc/files index 96ced82..9eeb349 100644 --- a/src/cmd/yacc/files +++ b/src/cmd/yacc/files @@ -17,4 +17,5 @@ /* basic size of the Yacc implementation */ /* # define HUGE */ -#define MEDIUM +/* #define MEDIUM */ +#define TINY diff --git a/src/cmd/yacc/y1.c b/src/cmd/yacc/y1.c index 51abb05..45d4c9b 100644 --- a/src/cmd/yacc/y1.c +++ b/src/cmd/yacc/y1.c @@ -3,6 +3,7 @@ static char sccsid[] = "@(#)y1.c 4.1.1 (2.11BSD) 1995/05/11"; #endif # include "dextern" +#include /* variables used locally */