1b9b67c9bSShuo ChenCXXFLAGS=-g -Wall -I /usr/local/include
24886147bSShuo ChenCXXFLAGS+=-O2
3cd139dc7SShuo Chen
40d2d6577SShuo ChenHEADERS=$(wildcard *.h)
5cd139dc7SShuo ChenTESTS= atomic_unittest \
6cd139dc7SShuo Chen       blockingqueue_test \
79d9bda4cSShuo Chen       boundedblockingqueue_test \
82d3b4de6SShuo Chen       copyonwrite_test \
950da4f87SShuo Chen       exception_test \
1050da4f87SShuo Chen       fork_test \
11cd139dc7SShuo Chen       singleton_test \
12cd139dc7SShuo Chen       singleton_threadlocal_test \
13cd139dc7SShuo Chen       threadlocal_test \
14cd139dc7SShuo Chen       threadlocalsingleton_test \
15b9b67c9bSShuo Chen       thread_bench \
16cd139dc7SShuo Chen       thread_test \
17d3811de4SShuo Chen       threadpool_test \
18d3811de4SShuo Chen       exit_deadlock \
19d3811de4SShuo Chen       mutual_deadlock \
202d3b4de6SShuo Chen       nonrecursivemutex_test \
212d3b4de6SShuo Chen       requestinventory_test \
222d3b4de6SShuo Chen       requestinventory_test2 \
23a0e66be7SShuo Chen       self_deadlock \
244670cafeSShuo Chen       weakcallback_test \
259b063ed9SShuo Chen       signalslot_test \
269b063ed9SShuo Chen       waiter_test
27cd139dc7SShuo Chen
28cd139dc7SShuo Chenall: $(TESTS)
29cd139dc7SShuo Chen
300d2d6577SShuo Chen$(TESTS): $(HEADERS)
310d2d6577SShuo Chen
320d2d6577SShuo Chen$(TESTS):
33b9b67c9bSShuo Chen	$(CXX) $(CXXFLAGS) -o $@ $(filter %.cc,$^) $(LDFLAGS) -lpthread
340d2d6577SShuo Chen
35cd139dc7SShuo Chenatomic_unittest: test/Atomic_unittest.cc
36cd139dc7SShuo Chen
37b24dfd25SShuo Chenblockingqueue_test: test/BlockingQueue_test.cc Thread.cc
38cd139dc7SShuo Chen
39b24dfd25SShuo Chenboundedblockingqueue_test: test/BoundedBlockingQueue_test.cc Thread.cc
409d9bda4cSShuo Chen
412d3b4de6SShuo Chencopyonwrite_test: test/CopyOnWrite_test.cc Thread.cc
422d3b4de6SShuo Chen
43d3811de4SShuo Chenexit_deadlock: test/ExitDeadLock.cc Thread.cc
44d3811de4SShuo Chen
45d3811de4SShuo Chenmutual_deadlock: test/MutualDeadLock.cc Thread.cc
46d3811de4SShuo Chen
472d3b4de6SShuo Chennonrecursivemutex_test: test/NonRecursiveMutex_test.cc Thread.cc
482d3b4de6SShuo Chen
492d3b4de6SShuo Chenrequestinventory_test: test/RequestInventory_test.cc Thread.cc
502d3b4de6SShuo Chenrequestinventory_test2: test/RequestInventory_test2.cc Thread.cc
512d3b4de6SShuo Chen
52d3811de4SShuo Chenself_deadlock: test/SelfDeadLock.cc Thread.cc
5362574298SShuo Chen
54cd139dc7SShuo Chenexception_test: test/Exception_test.cc Exception.cc
55cd139dc7SShuo Chen
5650da4f87SShuo Chenfork_test: test/Fork_test.cc Thread.cc
5750da4f87SShuo Chen
58cd139dc7SShuo Chensingleton_test: test/Singleton_test.cc Thread.cc
592d3b4de6SShuo Chensingleton_test: CXXFLAGS += -ftemplate-depth-1000
60cd139dc7SShuo Chen
61cd139dc7SShuo Chensingleton_threadlocal_test: test/SingletonThreadLocal_test.cc Thread.cc
62cd139dc7SShuo Chen
63cd139dc7SShuo Chenthread_test: test/Thread_test.cc Thread.cc
64b9b67c9bSShuo Chenthread_bench: test/Thread_bench.cc Thread.cc ../datetime/Timestamp.cc
65cd139dc7SShuo Chen
66cd139dc7SShuo Chenthreadlocal_test: test/ThreadLocal_test.cc Thread.cc
67cd139dc7SShuo Chen
68cd139dc7SShuo Chenthreadlocalsingleton_test: test/ThreadLocalSingleton_test.cc Thread.cc
69cd139dc7SShuo Chen
70b24dfd25SShuo Chenthreadpool_test: test/ThreadPool_test.cc Thread.cc ThreadPool.cc Exception.cc
71cd139dc7SShuo Chen
72a0e66be7SShuo Chenweakcallback_test: test/WeakCallback_test.cc
732b2bf878SShuo Chenweakcallback_test: CXXFLAGS += -Wextra --std=c++0x -DBOOST_TEST_DYN_LINK
742b2bf878SShuo Chenweakcallback_test: LDFLAGS += -lboost_unit_test_framework
75a0e66be7SShuo Chen
762d6ff445SShuo Chensignalslot_test: test/SignalSlot_test.cc Thread.cc
772b2bf878SShuo Chensignalslot_test: CXXFLAGS += -Wextra --std=c++0x -DBOOST_TEST_DYN_LINK
782b2bf878SShuo Chensignalslot_test: LDFLAGS += -lboost_unit_test_framework
794670cafeSShuo Chen
809b063ed9SShuo Chenwaiter_test: test/Waiter_test.cc Thread.cc
819b063ed9SShuo Chenwaiter_test: CXXFLAGS += --std=c++0x
829b063ed9SShuo Chen
83cd139dc7SShuo Chenclean:
84cd139dc7SShuo Chen	rm -f $(TESTS)
85