This repository has been archived by the owner on Aug 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
63 lines (49 loc) · 2.03 KB
/
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
61
62
63
CC=gcc
CFLAGS=-g -Werror -pedantic
GCOV=-fprofile-arcs -ftest-coverage
OUTDIR=build/
.PHONY: default
default: $(OUTDIR)/fake6502.o $(OUTDIR)/fake2a03.o $(OUTDIR)/fake65c02.o
$(OUTDIR):
mkdir -p $(OUTDIR)
$(OUTDIR)/fake6502.o: $(OUTDIR) fake6502.c
$(CC) -DDECIMALMODE -DNMOS6502 -c $(CFLAGS) fake6502.c -o $@
$(OUTDIR)/fake65c02.o: fake6502.c
$(CC) -DDECIMALMODE -DCMOS6502 -c $(CFLAGS) fake6502.c -o $@
$(OUTDIR)/fake2a03.o: fake6502.c
$(CC) -DNMOS6502 -c $(CFLAGS) fake6502.c -o $@
$(OUTDIR)/tests: fake6502.c tests.c $(OUTDIR)
$(CC) $(GCOV) -DDECIMALMODE -DNMOS6502 -c $(CFLAGS) fake6502.c -o $(OUTDIR)/fake6502_test.o
gcc $(GCOV) $(CFLAGS) tests.c -c -o $(OUTDIR)/tests.o
gcc -lgcov --coverage $(OUTDIR)/tests.o $(OUTDIR)/fake6502_test.o -o $(OUTDIR)/tests
$(OUTDIR)/test6502: fake6502.c tests.c $(OUTDIR)
$(CC) $(GCOV) -DDECIMALMODE -DNMOS6502 -c $(CFLAGS) fake6502.c -o $(OUTDIR)/fake6502_test.o
gcc $(GCOV) $(CFLAGS) tests.c -c -o $(OUTDIR)/tests_6502.o
gcc -lgcov --coverage $(OUTDIR)/tests_6502.o $(OUTDIR)/fake6502_test.o -o $(OUTDIR)/test6502
$(OUTDIR)/test65c02: fake6502.c tests.c $(OUTDIR)
$(CC) $(GCOV) -DDECIMALMODE -DCMOS6502 -c $(CFLAGS) fake6502.c -o $(OUTDIR)/fake65c02_test.o
gcc $(GCOV) $(CFLAGS) tests.c -c -o $(OUTDIR)/tests_65c02.o
gcc -lgcov --coverage $(OUTDIR)/tests_6502.o $(OUTDIR)/fake65c02_test.o -o $(OUTDIR)/test65c02
.PHONY: test
test: $(OUTDIR)/test6502 $(OUTDIR)/test65c02
valgrind -q ./$(OUTDIR)/test6502 nmos
valgrind -q ./$(OUTDIR)/test65c02 cmos
lcov: $(OUTDIR)
lcov --zerocounters -d $(OUTDIR)/
lcov --capture --initial -d $(OUTDIR)/ --output-file $(OUTDIR)/coverage.info
make test
lcov --capture -d $(OUTDIR)/ --output-file $(OUTDIR)/coverage.info
mkdir -p $(OUTDIR)/coverage
cd $(OUTDIR)/coverage && genhtml ../coverage.info
sensible-browser $(OUTDIR)/coverage/fake6502/index.html
cppcheck:
cppcheck --enable=all fake6502.c tests.c
.PHONY: format
format:
clang-format -style="{BasedOnStyle: llvm, IndentWidth: 4}" -i *.c
.PHONY: strip
strip:
strip $(OUTDIR)/*.o
.PHONY: clean
clean:
rm -rf build/