]> Shamusworld >> Repos - rmac/blobdiff - makefile
Code cleanup, version bump for last commit. :-)
[rmac] / makefile
index e817900a498eacfda3d2dcea50a5500b60f85870..49e00db4cb2a242ccfe2b0cb415a479931678417 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,28 +1,47 @@
 #
 # RMAC - Reboot's Macro Assembler for the Atari Jaguar
 # Copyright (C) 199x Landon Dyer, 2011 Reboot & Friends
-# MAKEFILE for Non-Windows Compilation
-# Currently tested against Cygwin under Windows XP Pro
+# MAKEFILE for *nix
 #
 
-rm = /bin/rm -f 
+STD := c99
+
+# Detect old, shitty platforms that aren't C99/POSIX compliant
+OSTYPE := $(shell uname -a)
+
+# Should catch MinGW
+ifeq "$(findstring MINGW, $(OSTYPE))" "MINGW"
+STD := gnu99
+endif
+
+# If we're cross compiling using MXE, we're still fooooooooooked
+ifneq "$(CROSS)" ""
+STD := gnu99
+endif
+
+
+rm = /bin/rm -f
 CC = $(CROSS)gcc
 HOSTCC = gcc
 
-CFLAGS = -g -D__GCCUNIX__ -I. 
+CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2
 
-SRCS = amode.c debug.c direct.c eagen.c error.c expr.c listing.c mach.c macro.c mark.c object.c procln.c risca.c rmac.c sect.c symbol.c token.c 
+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
 
-OBJS = amode.o debug.o direct.o eagen.o error.o expr.o listing.o mach.o macro.o mark.o object.o procln.o risca.o rmac.o sect.o symbol.o token.o
+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
 
 #
 # Build everything
 #
 
-all : mntab.h 68ktab.h kwtab.h risckw.h rmac
+all : mntab.h 68ktab.h kwtab.h risckw.h 6502.h rmac
+       @echo
+       @echo "Don't forget to bump the version number before commiting!"
+       @echo
 
 #
-# Generated Sources for State Machines and Keyword, Directive and Mnemonic Definitions
+# Generated sources for state machines and keyword, directive and mnemonic
+# definitions
 #
 
 mntab.h : mntab 68kmn kwgen
@@ -34,11 +53,14 @@ mntab.h : mntab 68kmn kwgen
 kwtab.h : kwtab kwgen
        ./kwgen kw <kwtab >kwtab.h
 
+6502.h : 6502.tbl kwgen
+       ./kwgen mp <6502.tbl >6502kw.h
+
 risckw.h : kwtab kwgen
        ./kwgen mr <risctab >risckw.h
 
 #
-# Build Tools
+# Build tools
 #
 
 kwgen.o : kwgen.c
@@ -48,73 +70,76 @@ kwgen : kwgen.o
        $(HOSTCC) $(CFLAGS) -o kwgen kwgen.o
 
 68kgen.o : 68kgen.c
-       $(HOSTCC) $(CFLAGS) -c 68kgen.c 
+       $(HOSTCC) $(CFLAGS) -c 68kgen.c
 
 68kgen : 68kgen.o
        $(HOSTCC) $(CFLAGS) -o 68kgen 68kgen.o
 
 #
-# Build RMAC Executable
+# Build RMAC executable
 #
 
-amode.o : amode.c
+amode.o : amode.c amode.h
        $(CC) $(CFLAGS) -c amode.c
 
-debug.o : debug.c
+debug.o : debug.c debug.h
        $(CC) $(CFLAGS) -c debug.c
 
-direct.o : direct.c
+direct.o : direct.c direct.h
        $(CC) $(CFLAGS) -c direct.c
 
-eagen.o : eagen.c
+eagen.o : eagen.c eagen.h eagen0.c
        $(CC) $(CFLAGS) -c eagen.c
 
-error.o : error.c
+error.o : error.c error.h
        $(CC) $(CFLAGS) -c error.c
 
-expr.o : expr.c
+expr.o : expr.c expr.h
        $(CC) $(CFLAGS) -c expr.c
 
-listing.o : listing.c
+listing.o : listing.c listing.h
        $(CC) $(CFLAGS) -c listing.c
 
-mach.o : mach.c
+mach.o : mach.c mach.h
        $(CC) $(CFLAGS) -c mach.c
 
-macro.o : macro.c
+macro.o : macro.c macro.h
        $(CC) $(CFLAGS) -c macro.c
 
-mark.o : mark.c
+mark.o : mark.c mark.h
        $(CC) $(CFLAGS) -c mark.c
 
-object.o : object.c
+object.o : object.c object.h
        $(CC) $(CFLAGS) -c object.c
 
-procln.o : procln.c
+procln.o : procln.c procln.h
        $(CC) $(CFLAGS) -c procln.c
 
-risca.o : risca.c
+risca.o : risca.c risca.h
        $(CC) $(CFLAGS) -c risca.c
 
-rmac.o : rmac.c
+rmac.o : rmac.c rmac.h
        $(CC) $(CFLAGS) -c rmac.c
 
-sect.o : sect.c
+sect.o : sect.c sect.h
        $(CC) $(CFLAGS) -c sect.c
 
-symbol.o : symbol.c
+symbol.o : symbol.c symbol.h
        $(CC) $(CFLAGS) -c symbol.c
 
-token.o : token.c
-       $(CC) $(CFLAGS) -c token.c 
+6502.o : 6502.c 6502.h
+       $(CC) $(CFLAGS) -c 6502.c
+
+token.o : token.c token.h
+       $(CC) $(CFLAGS) -c token.c
 
-rmac : $(OBJS) 
+rmac : $(OBJS)
        $(CC) $(CFLAGS) -o rmac $(OBJS)
 
 #
-# Clean Build Environment
+# Clean build environment
 #
 
-clean: 
-       $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h
+clean:
+       $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h 6502kw.h