1#
2# Modification History
3#
4# 2004-January-16    Jason Rohrer
5# Switched to use minorGems platform-independed mutexes.
6#
7
8
9CC = g++
10
11# Source files
12SRC := LeakTracer.cc
13
14ROOT_PATH = ../../../..
15
16# Switch comment to select a platform
17# PLATFORM_MUTEX = $(ROOT_PATH)/minorGems/system/win32/MutexLockWin32.cpp
18PLATFORM_MUTEX = $(ROOT_PATH)/minorGems/system/linux/MutexLockLinux.cpp -pthread
19
20# Comment both of these out to disable thread safetly
21C_THREAD=-DTHREAD_SAVE -D_REENTRANT -D_THREAD_SAFE
22O_THREAD = $(PLATFORM_MUTEX)
23
24
25# Common flags
26C_FLAGS = -g -pipe -Wall -W -I$(ROOT_PATH) $(C_THREAD)
27O_FLAGS = $(C_FLAGS) $(O_THREAD)
28
29# Object files
30OBJ_DIR = .
31OBJ   := $(patsubst %.cc,$(OBJ_DIR)/%.o,$(SRC))
32SHOBJ := $(patsubst %.o,$(OBJ_DIR)/%.so,$(OBJ))
33
34.PHONY: all clean tidy distrib test
35
36all: $(OBJ) $(SHOBJ)
37
38clean:	tidy
39	rm -f $(OBJ) leak.out
40
41tidy:
42	rm -f *~ *orig *bak *rej
43
44tags:	$(SRC) $(INCL)
45	ctags $(SRC) $(INCL)
46
47distrib: clean all README.html
48	(cd .. && tar cvfz  /root/drylock/LeakTracer/LeakTracer.tar.gz --exclude LeakTracer/CVS --exclude LeakTracer/old --exclude LeakTracer/test LeakTracer/)
49
50$(OBJ_DIR)/%.o: %.cc
51	$(CC) -fPIC -c $(C_FLAGS) $< -o $@
52
53$(OBJ_DIR)/%.so : $(OBJ_DIR)/%.o
54	$(CC) $(O_FLAGS) -shared -o $@ $<
55
56README.html: README
57	/root/ed/mcl/util/htmlize.pl README
58
59test:
60	$(CC) $(C_FLAGS) test.cc -o test
61	./test
62	./LeakCheck ./test
63	./leak-analyze ./test
64#	./compare-test test.template test.result
65