-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
43 lines (31 loc) · 860 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
CC=clang
CFLAGS=-O2 -Wall -Werror -I.
OPCODES=$(patsubst %.c,%.o,$(wildcard cpu/*.c))
TESTS=$(patsubst %.c,%.o,$(wildcard tests/*.c))
BINARY=aiv_gb
BINARY_TESTS=run_tests
ifeq ($(OS),Windows_NT)
BINARY:=$(BINARY).exe
BINARY_TESTS:=$(BINARY_TESTS).exe
endif
all: gameboy
cpu/opcodes_%.o: cpu/opcodes_%.c aiv_gb.h
$(CC) -c -o $@ $(CFLAGS) $<
cpu.o: cpu.c aiv_gb.h
$(CC) -c -o $@ $(CFLAGS) $<
memory.o: memory.c aiv_gb.h
$(CC) -c -o $@ $(CFLAGS) $<
utils.o: utils.c aiv_gb.h
$(CC) -c -o $@ $(CFLAGS) $<
ppu.o: ppu.c aiv_gb.h
$(CC) -c -o $@ $(CFLAGS) $<
tests/test_%.o: tests/test_%.c aiv_gb.h aiv_unit_test.h
$(CC) -c -o $@ $(CFLAGS) $<
test: cpu.o memory.o tests.o utils.o ppu.o $(OPCODES) $(TESTS)
$(CC) -o $(BINARY_TESTS) $(LDFLAGS) $^
./run_tests
gameboy: $(OPCODES)
$(CC) -o $(BINARY) $^
clean:
rm *.o cpu/*.o tests/*.o
rm run_tests