]> granicus.if.org Git - graphviz/commitdiff
put rbtree sources in their own directory, build as a convenience library
authorellson <devnull@localhost>
Sun, 5 Oct 2008 03:22:07 +0000 (03:22 +0000)
committerellson <devnull@localhost>
Sun, 5 Oct 2008 03:22:07 +0000 (03:22 +0000)
lib/rbtree/makefile.txt [new file with mode: 0755]

diff --git a/lib/rbtree/makefile.txt b/lib/rbtree/makefile.txt
new file mode 100755 (executable)
index 0000000..cf77a10
--- /dev/null
@@ -0,0 +1,64 @@
+
+# prompt> make
+# builds everything and links in test program test_rb
+#
+# prompt> make mem_check
+# Rebuilds everything using dmalloc and does memory testing.
+# Only works if you have dmalloc installed (see http://dmalloc.com).
+
+SRCS = test_red_black_tree.c red_black_tree.c stack.c misc.c
+
+HDRS = red_black_tree.h stack.h misc.h
+
+OBJS = red_black_tree.o stack.o test_red_black_tree.o misc.o
+
+CC = gcc
+
+CFLAGS = -g -Wall -pedantic
+
+PROGRAM = test_rb
+
+.PHONY:        mem_check clean
+
+all: $(PROGRAM)
+
+$(PROGRAM):    $(OBJS)
+               $(CC) $(CFLAGS) $(OBJS) -o $(PROGRAM) $(DMALLOC_LIB)
+
+mem_check:     
+               @if [ -e makefile.txt ] ; then \
+                       echo "Using makefile.txt" ; \
+                       $(MAKE) clean -f makefile.txt ; \
+                       $(MAKE) $(PROGRAM) "CFLAGS=$(CFLAGS) -DDMALLOC" "DMALLOC_LIB=-ldmalloc" -f makefile.txt ; \
+               else \
+                       echo "Using default makefile (i.e. no -f flag)." ; \
+                       $(MAKE) clean ; \
+                       $(MAKE) $(PROGRAM) "CFLAGS=$(CFLAGS) -DDMALLOC" "DMALLOC_LIB=-ldmalloc" ; \
+               fi
+               ./simple_test.sh
+               @if [ -s unfreed.txt ] ; then \
+                       echo " " ; \
+                       echo "Leaked some memory.  See logfile for details." ;\
+               else \
+                       echo " " ; \
+                       echo "No memory leaks detected. " ;\
+                       echo " " ; \
+                       echo "Test passed. " ; \
+                       echo " " ; \
+               fi
+
+
+test_red_black_tree.o: test_red_black_tree.c red_black_tree.c stack.c stack.h red_black_tree.h misc.h
+
+red_black_tree.o:      red_black_tree.h stack.h red_black_tree.c stack.c misc.h misc.c
+
+stack.o:               stack.c stack.h misc.h misc.c
+
+clean:                 
+       rm -f *.o *~ $(PROGRAM)
+
+
+
+
+
+