]> Shamusworld >> Repos - rmac/blob - makefile
Version bump for last commit. :-)
[rmac] / makefile
1 #
2 # RMAC - Renamed Macro Assembler for all Atari computers
3 # Copyright (C) 199x Landon Dyer, 2011-2021 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 -MMD
28 CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2
29
30 OBJS = 6502.o amode.o debug.o direct.o dsp56k.o dsp56k_amode.o dsp56k_mach.o eagen.o error.o expr.o fltpoint.o listing.o mach.o macro.o mark.o object.o op.o procln.o riscasm.o rmac.o sect.o symbol.o token.o dirent_lose.o
31
32 #
33 # Build everything
34 #
35
36 #all: mntab.h 68ktab.h kwtab.h risckw.h 6502kw.h opkw.h dsp56ktab.h rmac
37 all: 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 68ktab.h 68k.tab: 68k.mch 68kgen
48         ./68kgen 68k.tab <68k.mch >68ktab.h
49
50 dsp56ktab.h dsp56k.tab: dsp56k.mch dsp56kgen
51         ./dsp56kgen dsp56k.tab <dsp56k.mch >dsp56ktab.h
52
53
54 mntab.h: direct.tab 68k.tab kwgen
55         cat direct.tab 68k.tab | ./kwgen mn >mntab.h
56
57 kwtab.h: kw.tab kwgen
58         ./kwgen kw <kw.tab >kwtab.h
59
60 6502kw.h: 6502.tab kwgen
61         ./kwgen mp <6502.tab >6502kw.h
62
63 risckw.h: risc.tab kwgen
64         ./kwgen mr <risc.tab >risckw.h
65
66 opkw.h: op.tab kwgen
67         ./kwgen mo <op.tab >opkw.h
68
69 68kregs.h: 68kregs.tab kwgen
70         ./kwgen reg68 <68kregs.tab >68kregs.h
71
72 56kregs.h: 56kregs.tab kwgen
73         ./kwgen reg56 <56kregs.tab >56kregs.h
74
75 6502regs.h: 6502regs.tab kwgen
76         ./kwgen reg65 <6502regs.tab >6502regs.h
77
78 riscregs.h: riscregs.tab kwgen
79         ./kwgen regrisc <riscregs.tab >riscregs.h
80
81 unarytab.h: unary.tab kwgen
82         ./kwgen unary <unary.tab >unarytab.h
83
84 # Looks like this is not needed...
85 dsp56kkw.h: dsp56k.tab kwgen
86         ./kwgen dsp <dsp56k.tab >dsp56kkw.h
87
88 #
89 # Build tools
90 #
91
92 %gen: %gen.c
93         $(HOSTCC) $(CFLAGS) -c $<
94         $(HOSTCC) $(CFLAGS) -o $*gen $<
95
96 #
97 # Build RMAC executable
98 #
99
100 %.o: %.c %.h
101         $(CC) $(CFLAGS) -c $<
102
103 rmac: $(OBJS)
104         $(CC) $(CFLAGS) -o rmac $(OBJS) -lm
105
106 #
107 # Clean build environment
108 #
109
110 clean:
111         $(RM) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen 68k.tab kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h opkw.h dsp56kgen dsp56kgen.o dsp56k.tab dsp56kkw.h dsp56ktab.h 68kregs.h 56kregs.h 6502regs.h riscregs.h unarytab.h
112
113 #
114 # Dependencies
115 #
116 6502.o: 6502.c direct.h rmac.h symbol.h token.h expr.h error.h mach.h \
117  procln.h riscasm.h sect.h kwtab.h 6502regs.h
118 68kgen: 68kgen.c
119 amode.o: amode.c amode.h rmac.h symbol.h error.h expr.h mach.h procln.h \
120  token.h sect.h riscasm.h kwtab.h mntab.h parmode.h 68kregs.h
121 debug.o: debug.c debug.h rmac.h symbol.h amode.h direct.h token.h expr.h \
122  mark.h sect.h riscasm.h
123 direct.o: direct.c direct.h rmac.h symbol.h token.h 6502.h amode.h \
124  error.h expr.h fltpoint.h listing.h mach.h macro.h mark.h procln.h \
125  riscasm.h sect.h kwtab.h 56kregs.h riscregs.h
126 dsp56k.o: dsp56k.c rmac.h symbol.h dsp56k.h sect.h riscasm.h
127 dsp56k_amode.o: dsp56k_amode.c dsp56k_amode.h rmac.h symbol.h amode.h \
128  error.h token.h expr.h procln.h sect.h riscasm.h kwtab.h mntab.h
129 dsp56k_mach.o: dsp56k_mach.c dsp56k_mach.h rmac.h symbol.h dsp56k_amode.h \
130  amode.h direct.h token.h dsp56k.h sect.h riscasm.h error.h kwtab.h \
131  dsp56ktab.h
132 dsp56kgen: dsp56kgen.c
133 eagen.o: eagen.c eagen.h rmac.h symbol.h amode.h error.h fltpoint.h \
134  mach.h mark.h riscasm.h sect.h token.h eagen0.c
135 error.o: error.c error.h rmac.h symbol.h listing.h token.h
136 expr.o: expr.c expr.h rmac.h symbol.h direct.h token.h error.h listing.h \
137  mach.h procln.h riscasm.h sect.h kwtab.h
138 fltpoint.o: fltpoint.c fltpoint.h
139 kwgen: kwgen.c
140 listing.o: listing.c listing.h rmac.h symbol.h error.h procln.h token.h \
141  sect.h riscasm.h version.h
142 mach.o: mach.c mach.h rmac.h symbol.h amode.h direct.h token.h eagen.h \
143  error.h expr.h procln.h riscasm.h sect.h kwtab.h 68ktab.h
144 macro.o: macro.c macro.h rmac.h symbol.h debug.h direct.h token.h error.h \
145  expr.h listing.h procln.h
146 mark.o: mark.c mark.h rmac.h symbol.h error.h object.h riscasm.h sect.h
147 object.o: object.c object.h rmac.h symbol.h 6502.h direct.h token.h \
148  error.h mark.h riscasm.h sect.h
149 op.o: op.c op.h direct.h rmac.h symbol.h token.h error.h expr.h \
150  fltpoint.h mark.h procln.h riscasm.h sect.h opkw.h
151 procln.o: procln.c procln.h rmac.h symbol.h token.h 6502.h amode.h \
152  direct.h dsp56kkw.h error.h expr.h listing.h mach.h macro.h op.h riscasm.h \
153  sect.h kwtab.h mntab.h risckw.h 6502kw.h opkw.h
154 riscasm.o: riscasm.c riscasm.h rmac.h symbol.h amode.h direct.h token.h \
155  error.h expr.h mark.h procln.h sect.h risckw.h kwtab.h
156 rmac.o: rmac.c rmac.h symbol.h 6502.h debug.h direct.h token.h error.h \
157  expr.h listing.h mark.h macro.h object.h procln.h riscasm.h sect.h \
158  version.h
159 sect.o: sect.c sect.h rmac.h symbol.h riscasm.h 6502.h direct.h token.h \
160  error.h expr.h listing.h mach.h mark.h riscregs.h
161 symbol.o: symbol.c symbol.h error.h rmac.h listing.h object.h procln.h \
162  token.h
163 token.o: token.c token.h rmac.h symbol.h direct.h error.h macro.h \
164  procln.h sect.h riscasm.h kwtab.h unarytab.h
165 dirent_lose.o: dirent_lose.h