2 # RMAC - Reboot's Macro Assembler for the Atari Jaguar
3 # Copyright (C) 199x Landon Dyer, 2011 Reboot & Friends
9 # Detect old, shitty platforms that aren't C99/POSIX compliant
10 OSTYPE := $(shell uname -a)
13 ifeq "$(findstring MINGW, $(OSTYPE))" "MINGW"
17 # If we're cross compiling using MXE, we're still fooooooooooked
27 #CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2 -MMD
28 CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2
30 SRCS = 6502.c amode.c debug.c direct.c eagen.c error.c expr.c fltpoint.c listing.c mach.c macro.c mark.c object.c procln.c riscasm.c rmac.c sect.c symbol.c token.c
32 OBJS = 6502.o amode.o debug.o direct.o eagen.o error.o expr.o fltpoint.o listing.o mach.o macro.o mark.o object.o procln.o riscasm.o rmac.o sect.o symbol.o token.o
38 all : mntab.h 68ktab.h kwtab.h risckw.h 6502kw.h rmac
40 @echo "Don't forget to bump the version number before commiting!"
44 # Generated sources for state machines and keyword, directive and mnemonic
48 mntab.h : mntab 68kmn kwgen
49 cat mntab 68kmn | ./kwgen mn >mntab.h
51 68ktab.h 68kmn : 68ktab 68ktab 68kgen
52 ./68kgen 68kmn <68ktab >68ktab.h
56 ./kwgen kw <kwtab >kwtab.h
58 6502kw.h : 6502.tbl kwgen
59 ./kwgen mp <6502.tbl >6502kw.h
61 risckw.h : kwtab kwgen
62 ./kwgen mr <risctab >risckw.h
69 $(HOSTCC) $(CFLAGS) -c kwgen.c
72 $(HOSTCC) $(CFLAGS) -o kwgen kwgen.o
75 $(HOSTCC) $(CFLAGS) -c 68kgen.c
78 $(HOSTCC) $(CFLAGS) -o 68kgen 68kgen.o
81 # Build RMAC executable
84 6502.o : 6502.c 6502.h
85 $(CC) $(CFLAGS) -c 6502.c
87 amode.o : amode.c amode.h
88 $(CC) $(CFLAGS) -c amode.c
90 debug.o : debug.c debug.h
91 $(CC) $(CFLAGS) -c debug.c
93 direct.o : direct.c direct.h
94 $(CC) $(CFLAGS) -c direct.c
96 eagen.o : eagen.c eagen.h eagen0.c
97 $(CC) $(CFLAGS) -c eagen.c
99 error.o : error.c error.h
100 $(CC) $(CFLAGS) -c error.c
102 expr.o : expr.c expr.h
103 $(CC) $(CFLAGS) -c expr.c
105 fltpoint.o : fltpoint.c fltpoint.h
106 $(CC) $(CFLAGS) -c fltpoint.c
108 listing.o : listing.c listing.h
109 $(CC) $(CFLAGS) -c listing.c
111 mach.o : mach.c mach.h
112 $(CC) $(CFLAGS) -c mach.c
114 macro.o : macro.c macro.h
115 $(CC) $(CFLAGS) -c macro.c
117 mark.o : mark.c mark.h
118 $(CC) $(CFLAGS) -c mark.c
120 object.o : object.c object.h
121 $(CC) $(CFLAGS) -c object.c
123 procln.o : procln.c procln.h
124 $(CC) $(CFLAGS) -c procln.c
126 riscasm.o : riscasm.c riscasm.h
127 $(CC) $(CFLAGS) -c riscasm.c
129 rmac.o : rmac.c rmac.h
130 $(CC) $(CFLAGS) -c rmac.c
132 sect.o : sect.c sect.h
133 $(CC) $(CFLAGS) -c sect.c
135 symbol.o : symbol.c symbol.h
136 $(CC) $(CFLAGS) -c symbol.c
138 token.o : token.c token.h
139 $(CC) $(CFLAGS) -c token.c
142 $(CC) $(CFLAGS) -o rmac $(OBJS) -lm
145 # Clean build environment
149 $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h
154 6502.o: 6502.c direct.h rmac.h symbol.h expr.h error.h mach.h procln.h \
155 token.h riscasm.h sect.h
157 amode.o: amode.c amode.h rmac.h symbol.h error.h expr.h mach.h procln.h \
158 token.h sect.h kwtab.h mntab.h parmode.h
159 debug.o: debug.c debug.h rmac.h symbol.h amode.h direct.h mark.h sect.h \
161 direct.o: direct.c direct.h rmac.h symbol.h 6502.h amode.h error.h expr.h \
162 listing.h mach.h macro.h mark.h procln.h token.h riscasm.h sect.h \
164 eagen.o: eagen.c eagen.h rmac.h symbol.h amode.h sect.h mark.h error.h \
165 mach.h riscasm.h eagen0.c fltpoint.h
166 error.o: error.c error.h rmac.h symbol.h token.h listing.h
167 expr.o: expr.c expr.h rmac.h symbol.h direct.h error.h listing.h mach.h \
168 procln.h token.h riscasm.h sect.h kwtab.h
170 listing.o: listing.c listing.h rmac.h symbol.h error.h procln.h token.h \
172 mach.o: mach.c mach.h rmac.h symbol.h amode.h direct.h eagen.h error.h \
173 procln.h token.h riscasm.h sect.h kwtab.h 68ktab.h
174 macro.o: macro.c macro.h rmac.h symbol.h debug.h direct.h error.h expr.h \
175 listing.h procln.h token.h
176 mark.o: mark.c mark.h rmac.h symbol.h error.h object.h riscasm.h sect.h
177 object.o: object.c object.h rmac.h symbol.h 6502.h error.h mark.h \
179 procln.o: procln.c procln.h rmac.h symbol.h token.h 6502.h amode.h \
180 direct.h error.h expr.h listing.h mach.h macro.h riscasm.h sect.h \
181 kwtab.h mntab.h risckw.h 6502kw.h
182 riscasm.o: riscasm.c riscasm.h rmac.h symbol.h amode.h direct.h error.h \
183 expr.h mark.h procln.h token.h sect.h risckw.h kwtab.h
184 rmac.o: rmac.c rmac.h symbol.h 6502.h debug.h direct.h error.h expr.h \
185 listing.h mark.h macro.h object.h procln.h token.h riscasm.h sect.h \
187 sect.o: sect.c sect.h rmac.h symbol.h 6502.h direct.h error.h expr.h \
188 listing.h mach.h mark.h riscasm.h token.h
189 symbol.o: symbol.c symbol.h error.h rmac.h listing.h object.h procln.h \
191 token.o: token.c token.h rmac.h symbol.h direct.h error.h macro.h \
192 procln.h sect.h kwtab.h