changeset 805:3eced113081c

Pre-release cleanup
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Jul 2015 18:29:14 -0700
parents 59e664fa2da8
children 2dfcd20a00b6
files Makefile dis.c util.c vgmplay.c zdis.c
diffstat 5 files changed, 44 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Jul 26 17:21:49 2015 -0700
+++ b/Makefile	Sun Jul 26 18:29:14 2015 -0700
@@ -1,6 +1,7 @@
 ifndef OS
 OS:=$(shell uname -s)
 endif
+FIXUP:=true
 
 ifeq ($(OS),Windows)
 ifndef SDL2_PREFIX
@@ -12,7 +13,7 @@
 
 MEM:=mem_win.o
 TERMINAL:=terminal_win.o
-BLASTEM:=blastem.exe
+EXE:=.exe
 CC:=wine gcc.exe
 CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -I"$(SDL2_PREFIX)/include/SDL2" -DGLEW_STATIC
 LDFLAGS:= $(GLEW32S_LIB) -L"$(SDL2_PREFIX)/lib" -lm -lmingw32 -lSDL2main -lSDL2 -lws2_32 -lopengl32 -lglu32 -mwindows
@@ -22,7 +23,7 @@
 
 MEM:=mem.o
 TERMINAL:=terminal.o
-BLASTEM:=blastem
+EXE:=
 
 ifeq ($(OS),Darwin)
 LIBS=sdl2 glew
@@ -32,7 +33,6 @@
 
 HAS_PROC:=$(shell if [ -d /proc ]; then /bin/echo -e -DHAS_PROC; fi)
 CFLAGS:=-std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value -Wno-logical-op-parentheses $(HAS_PROC)
-FIXUP:=
 ifdef PORTABLE
 CFLAGS+= -DGLEW_STATIC -Iglew/include
 LDFLAGS:=-lm glew/lib/libGLEW.a
@@ -40,7 +40,7 @@
 ifeq ($(OS),Darwin)
 CFLAGS+= -IFrameworks/SDL2.framework/Headers
 LDFLAGS+= -FFrameworks -framework SDL2 -framework OpenGL
-FIXUP:=install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/Frameworks/SDL2.framework/Versions/A/SDL2 ./blastem
+FIXUP:=install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/Frameworks/SDL2.framework/Versions/A/SDL2
 else
 CFLAGS+= -Isdl/include
 LDFLAGS+= -Wl,-rpath='$$ORIGIN/lib' -Llib -lSDL2 $(shell pkg-config --libs gl)
@@ -125,23 +125,22 @@
 MAINOBJS+= $(Z80OBJS)
 endif
 
-ifeq ($(OS),Windows)
-ALL=$(BLASTEM)
-else
-ALL= dis zdis stateview vgmplay blastem termhelper
+ALL=dis$(EXE) zdis$(EXE) stateview$(EXE) vgmplay$(EXE) blastem$(EXE)
+ifneq ($(OS),Windows)
+ALL+= termhelper
 endif
 
 all : $(ALL)
 
-$(BLASTEM) : $(MAINOBJS)
-	$(CC) -o $(BLASTEM) $(MAINOBJS) $(LDFLAGS)
-	$(FIXUP)
+blastem$(EXE) : $(MAINOBJS)
+	$(CC) -o $@ $^ $(LDFLAGS)
+	$(FIXUP) ./$@
 
-dis : dis.o 68kinst.o tern.o vos_program_module.o
-	$(CC) -o dis dis.o 68kinst.o tern.o vos_program_module.o
+dis$(EXE) : dis.o 68kinst.o tern.o vos_program_module.o
+	$(CC) -o $@ $^ 
 
-zdis : zdis.o z80inst.o
-	$(CC) -o zdis zdis.o z80inst.o
+zdis$(EXE) : zdis.o z80inst.o
+	$(CC) -o $@ $^ 
 
 libemu68k.a : $(M68KOBJS) $(TRANSOBJS)
 	ar rcs libemu68k.a $(M68KOBJS) $(TRANSOBJS)
@@ -158,11 +157,13 @@
 ztestgen : ztestgen.o z80inst.o
 	$(CC) -ggdb -o ztestgen ztestgen.o z80inst.o
 
-stateview : stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o
-	$(CC) -o stateview stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o $(LDFLAGS)
+stateview$(EXE) : stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o
+	$(CC) -o $@ $^ $(LDFLAGS)
+	$(FIXUP) ./$@
 
-vgmplay : vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS)
-	$(CC) -o vgmplay vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS) $(LDFLAGS)
+vgmplay$(EXE) : vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS)
+	$(CC) -o $@ $^ $(LDFLAGS)
+	$(FIXUP) ./$@
 
 test : test.o vdp.o
 	$(CC) -o test test.o vdp.o
--- a/dis.c	Sun Jul 26 17:21:49 2015 -0700
+++ b/dis.c	Sun Jul 26 18:29:14 2015 -0700
@@ -7,12 +7,23 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 #include "vos_program_module.h"
 #include "tern.h"
 
 uint8_t visited[(16*1024*1024)/16];
 uint16_t label[(16*1024*1024)/8];
 
+void fatal_error(char *format, ...)
+{
+	va_list args;
+	va_start(args, format);
+	vfprintf(stderr, format, args);
+	va_end(args);
+	exit(1);
+}
+
+
 void visit(uint32_t address)
 {
 	address &= 0xFFFFFF;
--- a/util.c	Sun Jul 26 17:21:49 2015 -0700
+++ b/util.c	Sun Jul 26 18:29:14 2015 -0700
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <stdint.h>
+#include <stdarg.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
--- a/vgmplay.c	Sun Jul 26 17:21:49 2015 -0700
+++ b/vgmplay.c	Sun Jul 26 18:29:14 2015 -0700
@@ -10,6 +10,8 @@
 #include "util.h"
 #include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define MCLKS_NTSC 53693175
 #define MCLKS_PAL  53203395
--- a/zdis.c	Sun Jul 26 17:21:49 2015 -0700
+++ b/zdis.c	Sun Jul 26 18:29:14 2015 -0700
@@ -6,10 +6,20 @@
 #include "z80inst.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 
 uint8_t visited[(64*1024)/8];
 uint8_t label[(64*1024)/8];
 
+void fatal_error(char *format, ...)
+{
+	va_list args;
+	va_start(args, format);
+	vfprintf(stderr, format, args);
+	va_end(args);
+	exit(1);
+}
+
 void visit(uint16_t address)
 {
 	visited[address/8] |= 1 << (address % 8);