-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
44 lines (35 loc) · 843 Bytes
/
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
# defining compiler and the flags to be used
CXX := g++
CXXFLAGS := -g -Wall -pedantic -std=c++20 \
# -DDEBUG # uncomment this if you want to debug!!!
# -fsanitize=shift -fsanitize=undefined -fsanitize=address
# emulator source files
EMU_SRCS := cpu.cpp \
ppu.cpp \
nes_screen.cpp \
instructions.cpp \
controller.cpp \
main.cpp \
bus.cpp \
apu.cpp \
utils.cpp \
mapper_n_cart.cpp \
mappers/nrom_0.cpp \
mappers/cnrom_3.cpp \
mappers/unrom_2.cpp \
mappers/mmc1_1.cpp \
mappers/mmc3_4.cpp \
EMU_OBJS := $(patsubst %.cpp,bin/%.o,$(EMU_SRCS))
# libraries
EMU_LIBS := -lSDL2
.PHONY: clean
# ... emulator building ...
emulator: setup $(EMU_OBJS)
$(CXX) $(CXXFLAGS) $(EMU_OBJS) -o emulator $(EMU_LIBS)
bin/%.o: src/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
setup:
mkdir -p bin
mkdir -p bin/mappers
clean:
rm -rf bin emulator