]> Shamusworld >> Repos - rmac/blob - makefile
Possible fix for bug #92.
[rmac] / makefile
1 #
2 # RMAC - Reboot's Macro Assembler for the Atari Jaguar
3 # Copyright (C) 199x Landon Dyer, 2011 Reboot & Friends
4 # MAKEFILE for *nix
5 #
6
7 STD := c99
8
9 # Detect old, shitty platforms that aren't C99/POSIX compliant
10 OSTYPE := $(shell uname -a)
11
12 # Should catch MinGW
13 ifeq "$(findstring MINGW, $(OSTYPE))" "MINGW"
14 STD := gnu99
15 endif
16
17 # If we're cross compiling using MXE, we're still fooooooooooked
18 ifneq "$(CROSS)" ""
19 STD := gnu99
20 endif
21
22
23 rm = /bin/rm -f
24 CC = $(CROSS)gcc
25 HOSTCC = gcc
26
27 CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2
28
29 SRCS = 6502.c amode.c debug.c direct.c eagen.c error.c expr.c listing.c mach.c macro.c mark.c object.c procln.c riscasm.c rmac.c sect.c symbol.c token.c
30
31 OBJS = 6502.o amode.o debug.o direct.o eagen.o error.o expr.o listing.o mach.o macro.o mark.o object.o procln.o riscasm.o rmac.o sect.o symbol.o token.o
32
33 #
34 # Build everything
35 #
36
37 all : mntab.h 68ktab.h kwtab.h risckw.h 6502.h rmac
38         @echo
39         @echo "Don't forget to bump the version number before commiting!"
40         @echo
41
42 #
43 # Generated sources for state machines and keyword, directive and mnemonic
44 # definitions
45 #
46
47 mntab.h : mntab 68kmn kwgen
48         cat mntab 68kmn | ./kwgen mn >mntab.h
49
50 68ktab.h 68kmn : 68ktab 68ktab 68kgen
51         ./68kgen 68kmn <68ktab >68ktab.h
52
53 kwtab.h : kwtab kwgen
54         ./kwgen kw <kwtab >kwtab.h
55
56 6502.h : 6502.tbl kwgen
57         ./kwgen mp <6502.tbl >6502kw.h
58
59 risckw.h : kwtab kwgen
60         ./kwgen mr <risctab >risckw.h
61
62 #
63 # Build tools
64 #
65
66 kwgen.o : kwgen.c
67         $(HOSTCC) $(CFLAGS) -c kwgen.c
68
69 kwgen : kwgen.o
70         $(HOSTCC) $(CFLAGS) -o kwgen kwgen.o
71
72 68kgen.o : 68kgen.c
73         $(HOSTCC) $(CFLAGS) -c 68kgen.c
74
75 68kgen : 68kgen.o
76         $(HOSTCC) $(CFLAGS) -o 68kgen 68kgen.o
77
78 #
79 # Build RMAC executable
80 #
81
82 6502.o : 6502.c 6502.h
83         $(CC) $(CFLAGS) -c 6502.c
84
85 amode.o : amode.c amode.h
86         $(CC) $(CFLAGS) -c amode.c
87
88 debug.o : debug.c debug.h
89         $(CC) $(CFLAGS) -c debug.c
90
91 direct.o : direct.c direct.h
92         $(CC) $(CFLAGS) -c direct.c
93
94 eagen.o : eagen.c eagen.h eagen0.c
95         $(CC) $(CFLAGS) -c eagen.c
96
97 error.o : error.c error.h
98         $(CC) $(CFLAGS) -c error.c
99
100 expr.o : expr.c expr.h
101         $(CC) $(CFLAGS) -c expr.c
102
103 listing.o : listing.c listing.h
104         $(CC) $(CFLAGS) -c listing.c
105
106 mach.o : mach.c mach.h
107         $(CC) $(CFLAGS) -c mach.c
108
109 macro.o : macro.c macro.h
110         $(CC) $(CFLAGS) -c macro.c
111
112 mark.o : mark.c mark.h
113         $(CC) $(CFLAGS) -c mark.c
114
115 object.o : object.c object.h
116         $(CC) $(CFLAGS) -c object.c
117
118 procln.o : procln.c procln.h
119         $(CC) $(CFLAGS) -c procln.c
120
121 risca.o : risca.c risca.h
122         $(CC) $(CFLAGS) -c risca.c
123
124 rmac.o : rmac.c rmac.h
125         $(CC) $(CFLAGS) -c rmac.c
126
127 sect.o : sect.c sect.h
128         $(CC) $(CFLAGS) -c sect.c
129
130 symbol.o : symbol.c symbol.h
131         $(CC) $(CFLAGS) -c symbol.c
132
133 token.o : token.c token.h
134         $(CC) $(CFLAGS) -c token.c
135
136 rmac : $(OBJS)
137         $(CC) $(CFLAGS) -o rmac $(OBJS)
138
139 #
140 # Clean build environment
141 #
142
143 clean:
144         $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h
145
146 #
147 # Dependencies
148 #
149 6502.o: 6502.c direct.h rmac.h symbol.h expr.h error.h mach.h amode.h \
150  procln.h token.h riscasm.h sect.h
151 68kgen.o: 68kgen.c
152 amode.o: amode.c amode.h rmac.h symbol.h error.h token.h expr.h kwtab.h \
153  mntab.h parmode.h
154 debug.o: debug.c debug.h rmac.h symbol.h amode.h direct.h mark.h sect.h \
155  token.h
156 direct.o: direct.c direct.h rmac.h symbol.h 6502.h error.h expr.h \
157  listing.h mach.h amode.h macro.h mark.h procln.h token.h riscasm.h \
158  sect.h kwtab.h
159 eagen.o: eagen.c eagen.h rmac.h symbol.h amode.h sect.h mark.h error.h \
160  mach.h riscasm.h eagen0.c
161 error.o: error.c error.h rmac.h symbol.h token.h listing.h
162 expr.o: expr.c expr.h rmac.h symbol.h direct.h error.h listing.h mach.h \
163  amode.h procln.h token.h riscasm.h sect.h kwtab.h
164 kwgen.o: kwgen.c
165 listing.o: listing.c listing.h rmac.h symbol.h version.h token.h procln.h \
166  sect.h error.h
167 mach.o: mach.c mach.h amode.h rmac.h symbol.h eagen.h error.h direct.h \
168  procln.h token.h riscasm.h sect.h kwtab.h 68ktab.h
169 macro.o: macro.c macro.h rmac.h symbol.h debug.h direct.h error.h expr.h \
170  listing.h procln.h token.h
171 mark.o: mark.c mark.h rmac.h symbol.h error.h object.h riscasm.h sect.h
172 object.o: object.c object.h rmac.h symbol.h error.h mark.h riscasm.h \
173  sect.h
174 procln.o: procln.c procln.h rmac.h symbol.h token.h 6502.h amode.h \
175  direct.h error.h expr.h listing.h mach.h macro.h riscasm.h sect.h \
176  kwtab.h mntab.h risckw.h 6502kw.h
177 riscasm.o: riscasm.c riscasm.h rmac.h symbol.h amode.h direct.h error.h \
178  expr.h mark.h procln.h token.h sect.h risckw.h kwtab.h
179 rmac.o: rmac.c rmac.h symbol.h 6502.h debug.h direct.h error.h expr.h \
180  listing.h mark.h macro.h object.h procln.h token.h riscasm.h sect.h \
181  version.h
182 sect.o: sect.c sect.h rmac.h symbol.h 6502.h direct.h error.h expr.h \
183  listing.h mach.h amode.h mark.h riscasm.h token.h
184 symbol.o: symbol.c symbol.h error.h rmac.h listing.h object.h procln.h \
185  token.h
186 token.o: token.c token.h rmac.h symbol.h error.h macro.h procln.h sect.h \
187  kwtab.h
188