-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile-aodsf
57 lines (43 loc) · 1.72 KB
/
Makefile-aodsf
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
# build architecture inspired by this page:
# http://make.mad-scientist.net/papers/multi-architecture-builds/
ifeq ($(notdir $(CURDIR)), cirrusretro-players)
include target-aodsf.mk
else
TARGET:=cr-aosdk-dsf.js
CC:=ccache emcc
LD:=emcc
OPT_LEVEL:=-Os
AOSDK_SRCDIR=$(SRCDIR)/aosdk
DSF_SRCDIR=$(SRCDIR)/aosdk/eng_dsf
XZ_EMBEDDED_SRCDIR=$(SRCDIR)/xz-embedded
VPATH=$(SRCDIR):$(AOSDK_SRCDIR):$(DSF_SRCDIR):$(XZ_EMBEDDED_SRCDIR)
FINALDIR=$(SRCDIR)/final
EXPORT_LIST="['_crPlayerContextSize', '_crPlayerInitialize', '_crPlayerLoadFile', '_crPlayerSetTrack', '_crPlayerGenerateStereoFrames', '_crPlayerVoicesCanBeToggled', '_crPlayerGetVoiceCount', '_crPlayerGetVoiceName', '_crPlayerSetVoiceState', '_crPlayerCleanup']"
# AODSF source files, plus the Cirrus Retro glue file
AODSF_C_SOURCES:= \
aosdk_interface.c \
corlett.c \
aica.c \
aicadsp.c \
arm7.c \
arm7i.c \
dc_hw.c \
eng_dsf.c
# XZ-embedded sources
XZ_EMBEDDED_C_SOURCES:=xzdec.c \
xz_crc32.c \
xz_dec_lzma2.c \
xz_dec_stream.c
# Emscripten gets nervous when C/C++ compile flags reference absolute paths;
# '-Wno-warn-absolute-paths' tells the compiler not to worry
CFLAGS:= -Wall -Wno-warn-absolute-paths $(OPT_LEVEL) -I$(SRCDIR) -I$(AOSDK_SRCDIR) -I$(DSF_SRCDIR) -I$(XZ_EMBEDDED_SRCDIR) -s ASSERTIONS=2 -DAOSDK_DSF
AODSF_C_OBJECTS:=$(patsubst %.c,%.o,$(AODSF_C_SOURCES))
XZ_EMBEDDED_C_OBJECTS:=$(patsubst %.c,%.o,$(XZ_EMBEDDED_C_SOURCES))
# build rule for all C files
%.o : %.c
$(CC) -o $@ -c $< $(CFLAGS)
$(TARGET): $(AODSF_CXX_OBJECTS) $(AODSF_C_OBJECTS) $(XZ_EMBEDDED_C_OBJECTS)
$(LD) -o $(TARGET) $^ --memory-init-file 0 -Wall $(OPT_LEVEL) -s EXPORTED_FUNCTIONS=$(EXPORT_LIST) -s TOTAL_MEMORY=134217728 -s ASSERTIONS=2
mkdir -p $(FINALDIR)
cp $(TARGET)* $(FINALDIR)
endif