-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (37 loc) · 968 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
CC=gcc
CFLAGS=-Wall -g
TARGETS=assembler emulator opcode_test chip8_bin
COMPONENTS=util.o opcodes.o decoder.o token.o chip8.o
COMMON=util.o opcodes.o
CHIP8_TEST=\
audio-test.ch8\
button-test.ch8\
test_move_pixel.ch8\
test_move_pixel_2.ch8
# Raylib related
INCLUDE=-I/usr/local/include
LDLIBS=-lraylib -lm
UI= raylib_ui.o
all: $(TARGETS)
emulator: $(COMPONENTS) $(UI) src/main.c
$(CC) -o $@ $^ $(LDLIBS)
assembler: $(COMPONENTS) src/assembler.c
$(CC) -o $@ $^
opcode_test: $(COMPONENTS) src/opcode_test.c
$(CC) -o $@ $^ $(CFLAGS)
./$@
chip8_bin: $(CHIP8_TEST)
diff test_move_pixel.ch8 test_move_pixel_2.ch8
./assembler test_move_pixel.ch8 disasm.tmp1 -d
./assembler test_move_pixel_2.ch8 disasm.tmp2 -d
diff disasm.tmp1 disasm.tmp2
%.ch8: chip8_res/%.asm assembler
./assembler $< $@
%.o: src/%.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCLUDE) $(LDLIBS)
.PHONY: clean
clean:
-rm *.o
-rm $(TARGETS)
-rm *.ch8
-rm disasm.tmp1 disasm.tmp2