summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile75
1 files changed, 48 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index b7b0eee..b3e966b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,36 +1,40 @@
+ifndef OS
+OS:=$(shell uname -s)
+endif
-ifdef WINDOWS
+ifeq ($(OS),Windows)
+CC:=wine gcc.exe
MEM:=mem_win.o
BLASTEM:=blastem.exe
-RUNTIME32:=runtime_win.S
CC:=wine gcc.exe
-CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -I"C:/MinGW/usr/include/SDL" -DGLEW_STATIC
-LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDLmain -lSDL
-ifndef NOGL
-LDFLAGS+= -lopengl32 -lglu32
-endif
-LDFLAGS+= -mwindows
+CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=
+LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDLmain -lSDL -mwindows
CPU:=i686
else
MEM:=mem.o
BLASTEM:=blastem
-RUNTIME32:=runtime_32.S
-ifdef NOGL
-LIBS=sdl
+ifeq ($(OS),Darwin)
+LIBS=sdl2 glew
else
-LIBS=sdl glew gl
-endif
-ifdef DEBUG
+LIBS=sdl2 glew gl
+endif #Darwin
+
+ifdef DEBUGW
CFLAGS:=-ggdb -std=gnu99 $(shell pkg-config --cflags-only-I $(LIBS)) -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration
LDFLAGS:=-ggdb -lm $(shell pkg-config --libs $(LIBS))
else
CFLAGS:=-O2 -flto -std=gnu99 $(shell pkg-config --cflags-only-I $(LIBS)) -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration
LDFLAGS:=-O2 -flto -lm $(shell pkg-config --libs $(LIBS))
+endif #DEBUG
+endif #Windows
+
+ifdef Z80_LOG_ADDRESS
+CFLAGS+= -DZ80_LOG_ADDRESS
endif
ifdef PROFILE
@@ -41,36 +45,49 @@ ifdef NOGL
CFLAGS+= -DDISABLE_OPENGL
endif
+ifdef M68030
+CFLAGS+= -DM68030
+endif
+ifdef M68020
+CFLAGS+= -DM68020
+endif
+ifdef M68010
+CFLAGS+= -DM68010
+endif
+
ifndef CPU
CPU:=$(shell uname -m)
endif
-endif
+ifeq ($(OS),Darwin)
+LDFLAGS+= -framework OpenGL
+endif
-TRANSOBJS=gen.o backend.o $(MEM)
+TRANSOBJS=gen.o backend.o mem.o
M68KOBJS=68kinst.o m68k_core.o
ifeq ($(CPU),x86_64)
-M68KOBJS+= runtime.o m68k_core_x86.o
+M68KOBJS+= m68k_core_x86.o
TRANSOBJS+= gen_x86.o backend_x86.o
else
ifeq ($(CPU),i686)
-M68KOBJS+= $(RUNTIME32) m68k_core_x86.o
+M68KOBJS+= m68k_core_x86.o
TRANSOBJS+= gen_x86.o backend_x86.o
-NOZ80:=1
endif
endif
-Z80OBJS=z80inst.o z80_to_x86.o zruntime.o
+Z80OBJS=z80inst.o z80_to_x86.o
AUDIOOBJS=ym2612.o psg.o wave.o
CONFIGOBJS=config.o tern.o util.o
MAINOBJS=blastem.o debug.o gdb_remote.o vdp.o render_sdl.o io.o $(CONFIGOBJS) gst.o $(M68KOBJS) $(TRANSOBJS) $(AUDIOOBJS)
ifeq ($(CPU),x86_64)
-CFLAGS+=-DX86_64
+CFLAGS+=-DX86_64 -m64
+LDFLAGS+=-m64
else
ifeq ($(CPU),i686)
-CFLAGS+=-DX86_32
+CFLAGS+=-DX86_32 -m32
+LDFLAGS+=-m32
endif
endif
@@ -81,18 +98,16 @@ MAINOBJS+= $(Z80OBJS)
endif
ifdef WINDOWS
-ifndef NOGL
MAINOBJS+= glew32s.lib
endif
-endif
all : dis zdis stateview vgmplay blastem
$(BLASTEM) : $(MAINOBJS)
$(CC) -o $(BLASTEM) $(MAINOBJS) $(LDFLAGS)
-dis : dis.o 68kinst.o
- $(CC) -o dis dis.o 68kinst.o
+dis : dis.o 68kinst.o tern.o vos_program_module.o
+ $(CC) -o dis dis.o 68kinst.o tern.o vos_program_module.o
zdis : zdis.o z80inst.o
$(CC) -o zdis zdis.o z80inst.o
@@ -117,6 +132,9 @@ stateview : stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o
vgmplay : vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS)
$(CC) -o vgmplay vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS) $(LDFLAGS)
+
+test : test.o vdp.o
+ $(CC) -o test test.o vdp.o
testgst : testgst.o gst.o
$(CC) -o testgst testgst.o gst.o
@@ -133,6 +151,9 @@ gen_fib : gen_fib.o gen_x86.o mem.o
offsets : offsets.c z80_to_x86.h m68k_core.h
$(CC) -o offsets offsets.c
+vos_prog_info : vos_prog_info.o vos_program_module.o
+ $(CC) -o vos_prog_info vos_prog_info.o vos_program_module.o
+
%.o : %.S
$(CC) -c -o $@ $<
@@ -140,7 +161,7 @@ offsets : offsets.c z80_to_x86.h m68k_core.h
$(CC) $(CFLAGS) -c -o $@ $<
%.bin : %.s68
- vasmm68k_mot -Fbin -m68000 -no-opt -spaces -o $@ $<
+ vasmm68k_mot -Fbin -m68000 -no-opt -spaces -o $@ -L $@.list $<
%.bin : %.sz8
vasmz80_mot -Fbin -spaces -o $@ $<