-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (39 loc) · 909 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
45
46
47
48
49
50
51
52
53
SOURCES = chip8.cpp opcodes.cpp
# Target
TARGET = chip8-sfml
CXX = g++
LD = ld
CXXFLAGS = -Wall -Werror -O2
# 8XY shift hack
SHIFT_HACK = true
# FX55/65 I register hack (true = increment I register)
FX55_HACK = false
# Debugging
DEBUG = false
ifeq ($(DEBUG),true)
CXXFLAGS += -g
endif
ifeq ($(SHIFT_HACK),true)
CXXFLAGS += -DSHIFT_HACK
endif
ifeq ($(FX55_HACK),true)
CXXFLAGS += -DFX55_HACK
endif
############# Target specific stuff ##############
ifeq ($(TARGET),chip8-ncurses)
LDFLAGS = -lncursesw
SOURCES += main_ncurses.cpp
endif
ifeq ($(TARGET),chip8-sfml)
LDFLAGS = -lsfml-graphics -lsfml-window -lsfml-system
SOURCES += main_sfml.cpp
endif
#################################################
OBJS = $(SOURCES:.cpp=.o)
$(TARGET) : $(OBJS)
$(CXX) $(OBJS) $(CXXFLAGS) $(LDFLAGS) -o $@.out
%.o : %.cpp
$(CXX) $< -c $(CXXFLAGS) $(LDFLAGS) -o $@
.PHONY: clean
clean :
rm -rf *.o *.out