-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
156 lines (127 loc) · 3.55 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# supported parameters
# ARCH architecture - "x86" or "x64" [detected if not set]
# DEBUG if set to anything, builds with DEBUG symbols
include Makefile.common
ifeq ($(ARCH), arm64)
$(error Cannot build for arm64)
endif
# Toolset setup
ifeq ($(OS),Windows_NT)
CC=gcc
CXX=g++
RC=windres
ifeq ($(ARCH), x86)
MINGWLIBDIR=/mingw32/bin
else
MINGWLIBDIR=/mingw64/bin
endif
else ifeq ($(shell uname -s),Linux)
MINGW=x86_64-w64-mingw32
ifeq ($(ARCH), x86)
MINGW=i686-w64-mingw32
endif
CC=$(MINGW)-gcc
CXX=$(MINGW)-g++
RC=$(MINGW)-windres
MINGWLIBDIR=/usr/$(MINGW)/lib
endif
# compile flags
INCLUDES += -I./src/RAInterface -I./src/SDL2/include
DEFINES=-DOUTSIDE_SPEEX -DRANDOM_PREFIX=speex -DEXPORT= -D_USE_SSE2 -DFIXED_POINT -D_WINDOWS
CFLAGS += $(DEFINES)
CXXFLAGS += $(DEFINES)
ifeq ($(ARCH), x86)
SDLLIBDIR=src/SDL2/lib/x86
else
SDLLIBDIR=src/SDL2/lib/x64
endif
ifneq ($(DEBUG),)
CFLAGS += -DDEBUG_FSM -DLOG_TO_FILE
CXXFLAGS += -DDEBUG_FSM -DLOG_TO_FILE
else
CFLAGS += -DLOG_TO_FILE
CXXFLAGS += -DLOG_TO_FILE
endif
LDFLAGS += -mwindows -lmingw32 -lopengl32 -lwinhttp -lgdi32 -limm32 -lcomdlg32
LDFLAGS += -L${SDLLIBDIR} -lSDL2main -lSDL2
# main
OBJS=\
src/dynlib/dynlib.o \
src/jsonsax/jsonsax.o \
src/libretro/BareCore.o \
src/libretro/Core.o \
src/RA_Implementation.o \
src/RAInterface/RA_Interface.o \
src/components/Audio.o \
src/components/Config.o \
src/components/Dialog.o \
src/components/Input.o \
src/components/Logger.o \
src/components/Microphone.o \
src/components/Video.o \
src/components/VideoContext.o \
src/libmincrypt/sha256.o \
src/miniz/miniz.o \
src/miniz/miniz_tdef.o \
src/miniz/miniz_tinfl.o \
src/miniz/miniz_zip.o \
src/rcheevos/src/rcheevos/consoleinfo.o \
src/rcheevos/src/rc_libretro.o \
src/rcheevos/src/rhash/aes.o \
src/rcheevos/src/rhash/cdreader.o \
src/rcheevos/src/rhash/md5.o \
src/rcheevos/src/rhash/hash.o \
src/speex/resample.o \
src/About.o \
src/Application.o \
src/CdRom.o \
src/Emulator.o \
src/Fsm.o \
src/Git.o \
src/Gl.o \
src/GlUtil.o \
src/Hash.o \
src/Hash3DS.o \
src/KeyBinds.o \
src/main.o \
src/Memory.o \
src/menu.res \
src/States.o \
src/Util.o
ifdef HAVE_CHD
OBJS += $(CHD_OBJS) \
src/HashCHD.o
endif
src/rcheevos/src/rc_libretro.o: CFLAGS += -I./src/libretro
src/components/Config.o: CFLAGS += -I./src/libretro
src/Memory.o: CFLAGS += -I./src/libretro
src/Hash.o: CFLAGS += -I./src/libretro
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.res: %.rc
$(RC) $< -O coff -o $@
all: $(OUTDIR)/RALibretro.exe $(OUTDIR)/SDL2.dll $(OUTDIR)/libwinpthread-1.dll
$(OUTDIR)/SDL2.dll: $(SDLLIBDIR)/SDL2.dll
cp -f $< $@
$(OUTDIR)/libwinpthread-1.dll: $(MINGWLIBDIR)/libwinpthread-1.dll
cp -f $< $@
$(OUTDIR)/RALibretro.exe: $(OBJS)
mkdir -p $(OUTDIR)
$(CXX) -o $@ $+ $(LDFLAGS)
src/Git.cpp: etc/Git.cpp.template FORCE
cat $< | sed s/GITFULLHASH/`git rev-parse HEAD | tr -d "\n"`/g | sed s/GITMINIHASH/`git rev-parse HEAD | tr -d "\n" | cut -c 1-7`/g | sed s/GITRELEASE/`git describe --tags | sed s/\-.*//g | tr -d "\n"`/g > $@
zip:
rm -f $(OUTDIR)/RALibretro-*.zip RALibretro-*.zip
zip -9 RALibretro-`git describe | tr -d "\n"`.zip $(OUTDIR)/RALibretro.exe
clean:
rm -f $(OUTDIR)/RALibretro.exe $(OBJS) $(OUTDIR)/RALibretro-*.zip RALibretro-*.zip
pack:
ifeq ("", "$(wildcard $(OUTDIR)/RALibretro.exe)")
echo '"$(OUTDIR)/RALibretro.exe" not found!'
else
rm -f $(OUTDIR)/RALibretro-*.zip RALibretro-*.zip
zip -9r RALibretro-pack-`git describe | tr -d "\n"`.zip bin
endif
.PHONY: clean FORCE