-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
112 lines (90 loc) · 3.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Platform setup
ifeq ($(shell uname -a),)
LIBS=-lOpenGL32
else ifneq ($(findstring MINGW,$(shell uname -a)),)
LIBS=-lOpenGL32
else ifneq ($(findstring Darwin,$(shell uname -a)),)
LIBS=-framework OpenGL
else
LIBS=-lGL -ldl
endif
# Debug
ifeq ($(DEBUG), 1)
CFLAGS=-O0 -g -DHC_DEBUG_MEMORY_ENABLED=1
else
CFLAGS=-O2 -DNDEBUG
endif
# Toolset setup
CC=gcc
CXX=g++
INCLUDES=\
-Isrc -Isrc/deps/imgui -Isrc/deps/imgui/backends -Isrc/deps/ImGuiAl/term -Isrc/deps/ImGuiAl/fonts \
-Isrc/deps/ImGuiAl/button -Isrc/deps/ImGuiAl/sparkline -Isrc/deps/IconFontCppHeaders \
-Isrc/deps/ImGui-Addons/addons/imguifilesystem -Isrc/dynlib -Iinclude \
-Isrc/fnkdat -Isrc/speex -Isrc/deps/lrcpp/include -Isrc/deps/lua -Isrc/deps/luafilesystem/src \
-Isrc/deps/imgui_club/imgui_memory_editor -Isrc/deps/chips/util
DEFINES=-DIMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS -D"IM_ASSERT(x)=do{(void)(x);}while(0)"
DEFINES+=-DOUTSIDE_SPEEX -DRANDOM_PREFIX=speex -DEXPORT= -D_USE_SSE -D_USE_SSE2 -DFLOATING_POINT
DEFINES+=-DPACKAGE=\"hackable-console\" -DDEBUG_FSM
CFLAGS+=$(INCLUDES) $(DEFINES) `sdl2-config --cflags`
CXXFLAGS=$(CFLAGS) -std=c++11
LDFLAGS=
LIBS+=`sdl2-config --libs`
# hackable-console
HC_OBJS=\
src/main.o src/Application.o src/LifeCycle.o src/Fifo.o src/LuaRepl.o src/LuaUtil.o \
src/Audio.o src/Config.o src/Control.o src/Logger.o src/Memory.o src/Video.o \
src/Led.o src/Input.o src/Perf.o src/Desktop.o src/Timer.o src/Devices.o \
src/dynlib/dynlib.o src/fnkdat/fnkdat.o src/speex/resample.o src/Debugger.o \
src/Cpu.o src/cpus/Z80.o src/cpus/M6502.o \
src/cheats/Set.o src/cheats/Snapshot.o src/cheats/Filter.o src/cheats/Cheats.o
# lrcpp
LRCPP_OBJS=\
src/deps/lrcpp/src/Frontend.o src/deps/lrcpp/src/Core.o src/deps/lrcpp/src/Components.o \
src/deps/lrcpp/src/CoreFsm.o
# imgui
IMGUI_OBJS=\
src/deps/imgui/imgui.o src/deps/imgui/imgui_draw.o \
src/deps/imgui/imgui_tables.o src/deps/imgui/imgui_widgets.o src/deps/imgui/imgui_demo.o \
src/deps/imgui/backends/imgui_impl_sdl.o src/deps/imgui/backends/imgui_impl_opengl2.o
# imgui extras
IMGUIEXTRA_OBJS=\
src/deps/ImGuiAl/term/imguial_term.o \
src/deps/ImGui-Addons/addons/imguifilesystem/imguifilesystem.o
# lua
LUA_OBJS=\
src/deps/lua/lapi.o src/deps/lua/lcode.o src/deps/lua/lctype.o src/deps/lua/ldebug.o \
src/deps/lua/ldo.o src/deps/lua/ldump.o src/deps/lua/lfunc.o src/deps/lua/lgc.o src/deps/lua/llex.o \
src/deps/lua/lmem.o src/deps/lua/lobject.o src/deps/lua/lopcodes.o src/deps/lua/lparser.o \
src/deps/lua/lstate.o src/deps/lua/lstring.o src/deps/lua/ltable.o src/deps/lua/ltm.o \
src/deps/lua/lundump.o src/deps/lua/lvm.o src/deps/lua/lzio.o src/deps/lua/lauxlib.o \
src/deps/lua/lbaselib.o src/deps/lua/lcorolib.o src/deps/lua/ldblib.o \
src/deps/lua/liolib.o src/deps/lua/lmathlib.o src/deps/lua/loslib.o src/deps/lua/lstrlib.o \
src/deps/lua/ltablib.o src/deps/lua/lutf8lib.o src/deps/lua/loadlib.o src/deps/lua/linit.o \
src/deps/luafilesystem/src/lfs.o
# lua headers
LUA_HEADERS=\
src/LuaRepl.lua.h src/cheats/Cheats.lua.h
%.o: %.cpp
$(CXX) $(CXXFLAGS) -Wall -Wpedantic -Werror -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -Wall -Wpedantic -Werror -c $< -o $@
%.lua.h: %.lua
echo "static char const `basename "$<" | sed 's/\./_/'`[] = {\n`cat "$<" | xxd -i`\n};" > "$@"
src/deps/lua/%.o: src/deps/lua/%.c
$(CC) $(CFLAGS) -c $< -o $@
src/deps/ImGui-Addons/addons/imguifilesystem/%.o: src/deps/ImGui-Addons/addons/imguifilesystem/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
all: hackcon
hackcon: $(HC_OBJS) $(LRCPP_OBJS) $(IMGUI_OBJS) $(IMGUIEXTRA_OBJS) $(LUA_OBJS)
$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
src/gamecontrollerdb.h: src/deps/SDL_GameControllerDB/gamecontrollerdb.txt
echo "static char const `basename "$<" | sed 's/\./_/'`[] = {\n`cat "$<" | xxd -i`\n};" > "$@"
src/main.o: src/gamecontrollerdb.h
src/LuaRepl.o: src/LuaRepl.lua.h
src/cheats/Cheats.o: src/cheats/Cheats.lua.h
clean:
rm -f hackcon $(HC_OBJS) $(LUA_HEADERS)
realclean: clean
rm -f $(LRCPP_OBJS) $(IMGUI_OBJS) $(IMGUIEXTRA_OBJS) $(LUA_OBJS) src/gamecontrollerdb.h
.PHONY: clean