-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (46 loc) · 980 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
54
55
56
57
58
59
60
CC = cc
CFLAGS += -Wall
LDFLAGS += -L./lib -lgb -lSDL2
INCLUDES = -I./include
SRC=gb.c cartridge.c cpu.c ppu.c io.c apu.c mbc1.c mbc3.c mbc5.c mbc0.c mbc2.c
OBJ=$(addprefix build/, $(SRC:.c=.o))
LIB=lib/libgb.a
ARCMD = rcs
BIN=bin/gb
ifdef DEBUG
CFLAGS += -g3 -DDEBUG_CPU -DDEBUG_PPU
endif
ifdef PROFILE
CFLAGS += -pg -g
LDFLAGS += -pg
else
CFLAGS += -O3 -g3
endif
ifdef GLES
LDFLAGS += -lGLESv2
CFLAGS += -DGLES
else
LDFLAGS += -lGL
CFLAGS += -DGL_GLEXT_PROTOTYPES
endif
ifdef AUDIO_PA # pulse audio instead of SDL
LDFLAGS += -lpulse -lpulse-simple
else
CFLAGS += -DAUDIO_SDL
endif
all: bin
bin: $(BIN)
lib: $(LIB)
$(BIN): $(LIB)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ examples/app/main.c $(LDFLAGS)
$(LIB): operations.h $(OBJ)
@mkdir -p $(@D)
$(AR) $(ARCMD) $@ $(OBJ)
operations.h: src/instructions.lua
lua $^
build/%.o: src/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
clean:
rm -rf $(OBJ) $(BIN) $(LIB) include/gb/operations.h