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