source: buchla-emu/Makefile@ de65155

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

Added skeleton device files.

  • Property mode set to 100644
File size: 2.1 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 -ldl -lm
21endif
22
23ifeq ($(OS), Darwin)
24FLAGS_LNK := $(FLAGS) -Wall -Wextra
25LIBS := $(SDL2_LIB)/libSDL2.a \
26 -framework AppKit \
27 -framework AudioToolbox \
28 -framework Carbon \
29 -framework CoreAudio \
30 -framework CoreFoundation \
31 -framework CoreGraphics \
32 -framework CoreVideo \
33 -framework ForceFeedback \
34 -framework IOKit \
35 -l iconv
36endif
37
38HEADERS := $(wildcard cpu/*.h) $(wildcard emu/*.h)
39
40all: buchla
41
42build:
43 mkdir build
44
45build/gen: | build
46 gcc $(FLAGS) -o build/gen cpu/m68kmake.c
47
48GEN_C := m68kopac.c m68kopdm.c m68kopnz.c m68kops.c
49GEN_H := m68kops.h
50
51GEN_CP := $(GEN_C:%=build/%)
52GEN_HP := $(GEN_H:%=build/%)
53
54GEN_O := $(GEN_C:.c=.o)
55GEN_OP := $(GEN_O:%=build/%)
56
57$(GEN_CP) $(GEN_HP): \
58 build/gen | build
59 cd cpu; ../build/gen ../build
60
61build/%.o: build/%.c $(HEADERS)
62 gcc $(FLAGS_CPU) -c -o $@ $<
63
64CPU_C := m68kcpu.c m68kdasm.c
65CPU_O := $(CPU_C:.c=.o)
66CPU_OP := $(CPU_O:%=build/%)
67
68build/%.o: cpu/%.c $(HEADERS) $(GEN_HP) | build
69 gcc $(FLAGS_CPU) -c -o $@ $<
70
71EMU_C := main.c cpu.c vid.c fpu.c tim.c lcd.c ser.c mid.c fdd.c snd.c \
72 led.c kbd.c sdl.c
73EMU_O := $(EMU_C:.c=.o)
74EMU_OP := $(EMU_O:%=build/%)
75
76build/%.o: emu/%.c $(HEADERS) | build
77 gcc $(FLAGS_EMU) -c -o $@ $<
78
79buchla: $(CPU_OP) $(GEN_OP) $(EMU_OP)
80 gcc $(FLAGS_LNK) -o buchla \
81 $(CPU_OP) $(GEN_OP) $(EMU_OP) \
82 $(LIBS)
83
84run: buchla
85 ./buchla
86
87val: buchla
88 valgrind --leak-resolution=high --track-fds=yes --leak-check=full \
89 --show-reachable=yes --suppressions=misc/buchla.supp ./buchla
90
91clean:
92 rm -rf build
93 rm -f buchla
Note: See TracBrowser for help on using the repository browser.