1CXXFLAGS=-g -Wall -I /usr/local/include
2CXXFLAGS+=-O2
3
4HEADERS=$(wildcard *.h)
5TESTS= atomic_unittest \
6       blockingqueue_test \
7       boundedblockingqueue_test \
8       copyonwrite_test \
9       exception_test \
10       fork_test \
11       singleton_test \
12       singleton_threadlocal_test \
13       threadlocal_test \
14       threadlocalsingleton_test \
15       thread_bench \
16       thread_test \
17       threadpool_test \
18       exit_deadlock \
19       mutual_deadlock \
20       nonrecursivemutex_test \
21       requestinventory_test \
22       requestinventory_test2 \
23       self_deadlock \
24       weakcallback_test \
25       signalslot_test \
26       waiter_test
27
28all: $(TESTS)
29
30$(TESTS): $(HEADERS)
31
32$(TESTS):
33	$(CXX) $(CXXFLAGS) -o $@ $(filter %.cc,$^) $(LDFLAGS) -lpthread
34
35atomic_unittest: test/Atomic_unittest.cc
36
37blockingqueue_test: test/BlockingQueue_test.cc Thread.cc
38
39boundedblockingqueue_test: test/BoundedBlockingQueue_test.cc Thread.cc
40
41copyonwrite_test: test/CopyOnWrite_test.cc Thread.cc
42
43exit_deadlock: test/ExitDeadLock.cc Thread.cc
44
45mutual_deadlock: test/MutualDeadLock.cc Thread.cc
46
47nonrecursivemutex_test: test/NonRecursiveMutex_test.cc Thread.cc
48
49requestinventory_test: test/RequestInventory_test.cc Thread.cc
50requestinventory_test2: test/RequestInventory_test2.cc Thread.cc
51
52self_deadlock: test/SelfDeadLock.cc Thread.cc
53
54exception_test: test/Exception_test.cc Exception.cc
55
56fork_test: test/Fork_test.cc Thread.cc
57
58singleton_test: test/Singleton_test.cc Thread.cc
59singleton_test: CXXFLAGS += -ftemplate-depth-1000
60
61singleton_threadlocal_test: test/SingletonThreadLocal_test.cc Thread.cc
62
63thread_test: test/Thread_test.cc Thread.cc
64thread_bench: test/Thread_bench.cc Thread.cc ../datetime/Timestamp.cc
65
66threadlocal_test: test/ThreadLocal_test.cc Thread.cc
67
68threadlocalsingleton_test: test/ThreadLocalSingleton_test.cc Thread.cc
69
70threadpool_test: test/ThreadPool_test.cc Thread.cc ThreadPool.cc Exception.cc
71
72weakcallback_test: test/WeakCallback_test.cc
73weakcallback_test: CXXFLAGS += -Wextra --std=c++0x -DBOOST_TEST_DYN_LINK
74weakcallback_test: LDFLAGS += -lboost_unit_test_framework
75
76signalslot_test: test/SignalSlot_test.cc Thread.cc
77signalslot_test: CXXFLAGS += -Wextra --std=c++0x -DBOOST_TEST_DYN_LINK
78signalslot_test: LDFLAGS += -lboost_unit_test_framework
79
80waiter_test: test/Waiter_test.cc Thread.cc
81waiter_test: CXXFLAGS += --std=c++0x
82
83clean:
84	rm -f $(TESTS)
85