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