]> Shamusworld >> Repos - rmac/blobdiff - makefile
6502 support added back from original Madmac sources!
[rmac] / makefile
index cd52ffe9bc983b00ec0018d1be59cb0a7567b3ae..99325d6c78473d043a0e9b4a2e3f0ce3ab9451c5 100644 (file)
--- a/makefile
+++ b/makefile
@@ -4,21 +4,37 @@
 # 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 = -std=c99 -g -D__GCCUNIX__ -I. -O2
+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 riscasm.c rmac.c sect.c symbol.c token.c 
+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 riscasm.c rmac.c sect.c symbol.c token.c 6502.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 riscasm.o rmac.o sect.o symbol.o token.o
+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 riscasm.o rmac.o sect.o symbol.o token.o 6502.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
@@ -37,6 +53,9 @@ mntab.h : mntab 68kmn kwgen
 kwtab.h : kwtab kwgen
        ./kwgen kw <kwtab >kwtab.h
 
+6502.h : 6502.tbl kwgen
+       ./kwgen mp <6502.tbl >6502.h
+
 risckw.h : kwtab kwgen
        ./kwgen mr <risctab >risckw.h
 
@@ -51,7 +70,7 @@ 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
@@ -108,16 +127,19 @@ sect.o : sect.c
 symbol.o : symbol.c
        $(CC) $(CFLAGS) -c symbol.c
 
+6502.o : 6502.c
+       $(CC) $(CFLAGS) -c 6502.c
+
 token.o : token.c
-       $(CC) $(CFLAGS) -c token.c 
+       $(CC) $(CFLAGS) -c token.c
 
-rmac : $(OBJS) 
+rmac : $(OBJS)
        $(CC) $(CFLAGS) -o rmac $(OBJS)
 
 #
 # Clean build environment
 #
 
-clean: 
+clean:
        $(rm) $(OBJS) kwgen.o 68kgen.o rmac kwgen 68kgen kwtab.h 68ktab.h mntab.h risckw.h