source: buchla-emu/Makefile@ ff8d800

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

Added SDL2 support.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1SDL2 := /opt/sdl2
2SDL2_INC := $(SDL2)/include
3SDL2_LIB := $(SDL2)/lib
4
5FLAGS := -std=c99 -pthread -O2 -gdwarf-4
6
7FLAGS_CPU := $(FLAGS) -I cpu -I build
8
9FLAGS_EMU := $(FLAGS) \
10 -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \
11 -Wall -Wextra \
12 -Wpedantic -Wconversion -Wsign-conversion -Wshadow \
13 -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls \
14 -I cpu -I emu -I build -I $(SDL2_INC)
15
16FLAGS_LNK := $(FLAGS) -Wall -Wextra
17
18HEADERS := $(wildcard cpu/*.h) $(wildcard emu/*.h)
19
20all: buchla
21
22build:
23 mkdir build
24
25build/gen: | build
26 gcc $(FLAGS) -o build/gen cpu/m68kmake.c
27
28GEN_C := m68kopac.c m68kopdm.c m68kopnz.c m68kops.c
29GEN_H := m68kops.h
30
31GEN_CP := $(GEN_C:%=build/%)
32GEN_HP := $(GEN_H:%=build/%)
33
34GEN_O := $(GEN_C:.c=.o)
35GEN_OP := $(GEN_O:%=build/%)
36
37$(GEN_CP) $(GEN_HP): \
38 build/gen | build
39 cd cpu; ../build/gen ../build
40
41build/%.o: build/%.c $(HEADERS)
42 gcc $(FLAGS_CPU) -c -o $@ $<
43
44CPU_C := m68kcpu.c m68kdasm.c
45CPU_O := $(CPU_C:.c=.o)
46CPU_OP := $(CPU_O:%=build/%)
47
48build/%.o: cpu/%.c $(HEADERS) $(GEN_HP) | build
49 gcc $(FLAGS_CPU) -c -o $@ $<
50
51EMU_C := main.c cpu.c sdl.c
52EMU_O := $(EMU_C:.c=.o)
53EMU_OP := $(EMU_O:%=build/%)
54
55build/%.o: emu/%.c $(HEADERS) | build
56 gcc $(FLAGS_EMU) -c -o $@ $<
57
58buchla: $(CPU_OP) $(GEN_OP) $(EMU_OP)
59 gcc $(FLAGS_LNK) -o buchla \
60 $(CPU_OP) $(GEN_OP) $(EMU_OP) \
61 $(SDL2_LIB)/libSDL2.a -ldl -lm
62
63run: buchla
64 ./buchla
65
66val: buchla
67 valgrind --leak-resolution=high --track-fds=yes --leak-check=full \
68 --show-reachable=yes --suppressions=buchla.supp ./buchla
69
70clean:
71 rm -rf build
72 rm -f buchla
Note: See TracBrowser for help on using the repository browser.