|
|
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: # ! 39: # Before build, install "libmudflap<version>-<gcc-version>-dev" ! 40: # package (libmudflap0-4.3-dev in Debian Lenny). ! 41: # ! 42: # To build, use: ! 43: # make clean; make MUDFLAP=1 ! 44: # ! 45: # To run, use something like (disable sound as it can break things): ! 46: # MUDFLAP_OPTIONS="-viol-gdb" ./hatari --sound off ! 47: # ! 48: # For more info, see (for now, works properly only for x86 gcc): ! 49: # http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging ! 50: # ! 51: # These tests don't thread, so -fmudflap can be used instead of -fmudflapth ! 52: CFLAGS += -fstack-protector-all -fmudflap ! 53: LDFLAGS = -fmudflap -lmudflap ! 54: endif ! 55: ! 56: ! 57: # Valgrind options ! 58: VALGRIND_OPTS = --leak-check=full --leak-resolution=high \ ! 59: --free-fill=0 --error-exitcode=1 ! 60: ! 61: ! 62: TESTS = test-symbols test-evaluate test-breakcond ! 63: ! 64: all: $(TESTS) ! 65: ! 66: ! 67: # To do mudflap checks, use: ! 68: # make clean; make MUDFLAP=1 mudflap ! 69: # ! 70: # "-check-initialization" can be used here because these tests don't ! 71: # handle data initialized in external libraries (like Hatari uses ! 72: # SDL surface structs initialized by SDL). ! 73: # ! 74: # "-print-leaks" can be used because these tests don't utilize external ! 75: # libraries which leave their resources behind on exit (like SDL audio ! 76: # and X locale stuff). ! 77: mudflap: $(TESTS) ! 78: export MUDFLAP_OPTIONS="-viol-gdb -collect-stats -internal-checking -print-leaks -backtrace=8 -check-initialization -wipe-stack -wipe-heap"; \ ! 79: for test in $^; do ./$$test; echo "Press <Enter>"; read proceed; done ! 80: ! 81: # Valgrind tests run faster if you compile without Mudflap ! 82: valgrind: $(TESTS) ! 83: for test in $^; do \ ! 84: valgrind $(VALGRIND_OPTS) ./$$test; \ ! 85: echo "Press <Enter>"; read proceed; \ ! 86: done ! 87: ! 88: # just run the tests ! 89: test: $(TESTS) ! 90: for test in $^; do ./$$test; echo "Press <Enter>"; read proceed; done ! 91: ! 92: # all the real & dummy deps ! 93: SOURCEDEPS = test-dummies.c ../../src/debug/breakcond.c \ ! 94: ../../src/debug/debugcpu.c ../../src/falcon/dsp.c \ ! 95: ../../src/debug/evaluate.c ../../src/debug/profile.c \ ! 96: ../../src/debug/symbols.c ../../src/str.c ! 97: ! 98: test-symbols: test-symbols.c $(SOURCEDEPS) ! 99: $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) ! 100: ! 101: test-evaluate: test-evaluate.c $(SOURCEDEPS) ! 102: $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) ! 103: ! 104: test-breakcond: test-breakcond.c $(SOURCEDEPS) ! 105: $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) ! 106: ! 107: ! 108: clean: ! 109: $(RM) *.o $(TESTS) ! 110: ! 111: distclean: clean ! 112: $(RM) *~ *.bak *.orig
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.