source: buchla-emu/Makefile@ 2f9f352

Last change on this file since 2f9f352 was 2f9f352, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added SDL2_ttf.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1OS := $(shell uname)
2
3SDL2 := /opt/sdl2
4SDL2_INC := $(SDL2)/include
5SDL2_LIB := $(SDL2)/lib
6
7FLAGS := -std=c99 -O2 -gdwarf-4
8
9FLAGS_CPU := $(FLAGS) -pthread -I cpu -I build
10
11FLAGS_EMU := $(FLAGS) -pthread \
12 -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \
13 -Wall -Wextra \
14 -Wpedantic -Wconversion -Wsign-conversion -Wshadow \
15 -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls \
16 -I cpu -I emu -I build -I $(SDL2_INC)
17
18ifeq ($(OS), Linux)
19FLAGS_LNK := $(FLAGS) -pthread -Wall -Wextra
20LIBS := $(SDL2_LIB)/libSDL2.a \
21 $(SDL2_LIB)/libSDL2_ttf.a \
22 $(SDL2_LIB)/libfreetype.a \
23 -ldl -lm
24endif
25
26ifeq ($(OS), Darwin)
27FLAGS_LNK := $(FLAGS) -Wall -Wextra
28LIBS := $(SDL2_LIB)/libSDL2.a \
29 $(SDL2_LIB)/libSDL2_ttf.a \
30 $(SDL2_LIB)/libfreetype.a \
31 -framework AppKit \
32 -framework AudioToolbox \
33 -framework Carbon \
34 -framework CoreAudio \
35 -framework CoreFoundation \
36 -framework CoreGraphics \
37 -framework CoreVideo \
38 -framework ForceFeedback \
39 -framework IOKit \
40 -l iconv
41endif
42
43HEADERS := $(wildcard cpu/*.h) $(wildcard emu/*.h)
44
45all: buchla
46
47build:
48 mkdir build
49
50build/gen: | build
51 gcc $(FLAGS) -o build/gen cpu/m68kmake.c
52
53GEN_C := m68kopac.c m68kopdm.c m68kopnz.c m68kops.c
54GEN_H := m68kops.h
55
56GEN_CP := $(GEN_C:%=build/%)
57GEN_HP := $(GEN_H:%=build/%)
58
59GEN_O := $(GEN_C:.c=.o)
60GEN_OP := $(GEN_O:%=build/%)
61
62$(GEN_CP) $(GEN_HP): \
63 build/gen | build
64 cd cpu; ../build/gen ../build
65
66build/%.o: build/%.c $(HEADERS)
67 gcc $(FLAGS_CPU) -c -o $@ $<
68
69CPU_C := m68kcpu.c m68kdasm.c
70CPU_O := $(CPU_C:.c=.o)
71CPU_OP := $(CPU_O:%=build/%)
72
73build/%.o: cpu/%.c $(HEADERS) $(GEN_HP) | build
74 gcc $(FLAGS_CPU) -c -o $@ $<
75
76EMU_C := main.c cpu.c vid.c fpu.c tim.c lcd.c ser.c mid.c fdd.c snd.c \
77 led.c kbd.c sdl.c
78EMU_O := $(EMU_C:.c=.o)
79EMU_OP := $(EMU_O:%=build/%)
80
81build/%.o: emu/%.c $(HEADERS) | build
82 gcc $(FLAGS_EMU) -c -o $@ $<
83
84buchla: $(CPU_OP) $(GEN_OP) $(EMU_OP)
85 gcc $(FLAGS_LNK) -o buchla \
86 $(CPU_OP) $(GEN_OP) $(EMU_OP) \
87 $(LIBS)
88
89run: buchla
90 ./buchla
91
92val: buchla
93 valgrind --leak-resolution=high --track-fds=yes --leak-check=full \
94 --show-reachable=yes --suppressions=misc/buchla.supp ./buchla
95
96clean:
97 rm -rf build
98 rm -f buchla
Note: See TracBrowser for help on using the repository browser.