comparison Makefile @ 744:fc68992cf18d

Merge windows branch with latest changes
author Michael Pavone <pavone@retrodev.com>
date Thu, 28 May 2015 21:19:55 -0700
parents cf78cb045fa4 539d12fa6a4d
children daa31ee7d8cd
comparison
equal deleted inserted replaced
743:cf78cb045fa4 744:fc68992cf18d
1 ifndef OS
2 OS:=$(shell uname -s)
3 endif
1 4
2 ifdef WINDOWS 5 ifeq ($(OS),Windows)
6 CC:=wine gcc.exe
3 7
4 MEM:=mem_win.o 8 MEM:=mem_win.o
5 BLASTEM:=blastem.exe 9 BLASTEM:=blastem.exe
6 RUNTIME32:=runtime_win.S
7 10
8 CC:=wine gcc.exe 11 CC:=wine gcc.exe
9 CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -I"C:/MinGW/usr/include/SDL" -DGLEW_STATIC 12 CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=
10 LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDLmain -lSDL 13 LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDLmain -lSDL -mwindows
11 ifndef NOGL
12 LDFLAGS+= -lopengl32 -lglu32
13 endif
14 LDFLAGS+= -mwindows
15 CPU:=i686 14 CPU:=i686
16 15
17 else 16 else
18 17
19 MEM:=mem.o 18 MEM:=mem.o
20 BLASTEM:=blastem 19 BLASTEM:=blastem
21 RUNTIME32:=runtime_32.S
22 20
23 ifdef NOGL 21 ifeq ($(OS),Darwin)
24 LIBS=sdl 22 LIBS=sdl2 glew
25 else 23 else
26 LIBS=sdl glew gl 24 LIBS=sdl2 glew gl
27 endif 25 endif #Darwin
28 ifdef DEBUG 26
27 ifdef DEBUGW
29 CFLAGS:=-ggdb -std=gnu99 $(shell pkg-config --cflags-only-I $(LIBS)) -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration 28 CFLAGS:=-ggdb -std=gnu99 $(shell pkg-config --cflags-only-I $(LIBS)) -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration
30 LDFLAGS:=-ggdb -lm $(shell pkg-config --libs $(LIBS)) 29 LDFLAGS:=-ggdb -lm $(shell pkg-config --libs $(LIBS))
31 else 30 else
32 CFLAGS:=-O2 -flto -std=gnu99 $(shell pkg-config --cflags-only-I $(LIBS)) -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration 31 CFLAGS:=-O2 -flto -std=gnu99 $(shell pkg-config --cflags-only-I $(LIBS)) -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration
33 LDFLAGS:=-O2 -flto -lm $(shell pkg-config --libs $(LIBS)) 32 LDFLAGS:=-O2 -flto -lm $(shell pkg-config --libs $(LIBS))
33 endif #DEBUG
34 endif #Windows
35
36 ifdef Z80_LOG_ADDRESS
37 CFLAGS+= -DZ80_LOG_ADDRESS
34 endif 38 endif
35 39
36 ifdef PROFILE 40 ifdef PROFILE
37 CFLAGS+= -pg 41 CFLAGS+= -pg
38 LDFLAGS+= -pg 42 LDFLAGS+= -pg
39 endif 43 endif
40 ifdef NOGL 44 ifdef NOGL
41 CFLAGS+= -DDISABLE_OPENGL 45 CFLAGS+= -DDISABLE_OPENGL
42 endif 46 endif
43 47
48 ifdef M68030
49 CFLAGS+= -DM68030
50 endif
51 ifdef M68020
52 CFLAGS+= -DM68020
53 endif
54 ifdef M68010
55 CFLAGS+= -DM68010
56 endif
57
44 ifndef CPU 58 ifndef CPU
45 CPU:=$(shell uname -m) 59 CPU:=$(shell uname -m)
46 endif 60 endif
61
62 ifeq ($(OS),Darwin)
63 LDFLAGS+= -framework OpenGL
47 endif 64 endif
48 65
49 66 TRANSOBJS=gen.o backend.o mem.o
50 TRANSOBJS=gen.o backend.o $(MEM)
51 M68KOBJS=68kinst.o m68k_core.o 67 M68KOBJS=68kinst.o m68k_core.o
52 ifeq ($(CPU),x86_64) 68 ifeq ($(CPU),x86_64)
53 M68KOBJS+= runtime.o m68k_core_x86.o 69 M68KOBJS+= m68k_core_x86.o
54 TRANSOBJS+= gen_x86.o backend_x86.o 70 TRANSOBJS+= gen_x86.o backend_x86.o
55 else 71 else
56 ifeq ($(CPU),i686) 72 ifeq ($(CPU),i686)
57 M68KOBJS+= $(RUNTIME32) m68k_core_x86.o 73 M68KOBJS+= m68k_core_x86.o
58 TRANSOBJS+= gen_x86.o backend_x86.o 74 TRANSOBJS+= gen_x86.o backend_x86.o
59 NOZ80:=1
60 endif 75 endif
61 endif 76 endif
62 77
63 Z80OBJS=z80inst.o z80_to_x86.o zruntime.o 78 Z80OBJS=z80inst.o z80_to_x86.o
64 AUDIOOBJS=ym2612.o psg.o wave.o 79 AUDIOOBJS=ym2612.o psg.o wave.o
65 CONFIGOBJS=config.o tern.o util.o 80 CONFIGOBJS=config.o tern.o util.o
66 81
67 MAINOBJS=blastem.o debug.o gdb_remote.o vdp.o render_sdl.o io.o $(CONFIGOBJS) gst.o $(M68KOBJS) $(TRANSOBJS) $(AUDIOOBJS) 82 MAINOBJS=blastem.o debug.o gdb_remote.o vdp.o render_sdl.o io.o $(CONFIGOBJS) gst.o $(M68KOBJS) $(TRANSOBJS) $(AUDIOOBJS)
68 83
69 ifeq ($(CPU),x86_64) 84 ifeq ($(CPU),x86_64)
70 CFLAGS+=-DX86_64 85 CFLAGS+=-DX86_64 -m64
86 LDFLAGS+=-m64
71 else 87 else
72 ifeq ($(CPU),i686) 88 ifeq ($(CPU),i686)
73 CFLAGS+=-DX86_32 89 CFLAGS+=-DX86_32 -m32
90 LDFLAGS+=-m32
74 endif 91 endif
75 endif 92 endif
76 93
77 ifdef NOZ80 94 ifdef NOZ80
78 CFLAGS+=-DNO_Z80 95 CFLAGS+=-DNO_Z80
79 else 96 else
80 MAINOBJS+= $(Z80OBJS) 97 MAINOBJS+= $(Z80OBJS)
81 endif 98 endif
82 99
83 ifdef WINDOWS 100 ifdef WINDOWS
84 ifndef NOGL
85 MAINOBJS+= glew32s.lib 101 MAINOBJS+= glew32s.lib
86 endif
87 endif 102 endif
88 103
89 all : dis zdis stateview vgmplay blastem 104 all : dis zdis stateview vgmplay blastem
90 105
91 $(BLASTEM) : $(MAINOBJS) 106 $(BLASTEM) : $(MAINOBJS)
92 $(CC) -o $(BLASTEM) $(MAINOBJS) $(LDFLAGS) 107 $(CC) -o $(BLASTEM) $(MAINOBJS) $(LDFLAGS)
93 108
94 dis : dis.o 68kinst.o 109 dis : dis.o 68kinst.o tern.o vos_program_module.o
95 $(CC) -o dis dis.o 68kinst.o 110 $(CC) -o dis dis.o 68kinst.o tern.o vos_program_module.o
96 111
97 zdis : zdis.o z80inst.o 112 zdis : zdis.o z80inst.o
98 $(CC) -o zdis zdis.o z80inst.o 113 $(CC) -o zdis zdis.o z80inst.o
99 114
100 libemu68k.a : $(M68KOBJS) $(TRANSOBJS) 115 libemu68k.a : $(M68KOBJS) $(TRANSOBJS)
115 stateview : stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o 130 stateview : stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o
116 $(CC) -o stateview stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o $(LDFLAGS) 131 $(CC) -o stateview stateview.o vdp.o render_sdl.o $(CONFIGOBJS) gst.o $(LDFLAGS)
117 132
118 vgmplay : vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS) 133 vgmplay : vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS)
119 $(CC) -o vgmplay vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS) $(LDFLAGS) 134 $(CC) -o vgmplay vgmplay.o render_sdl.o $(CONFIGOBJS) $(AUDIOOBJS) $(LDFLAGS)
135
136 test : test.o vdp.o
137 $(CC) -o test test.o vdp.o
120 138
121 testgst : testgst.o gst.o 139 testgst : testgst.o gst.o
122 $(CC) -o testgst testgst.o gst.o 140 $(CC) -o testgst testgst.o gst.o
123 141
124 test_x86 : test_x86.o gen_x86.o gen.o 142 test_x86 : test_x86.o gen_x86.o gen.o
131 $(CC) -o gen_fib gen_fib.o gen_x86.o mem.o 149 $(CC) -o gen_fib gen_fib.o gen_x86.o mem.o
132 150
133 offsets : offsets.c z80_to_x86.h m68k_core.h 151 offsets : offsets.c z80_to_x86.h m68k_core.h
134 $(CC) -o offsets offsets.c 152 $(CC) -o offsets offsets.c
135 153
154 vos_prog_info : vos_prog_info.o vos_program_module.o
155 $(CC) -o vos_prog_info vos_prog_info.o vos_program_module.o
156
136 %.o : %.S 157 %.o : %.S
137 $(CC) -c -o $@ $< 158 $(CC) -c -o $@ $<
138 159
139 %.o : %.c 160 %.o : %.c
140 $(CC) $(CFLAGS) -c -o $@ $< 161 $(CC) $(CFLAGS) -c -o $@ $<
141 162
142 %.bin : %.s68 163 %.bin : %.s68
143 vasmm68k_mot -Fbin -m68000 -no-opt -spaces -o $@ $< 164 vasmm68k_mot -Fbin -m68000 -no-opt -spaces -o $@ -L $@.list $<
144 165
145 %.bin : %.sz8 166 %.bin : %.sz8
146 vasmz80_mot -Fbin -spaces -o $@ $< 167 vasmz80_mot -Fbin -spaces -o $@ $<
147 168
148 clean : 169 clean :