-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.retroreversing
102 lines (89 loc) · 3.46 KB
/
Makefile.retroreversing
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
ifeq ($(OS),Windows_NT)
CCFLAGS += -D WIN32 -D _WIN32 -w
# TODO: figure out why -fsanitize=address doesn't work on window (https://stackoverflow.com/questions/55018627/cannot-find-lasan-using-address-sanitizer-in-qt-creator-in-windows-mingw)
CXXFLAGS += -D WIN32 -D _WIN32 -std=c++11 -lstdc++fs -w -lstdc++
LDFLAGS += -std=c++11 -lstdc++fs -lstdc++ -pthread -lws2_32
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
CCFLAGS += -D AMD64
CFLAGS += -D AMD64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CCFLAGS += -D AMD64
CFLAGS += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CCFLAGS += -D IA32
CFLAGS += -D IA32
endif
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CCFLAGS += -D LINUX -w
CFLAGS += -D LINUX -w -lstdc++
CXXFLAGS += -std=c++11 -lstdc++fs -w
LDFLAGS += -lc++ -std=c++11 -lstdc++fs -lstdc++ -pthread -ldl
endif
ifeq ($(UNAME_S),Darwin)
CCFLAGS += -D OSX -w -MMD
CFLAGS += -D OSX -w -MMD
CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=13.0 -w -MMD
LDFLAGS += -lc++ -mmacosx-version-min=13.0
# LDFLAGS += -lbfd -L/usr/local/opt/binutils/lib -liberty -lintl -liconv -mmacosx-version-min=10.9 -lc++
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CCFLAGS += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CCFLAGS += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CCFLAGS += -D ARM
endif
endif
SOURCES_C_RR += \
./libRetroReversing/cdl/jarowinkler.c \
SOURCES_CXX_RR += \
libRetroReversing/cdl/CDL_interface.cpp \
libRetroReversing/cdl/CDL_JSON.cpp \
libRetroReversing/cdl/CDL_Util.cpp \
libRetroReversing/cdl/CDL_FileWriting.cpp \
libRetroReversing/cdl/InputLogger.cpp \
libRetroReversing/cdl/Setup.cpp \
libRetroReversing/cdl/Interpreter.cpp \
libRetroReversing/cdl/Main.cpp \
libRetroReversing/cdl/Image.cpp \
libRetroReversing/cdl/CD.cpp \
libRetroReversing/png/lodepng.cpp \
libRetroReversing/source_exporter/CommonSourceExport.cpp \
libRetroReversing/consoles/${libRetroReversingConsole}.cpp \
# Only include civet web if not using emscripten for web
ifeq ($(platform),emscripten)
SOURCES_CXX_RR += \
./libRetroReversing/civetweb/src/libRREmscriptenInterface.cpp
else
SOURCES_C_RR += \
./libRetroReversing/civetweb/src/civetweb.c \
./libRetroReversing/interpreter/duktape/duktape.c \
./libRetroReversing/interpreter/mjs/mjs.c
SOURCES_CXX_RR += \
libRetroReversing/civetweb/src/libRRWebInterface.cpp
endif
# TODO: use a local path instead of /usr/local/opt/nlohmann_json/include
# CFLAGS += -I/usr/local/opt/nlohmann_json/include
# CXXFLAGS += -I/usr/local/opt/nlohmann_json/include -std=c++11
ifeq ($(libRetroReversingMakeType),OBJECTS)
OBJECTS += $(patsubst %.c,$(CORE_DIR)/build/obj/%_libretro.c.o,$(SOURCES_C_RR))
OBJECTS += $(patsubst %.cpp,$(CORE_DIR)/build/obj/%.cpp.o,$(SOURCES_CXX_RR))
else
SOURCES_CXX += $(SOURCES_CXX_RR)
SOURCES_C += $(SOURCES_C_RR)
endif
# TODO: Might need to set CORE_DIR
$(CORE_DIR)/build/obj/libRetroReversing/%.cpp.o: ../libRetroReversing/%.cpp
-@$(MKDIR) -p $(dir $@)
$(CXX) $(CXXFLAGS) $(fpic) -DGB_INTERNAL -c $(OBJOUT)$@ $<
$(CORE_DIR)/build/obj/libRetroReversing/%.o: ../libRetroReversing/%.c
-@$(MKDIR) -p $(dir $@)
$(CC) $(CFLAGS) $(fpic) -DGB_INTERNAL -c $(OBJOUT)$@ $<