diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 60 |
1 files changed, 49 insertions, 11 deletions
@@ -3,11 +3,12 @@ LIBS=sdl else LIBS=sdl glew gl endif -LDFLAGS=-lm `pkg-config --libs $(LIBS)` ifdef DEBUG -CFLAGS=-ggdb -std=gnu99 `pkg-config --cflags-only-I $(LIBS)` -Wreturn-type -Werror=return-type +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 -std=gnu99 `pkg-config --cflags-only-I $(LIBS)` -Wreturn-type -Werror=return-type +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 ifdef PROFILE @@ -28,16 +29,50 @@ ifdef M68010 CFLAGS+= -DM68010 endif -TRANSOBJS=gen_x86.o x86_backend.o mem.o -M68KOBJS=68kinst.o m68k_to_x86.o runtime.o -Z80OBJS=z80inst.o z80_to_x86.o zruntime.o +ifndef CPU +CPU:=$(shell uname -m) +endif + + + +TRANSOBJS=gen.o backend.o mem.o +M68KOBJS=68kinst.o m68k_core.o +ifeq ($(CPU),x86_64) +M68KOBJS+= runtime.o m68k_core_x86.o +TRANSOBJS+= gen_x86.o backend_x86.o +else +ifeq ($(CPU),i686) +M68KOBJS+= runtime_32.o m68k_core_x86.o +TRANSOBJS+= gen_x86.o backend_x86.o +NOZ80:=1 +endif +endif + +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 +else +ifeq ($(CPU),i686) +CFLAGS+=-DX86_32 +endif +endif + +ifdef NOZ80 +CFLAGS+=-DNO_Z80 +else +MAINOBJS+= $(Z80OBJS) +endif + + all : dis zdis stateview vgmplay blastem -blastem : blastem.o debug.o gdb_remote.o vdp.o render_sdl.o io.o $(CONFIGOBJS) gst.o $(M68KOBJS) $(Z80OBJS) $(TRANSOBJS) $(AUDIOOBJS) - $(CC) -ggdb -o blastem blastem.o debug.o gdb_remote.o vdp.o render_sdl.o io.o $(CONFIGOBJS) gst.o $(M68KOBJS) $(Z80OBJS) $(TRANSOBJS) $(AUDIOOBJS) $(LDFLAGS) +blastem : $(MAINOBJS) + $(CC) -o blastem $(MAINOBJS) $(LDFLAGS) dis : dis.o 68kinst.o tern.o vos_program_module.o $(CC) -o dis dis.o 68kinst.o tern.o vos_program_module.o @@ -69,13 +104,16 @@ vgmplay : vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS) testgst : testgst.o gst.o $(CC) -o testgst testgst.o gst.o -test_x86 : test_x86.o gen_x86.o - $(CC) -o test_x86 test_x86.o gen_x86.o +test_x86 : test_x86.o gen_x86.o gen.o + $(CC) -o test_x86 test_x86.o gen_x86.o gen.o + +test_arm : test_arm.o gen_arm.o mem.o gen.o + $(CC) -o test_arm test_arm.o gen_arm.o mem.o gen.o gen_fib : gen_fib.o gen_x86.o mem.o $(CC) -o gen_fib gen_fib.o gen_x86.o mem.o -offsets : offsets.c z80_to_x86.h m68k_to_x86.h +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 |