source: buchla-emu/Makefile@ 8967dbc

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

Load floppy disk image file.

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