source: buchla-emu/Makefile@ 0529a19

Last change on this file since 0529a19 was 0529a19, checked in by Alexander Heinrich <alex.heinrich@…>, 7 years ago

Add basic handling of midi input.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1OS := $(shell uname)
2
3ifndef WIN
4GCC := gcc
5GPP := g++
6SDL2 := /opt/sdl2
7RTMIDI := /opt/rtmidi
8EXT :=
9else
10GCC := x86_64-w64-mingw32-gcc
11SDL2 := /opt/sdl2-win
12EXT := .exe
13endif
14
15SDL2_INC := $(SDL2)/include
16SDL2_LIB := $(SDL2)/lib
17
18RTMIDI_INC := $(RTMIDI)/include
19RTMIDI_LIB := $(RTMIDI)/lib
20
21FLAGS := -std=c99 -O2 -gdwarf-4
22
23FLAGS_CPU := $(FLAGS) -pthread -I cpu -I build
24
25FLAGS_EMU := $(FLAGS) -pthread \
26 -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \
27 -Wall -Wextra \
28 -Wpedantic -Wconversion -Wsign-conversion -Wshadow \
29 -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls \
30 -I cpu -I emu -I build -I $(SDL2_INC) -I $(RTMIDI_INC)
31
32FLAGS_AUX := $(FLAGS) -Wall -Wextra \
33 -Wpedantic -Wconversion -Wsign-conversion -Wshadow \
34 -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls
35
36ifndef WIN
37ifeq ($(OS), Linux)
38FLAGS_EMU += -D EMU_LINUX
39FLAGS_LNK := $(FLAGS) -pthread -Wall -Wextra
40LIBS := $(SDL2_LIB)/libSDL2.a \
41 $(SDL2_LIB)/libSDL2_net.a \
42 $(SDL2_LIB)/libSDL2_ttf.a \
43 $(SDL2_LIB)/libfreetype.a \
44 $(RTMIDI_LIB)/librtmidi.a \
45 -ldl -lm
46endif
47
48ifeq ($(OS), Darwin)
49FLAGS_EMU += -D EMU_OS_X
50FLAGS_LNK := $(FLAGS) -Wall -Wextra
51LIBS := $(SDL2_LIB)/libSDL2.a \
52 $(SDL2_LIB)/libSDL2_net.a \
53 $(SDL2_LIB)/libSDL2_ttf.a \
54 $(SDL2_LIB)/libfreetype.a \
55 $(RTMIDI_LIB)/librtmidi.a \
56 -framework AppKit \
57 -framework AudioToolbox \
58 -framework Carbon \
59 -framework CoreMIDI \
60 -framework CoreAudio \
61 -framework CoreFoundation \
62 -framework CoreGraphics \
63 -framework CoreVideo \
64 -framework ForceFeedback \
65 -framework IOKit \
66 -l iconv
67endif
68else
69FLAGS_EMU += -D EMU_WIN
70FLAGS_LNK := $(FLAGS) -Wall -Wextra
71LIBS := -l mingw32 \
72 $(SDL2_LIB)/libSDL2.a \
73 $(SDL2_LIB)/libSDL2main.a \
74 $(SDL2_LIB)/libSDL2_net.a \
75 $(SDL2_LIB)/libSDL2_ttf.a \
76 $(SDL2_LIB)/libfreetype.a \
77 -l gdi32 \
78 -l imm32 \
79 -l iphlpapi \
80 -l ole32 \
81 -l oleaut32 \
82 -l version \
83 -l winmm \
84 -l ws2_32
85endif
86
87HEADERS := $(wildcard cpu/*.h) $(wildcard emu/*.h)
88
89all: buchla$(EXT) buchla.disk
90
91build/gen:
92 gcc $(FLAGS) -o build/gen cpu/m68kmake.c
93
94GEN_C := m68kopac.c m68kopdm.c m68kopnz.c m68kops.c
95GEN_H := m68kops.h
96
97GEN_CP := $(GEN_C:%=build/%)
98GEN_HP := $(GEN_H:%=build/%)
99
100GEN_O := $(GEN_C:.c=.o)
101GEN_OP := $(GEN_O:%=build/%)
102
103$(GEN_CP) $(GEN_HP): \
104 build/gen
105 cd cpu; ../build/gen ../build
106
107build/%.o: build/%.c $(HEADERS)
108 $(GCC) $(FLAGS_CPU) -c -o $@ $<
109
110CPU_C := m68kcpu.c m68kdasm.c
111CPU_O := $(CPU_C:.c=.o)
112CPU_OP := $(CPU_O:%=build/%)
113
114build/%.o: cpu/%.c $(HEADERS) $(GEN_HP)
115 $(GCC) $(FLAGS_CPU) -c -o $@ $<
116
117EMU_C := main.c cpu.c vid.c fpu.c tim.c lcd.c ser.c mid.c fdd.c snd.c \
118 led.c kbd.c sdl.c gdb.c
119EMU_O := $(EMU_C:.c=.o)
120EMU_OP := $(EMU_O:%=build/%)
121
122build/%.o: emu/%.c $(HEADERS)
123 $(GCC) $(FLAGS_EMU) -c -o $@ $<
124
125buchla$(EXT): $(CPU_OP) $(GEN_OP) $(EMU_OP)
126 $(GPP) $(FLAGS_LNK) -o buchla$(EXT) \
127 $(CPU_OP) $(GEN_OP) $(EMU_OP) \
128 $(LIBS)
129
130mkdisk$(EXT): emu/mkdisk.c
131 $(GCC) $(FLAGS_AUX) -o mkdisk$(EXT) emu/mkdisk.c
132
133buchla.disk: mkdisk$(EXT) midas.abs
134 ./mkdisk$(EXT)
135
136run: buchla$(EXT) buchla.disk
137 ./buchla$(EXT) ${EMU_OPTS}
138
139val: buchla$(EXT) buchla.disk
140 valgrind --leak-resolution=high --track-fds=yes --leak-check=full \
141 --show-reachable=yes --suppressions=misc/buchla.supp \
142 ./buchla$(EXT) ${EMU_OPTS}
143
144clean:
145 rm -f build/gen build/*.c build/*.h build/*.o
146 rm -f buchla$(EXT)
147 rm -f mkdisk$(EXT)
148 rm -f buchla.disk
Note: See TracBrowser for help on using the repository browser.