-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (48 loc) · 2.26 KB
/
Makefile
File metadata and controls
61 lines (48 loc) · 2.26 KB
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
# force rebuild, while deps isn't working
.PHONY: default libpce.so clean run runc all ci deps deps-main wrepl
default: libpce.so
all: libpce.so main
deps:
apt install -y g++
debs-main: deps
apt install -y libsdl2-dev
ci: deps libpce.so
EMBEDFLAGS=-O3 -fvisibility=hidden -static-libstdc++ -fPIC
EMBEDFLAGS=-O3 -fvisibility=hidden -fPIC
SRCS := $(wildcard Geargrafx/src/*.cpp Geargrafx/platforms/libretro/*.cpp) *.o
# some deps are easier to build in c mode, so we'll build a separate obj file in c mode.
CSRCS := -DZ7_ST -c Geargrafx/platforms/shared/dependencies/libchdr/src/*.c Geargrafx/platforms/shared/dependencies/miniz/*.c Geargrafx/platforms/shared/dependencies/lzma/src/*.c
PCEFLAGS=-Wfatal-errors -Werror -Wno-narrowing -D__LIBRETRO__ -I Geargrafx/src -I Geargrafx/platforms/libretro -I Geargrafx/platforms/shared/dependencies/miniz/ -I Geargrafx/platforms/shared/dependencies/libchdr/include/ -I Geargrafx/platforms/shared/dependencies/zstd/ -I Geargrafx/platforms/shared/dependencies/lzma/include -Wno-div-by-zero
libpce.so: libpce.cpp corelib.h
$(CC) $(CFLAGS) $(EMBEDFLAGS) $(PCEFLAGS) $(CSRCS)
$(CXX) $(CFLAGS) $(LDFLAGS) $(EMBEDFLAGS) $(PCEFLAGS) -shared -o libpce.so libpce.cpp $(SRCS)
cp libpce.so libapu.so
echo "libpce done"
fast.o: libpce.cpp
$(CXX) $(CFLAGS) $(PCEFLAGS) -O2 -o fast.o libpce.cpp
main: main.c corelib.h
$(CXX) -O3 -o main main.c -L. -l:libpce.so -lSDL2 -lc -lm ${WARN}
echo "main done"
clean:
rm -f libpce.so *.o
gdb:
LD_LIBRARY_PATH=$(shell pwd) gdb --args ./main "$(ROM)"
run:
LD_LIBRARY_PATH=$(shell pwd) ./main "$(ROM)"
runc:
LD_LIBRARY_PATH=$(shell pwd) ./main "$(ROM)" c
frepl: # fast
ls libpce.cpp Makefile | entr -c make fast.o
repl:
ls libpce.cpp Makefile | entr -c make all
wrepl:
ls libpce.cpp Makefile | entr -c make libpce.js
# EMCC=~/external/emsdk/upstream/bin/wasm32-clang++
EMCXX=~/external/emscripten/em++
EMCC=~/external/emscripten/emcc
EXPORTS="['_framebuffer_bytes', '_frame', '_init', '_alloc_rom']"
WASMFLAGS=-Wl,--no-entry -Wl,--export-all -s EXPORTED_FUNCTIONS=$(EXPORTS) -s EXPORTED_RUNTIME_METHODS=['HEAPU8'] -DISWASM -sALLOW_MEMORY_GROWTH
.PHONY: libpce.js
libpce.js:
$(EMCC) -D__OPTIMIZE__ $(CFLAGS) $(PCEFLAGS) $(CSRCS)
$(EMCXX) -D__OPTIMIZE__ $(CFLAGS) $(PCEFLAGS) $(WASMFLAGS) -o libpce.js libpce.cpp $(SRCS)