|
|
1.1 root 1: # Makefile for testing Hatari (debugger) features
2: #
3: # "make":
4: # - compile tests
5: #
6: # "make test":
7: # - run tests
8: #
9: # "make valgrind":
10: # - run tests under valgrind
11: #
1.1.1.4 ! root 12: # "make clean; make CC=gcc-<version> MUDFLAP=1 mudflap":
! 13: # - run tests with older GCC version mudflap checks
! 14: # (MudFlap was removed/replaced in GCC 4.9 with AddressSanitizer)
! 15: #
! 16: # TODO: support AddressSanitizer
1.1 root 17:
18: # Set the C compiler (e.g. gcc)
1.1.1.4 ! root 19: CC ?= gcc
1.1 root 20:
1.1.1.3 root 21: # Directory given for 'cmake' i.e. where CMake created the config.h.
22: # Could also be simply "../.." or "../../build".
23: CONFIGDIR := $(shell find ../.. -name config.h | head -1 | sed 's%/[^/]*$$%%')
24:
1.1 root 25: # SDL-Library configuration (compiler flags and linker options) - you normally
26: # don't have to change this if you have correctly installed the SDL library!
27: SDL_CFLAGS := $(shell sdl-config --cflags)
28:
29: # What warnings to use
30: WARNFLAGS = -Wmissing-prototypes -Wstrict-prototypes -Wsign-compare \
31: -Wbad-function-cast -Wcast-qual -Wpointer-arith -Wwrite-strings -Wall
32:
1.1.1.3 root 33: # Hatari source include directories:
34: INCFLAGS = -I$(CONFIGDIR) -I../../src/includes -I../../src/uae-cpu \
1.1 root 35: -I../../src/debug -I../../src/falcon
36:
37: # Set extra flags passed to the compiler
38: CFLAGS := -g -O $(INCFLAGS) $(WARNFLAGS) $(SDL_CFLAGS)
39:
40:
41: ifneq ($(MUDFLAP),)
42: # Run-time checks with GCC "mudflap" etc:
43: # - stack protection
44: # - checking of pointer accesses (AFAIK works only on x86)
45: #
1.1.1.2 root 46: # Before build, install mudflap library development package,
47: # typically it's named either "libmudflap<version>-<gcc-version>-dev"
48: # (e.g. libmudflap0-4.4-dev in Debian Squeeze) or "libmudflap-devel"
49: # (e.g. in Fedora).
1.1 root 50: #
51: # To build, use:
52: # make clean; make MUDFLAP=1
53: #
54: # To run, use something like (disable sound as it can break things):
55: # MUDFLAP_OPTIONS="-viol-gdb" ./hatari --sound off
56: #
57: # For more info, see (for now, works properly only for x86 gcc):
58: # http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging
59: #
60: # These tests don't thread, so -fmudflap can be used instead of -fmudflapth
61: CFLAGS += -fstack-protector-all -fmudflap
62: LDFLAGS = -fmudflap -lmudflap
63: endif
64:
65:
66: # Valgrind options
67: VALGRIND_OPTS = --leak-check=full --leak-resolution=high \
68: --free-fill=0 --error-exitcode=1
69:
70:
71: TESTS = test-symbols test-evaluate test-breakcond
72:
73: all: $(TESTS)
74:
75:
76: # To do mudflap checks, use:
77: # make clean; make MUDFLAP=1 mudflap
78: #
79: # "-check-initialization" can be used here because these tests don't
80: # handle data initialized in external libraries (like Hatari uses
81: # SDL surface structs initialized by SDL).
82: #
83: # "-print-leaks" can be used because these tests don't utilize external
84: # libraries which leave their resources behind on exit (like SDL audio
85: # and X locale stuff).
86: mudflap: $(TESTS)
87: export MUDFLAP_OPTIONS="-viol-gdb -collect-stats -internal-checking -print-leaks -backtrace=8 -check-initialization -wipe-stack -wipe-heap"; \
88: for test in $^; do ./$$test; echo "Press <Enter>"; read proceed; done
89:
90: # Valgrind tests run faster if you compile without Mudflap
91: valgrind: $(TESTS)
92: for test in $^; do \
93: valgrind $(VALGRIND_OPTS) ./$$test; \
94: echo "Press <Enter>"; read proceed; \
95: done
96:
97: # just run the tests
98: test: $(TESTS)
99: for test in $^; do ./$$test; echo "Press <Enter>"; read proceed; done
100:
101: # all the real & dummy deps
1.1.1.4 ! root 102: SOURCEDEPS = ../../src/debug/breakcond.c \
1.1.1.3 root 103: ../../src/debug/debugcpu.c ../../src/debug/history.c \
104: ../../src/debug/evaluate.c ../../src/debug/symbols.c \
1.1.1.4 ! root 105: ../../src/str.c test-dummies.c
1.1 root 106:
107: test-symbols: test-symbols.c $(SOURCEDEPS)
108: $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
109:
110: test-evaluate: test-evaluate.c $(SOURCEDEPS)
111: $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
112:
113: test-breakcond: test-breakcond.c $(SOURCEDEPS)
114: $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
115:
116:
117: clean:
118: $(RM) *.o $(TESTS)
119:
120: distclean: clean
121: $(RM) *~ *.bak *.orig
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.