Move source into src directory
[a56.git] / src / Makefile
1 #######################################################
2 #
3 #  a56 - a DSP56001 assembler
4 #
5 #  Written by Quinn C. Jensen
6 #  July 1990
7 #
8 #######################################################
9
10 # Copyright (C) 2012 Thorsten Alteholz <debian@alteholz.de>
11 #
12 # This file is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published
14 # by the Free Software Foundation, either version 3 of the License,
15 # or (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program. If not, see
24 # <http://www.gnu.org/licenses/>.
25 #
26 # This file incorporates work covered by the following copyright and
27 # permission notice:
28 #
29 # Copyright (C) 1990-1998 Quinn C. Jensen
30 #
31 # Permission to use, copy, modify, distribute, and sell this
32 # software and its documentation for any purpose is hereby granted
33 # without fee, provided that the above copyright notice appear in all
34 # copies and that both that copyright notice and this permission
35 # notice appear in supporting documentation.  The author makes no
36 # representations about the suitability of this software for any
37 # purpose. It is provided "as is" without express or implied
38 # warranty.
39
40 # environment definitions
41 # uncomment the ones you like
42
43 # generic unix
44 CC = cc
45 HOSTCC = cc
46 YACC = yacc
47 CCDEFS = -DLDEBUG
48 MV = mv
49 YTABC = y.tab.c
50 YTABH = y.tab.h
51 POSTPROCESS = echo
52
53 # gcc & bison
54 #CC = gcc
55 #HOSTCC = gcc
56 #YACC = bison -y
57 #CCDEFS =
58 #MV = mv
59 #YTABC = y.tab.c
60 #YTABH = y.tab.h
61 #POSTPROCESS = echo
62
63 # Delorie's DOS gcc (from ftp://omnigate.clarkson.edu/pub/msdos/djgpp)
64 #CC = gcc
65 #HOSTCC = gcc
66 #YACC = bison -y
67 #CCDEFS =
68 #MV = ren
69 #YTABC = y_tab.c
70 #YTABH = y_tab.h
71 #POSTPROCESS = coff2exe
72
73 # gcc cross-compile to go32 environment
74 #CC = i386-go32-gcc
75 #HOSTCC = cc
76 #YACC = yacc
77 #CCDEFS =
78 #MV = mv
79 #YTABC = y.tab.c
80 #YTABH = y.tab.h
81 #POSTPROCESS = echo
82
83 #######################################################
84
85 # -O or -g
86 #DEBUG = -O -Olimit 3000
87 DEBUG = -O
88
89 SRCS = main.c a56.y lex.c subs.c getopt.c kparse.key
90 OBJS = main.o gram.o lex.o toktab.o subs.o getopt.o kparse.o
91
92 DEFINES = $(CCDEFS)
93 #DEFINES = -DYYDEBUG -DLDEBUG $(CCDEFS)
94
95 CFLAGS = $(DEBUG) $(DEFINES) $(CPPFLAGS) $(LDFLAGS)
96
97 all:    keybld a56 toomf
98
99 a56:    $(OBJS)
100         $(CC) $(CFLAGS) -o a56 $(OBJS) -lm
101         @$(POSTPROCESS) a56
102
103 keybld: keybld.o ksubs.o
104         $(HOSTCC) $(CFLAGS) -o keybld keybld.o ksubs.o
105         @$(POSTPROCESS) keybld
106
107 keybld.o:       keybld.c
108         $(HOSTCC) $(CFLAGS) -c keybld.c
109
110 ksubs.o:        subs.c
111         $(HOSTCC) $(CFLAGS) -c subs.c
112         $(MV) subs.o ksubs.o
113
114 lex.o:  lex.c gram.h
115
116 kparse.c:       a56.key keybld
117         ./keybld < a56.key > kparse.c
118
119 gram.c gram.h:  a56.y
120         @echo "[expect 2 shift/reduce conflicts here]"
121         $(YACC) -d a56.y
122         $(MV) $(YTABC) gram.c
123         $(MV) $(YTABH) gram.h
124
125 toktab.c:       gram.h
126         awk -f tok.awk < gram.h > toktab.c
127
128 y.output:       a56.y
129         $(YACC) -v a56.y
130
131 toomf:  toomf.o
132         $(CC) -o toomf $(CFLAGS) toomf.o
133         @$(POSTPROCESS) toomf
134
135 torom:  torom.o subs.o
136         $(CC) -o torom $(CFLAGS) torom.o subs.o
137
138 tape:   toktab.c
139         csh -c 'tar cvbf 1 - `cat files` | gzip > a56.tar.gz'
140
141 main.o gram.o lex.o:    a56.h
142
143 clean:  ; rm -f a56 toomf y.output *.o *.out tmp *.bak a56.tar.gz keybld
144
145 spotless:       clean
146         rm -f gram.c lexyy.c gram.h toktab.c kparse.c