source: buchla-emu/Makefile@ 90d6373

Last change on this file since 90d6373 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
RevLine 
[566ebca]1OS := $(shell uname)
2
[ff8d800]3SDL2 := /opt/sdl2
4SDL2_INC := $(SDL2)/include
5SDL2_LIB := $(SDL2)/lib
6
[566ebca]7FLAGS := -std=c99 -O2 -gdwarf-4
[d54045b]8
[566ebca]9FLAGS_CPU := $(FLAGS) -pthread -I cpu -I build
[d54045b]10
[566ebca]11FLAGS_EMU := $(FLAGS) -pthread \
[d54045b]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 \
[ff8d800]16 -I cpu -I emu -I build -I $(SDL2_INC)
[d54045b]17
[566ebca]18ifeq ($(OS), Linux)
19FLAGS_LNK := $(FLAGS) -pthread -Wall -Wextra
20LIBS := $(SDL2_LIB)/libSDL2.a -ldl -lm
21endif
22
23ifeq ($(OS), Darwin)
[d54045b]24FLAGS_LNK := $(FLAGS) -Wall -Wextra
[566ebca]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
[d54045b]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
[a06aa8b]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
[d54045b]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)
[ff8d800]80 gcc $(FLAGS_LNK) -o buchla \
81 $(CPU_OP) $(GEN_OP) $(EMU_OP) \
[566ebca]82 $(LIBS)
[ff8d800]83
84run: buchla
85 ./buchla
[d54045b]86
[4edbd1c]87val: buchla
88 valgrind --leak-resolution=high --track-fds=yes --leak-check=full \
[9373f5e]89 --show-reachable=yes --suppressions=misc/buchla.supp ./buchla
[4edbd1c]90
[d54045b]91clean:
92 rm -rf build
93 rm -f buchla
Note: See TracBrowser for help on using the repository browser.