blob: 9e028027e8f46bf86bf9a7e9f609c35ed74ef78b [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001# Makefile for Thrift test project.
David Reiss0c90f6f2008-02-06 22:18:40 +00002#
Mark Sleee8540632006-05-30 09:24:40 +00003# Author:
4# Mark Slee <mcslee@facebook.com>
5
6# Default target is everything
Marc Slemko6be374b2006-08-04 03:16:25 +00007
8ifndef thrift_home
Aditya Agarwal0cc0c0a2006-09-05 22:38:13 +00009thrift_home=../..
Marc Slemko6be374b2006-08-04 03:16:25 +000010endif #thrift_home
Marc Slemkoe6889de2006-08-12 00:32:53 +000011
Mark Sleee8540632006-05-30 09:24:40 +000012target: all
13
Marc Slemkoe6889de2006-08-12 00:32:53 +000014ifndef boost_home
Aditya Agarwal0cc0c0a2006-09-05 22:38:13 +000015#boost_home=../../../../../thirdparty/boost_1_33_1
Mark Sleed3d733a2006-09-01 22:19:06 +000016boost_home=/usr/local/include/boost-1_33_1
17endif #boost_home
Marc Slemkoe6889de2006-08-12 00:32:53 +000018target: all
19
Aditya Agarwal0cc0c0a2006-09-05 22:38:13 +000020include_paths = $(thrift_home)/lib/cpp/src \
Marc Slemkoe6889de2006-08-12 00:32:53 +000021 $(boost_home)
22
23include_flags = $(patsubst %,-I%, $(include_paths))
24
Mark Sleee8540632006-05-30 09:24:40 +000025# Tools
Marc Slemkob09f5882006-08-23 22:03:34 +000026ifndef THRIFT
Mark Slee6f5e2cb2007-01-25 08:01:28 +000027THRIFT = ../../compiler/cpp/thrift
Marc Slemkob09f5882006-08-23 22:03:34 +000028endif # THRIFT
29
Mark Sleee8540632006-05-30 09:24:40 +000030CC = g++
31LD = g++
32
33# Compiler flags
Mark Slee0788a702007-01-25 08:14:50 +000034DCFL = -Wall -O3 -g -I./gen-cpp $(include_flags) -L$(thrift_home)/lib/cpp/.libs -lthrift -lthriftnb -levent
35LFL = -L$(thrift_home)/lib/cpp/.libs -lthrift -lthriftnb -levent
Mark Slee9e288d42007-01-24 23:42:12 +000036CCFL = -Wall -O3 -I./gen-cpp $(include_flags)
37CFL = $(CCFL) $(LFL)
Mark Sleee8540632006-05-30 09:24:40 +000038
39all: server client
40
Mark Slee6e536442006-06-30 18:28:50 +000041debug: server-debug client-debug
42
Mark Sleee8540632006-05-30 09:24:40 +000043stubs: ../ThriftTest.thrift
David Reissb139f642009-02-17 20:28:46 +000044 $(THRIFT) --gen cpp ../ThriftTest.thrift
Mark Sleee8540632006-05-30 09:24:40 +000045
Mark Slee6e536442006-06-30 18:28:50 +000046server-debug: stubs
David Reiss0c90f6f2008-02-06 22:18:40 +000047 g++ -o TestServer $(DCFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp
Mark Slee6e536442006-06-30 18:28:50 +000048
49client-debug: stubs
Mark Sleea6b48ea2006-10-12 04:04:11 +000050 g++ -o TestClient $(DCFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp
Mark Slee6e536442006-06-30 18:28:50 +000051
Mark Sleee8540632006-05-30 09:24:40 +000052server: stubs
Mark Sleea6b48ea2006-10-12 04:04:11 +000053 g++ -o TestServer $(CFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp
Mark Sleee8540632006-05-30 09:24:40 +000054
55client: stubs
Mark Sleea6b48ea2006-10-12 04:04:11 +000056 g++ -o TestClient $(CFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp
Mark Sleee8540632006-05-30 09:24:40 +000057
Mark Slee9e288d42007-01-24 23:42:12 +000058small:
David Reissb139f642009-02-17 20:28:46 +000059 $(THRIFT) --gen cpp ../SmallTest.thrift
Mark Slee9e288d42007-01-24 23:42:12 +000060 g++ -c $(CCFL) ./gen-cpp/SmallService.cpp ./gen-cpp/SmallTest_types.cpp
61
Mark Sleee8540632006-05-30 09:24:40 +000062clean:
Mark Slee0788a702007-01-25 08:14:50 +000063 rm -fr *.o TestServer TestClient gen-cpp