+#######################################################
+#
+# a56 - a DSP56001 assembler
+#
+# Written by Quinn C. Jensen
+# July 1990
+#
+#######################################################
+
+# Copyright (C) 2012 Thorsten Alteholz <debian@alteholz.de>
+#
+# This file 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 3 of the License,
+# or (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+# This file incorporates work covered by the following copyright and
+# permission notice:
+#
+# Copyright (C) 1990-1998 Quinn C. Jensen
+#
+# Permission to use, copy, modify, distribute, and sell this
+# software and its documentation for any purpose is hereby granted
+# without fee, provided that the above copyright notice appear in all
+# copies and that both that copyright notice and this permission
+# notice appear in supporting documentation. The author makes no
+# representations about the suitability of this software for any
+# purpose. It is provided "as is" without express or implied
+# warranty.
+
+# environment definitions
+# uncomment the ones you like
+
+# generic unix
+CC = cc
+HOSTCC = cc
+YACC = yacc
+CCDEFS = -DLDEBUG
+MV = mv
+YTABC = y.tab.c
+YTABH = y.tab.h
+POSTPROCESS = echo
+
+# gcc & bison
+#CC = gcc
+#HOSTCC = gcc
+#YACC = bison -y
+#CCDEFS =
+#MV = mv
+#YTABC = y.tab.c
+#YTABH = y.tab.h
+#POSTPROCESS = echo
+
+# Delorie's DOS gcc (from ftp://omnigate.clarkson.edu/pub/msdos/djgpp)
+#CC = gcc
+#HOSTCC = gcc
+#YACC = bison -y
+#CCDEFS =
+#MV = ren
+#YTABC = y_tab.c
+#YTABH = y_tab.h
+#POSTPROCESS = coff2exe
+
+# gcc cross-compile to go32 environment
+#CC = i386-go32-gcc
+#HOSTCC = cc
+#YACC = yacc
+#CCDEFS =
+#MV = mv
+#YTABC = y.tab.c
+#YTABH = y.tab.h
+#POSTPROCESS = echo
+
+#######################################################
+
+# -O or -g
+#DEBUG = -O -Olimit 3000
+DEBUG = -O
+
+SRCS = main.c a56.y lex.c subs.c getopt.c kparse.key
+OBJS = main.o gram.o lex.o toktab.o subs.o getopt.o kparse.o
+
+DEFINES = $(CCDEFS)
+#DEFINES = -DYYDEBUG -DLDEBUG $(CCDEFS)
+
+CFLAGS = $(DEBUG) $(DEFINES) $(CPPFLAGS) $(LDFLAGS)
+
+all: keybld a56 toomf
+
+a56: $(OBJS)
+ $(CC) $(CFLAGS) -o a56 $(OBJS) -lm
+ @$(POSTPROCESS) a56
+
+keybld: keybld.o ksubs.o
+ $(HOSTCC) $(CFLAGS) -o keybld keybld.o ksubs.o
+ @$(POSTPROCESS) keybld
+
+keybld.o: keybld.c
+ $(HOSTCC) $(CFLAGS) -c keybld.c
+
+ksubs.o: subs.c
+ $(HOSTCC) $(CFLAGS) -c subs.c
+ $(MV) subs.o ksubs.o
+
+lex.o: lex.c gram.h
+
+kparse.c: a56.key keybld
+ ./keybld < a56.key > kparse.c
+
+gram.c gram.h: a56.y
+ @echo "[expect 2 shift/reduce conflicts here]"
+ $(YACC) -d a56.y
+ $(MV) $(YTABC) gram.c
+ $(MV) $(YTABH) gram.h
+
+toktab.c: gram.h
+ awk -f tok.awk < gram.h > toktab.c
+
+y.output: a56.y
+ $(YACC) -v a56.y
+
+toomf: toomf.o
+ $(CC) -o toomf $(CFLAGS) toomf.o
+ @$(POSTPROCESS) toomf
+
+torom: torom.o subs.o
+ $(CC) -o torom $(CFLAGS) torom.o subs.o
+
+tape: toktab.c
+ csh -c 'tar cvbf 1 - `cat files` | gzip > a56.tar.gz'
+
+main.o gram.o lex.o: a56.h
+
+clean: ; rm -f a56 toomf y.output *.o *.out tmp *.bak a56.tar.gz keybld
+
+spotless: clean
+ rm -f gram.c lexyy.c gram.h toktab.c kparse.c