Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 1 | # Makefile for Thrift C++ library. Generates a shared object that can be |
| 2 | # installed to /usr/local/lib |
| 3 | # |
| 4 | # TODO(mcslee): Add the ability to compile separate statis modules that can |
| 5 | # be compiled directly into Thrift applications instead of dynamic runtime |
| 6 | # loading of the full libs |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 7 | # |
| 8 | # Author: |
| 9 | # Mark Slee <mcslee@facebook.com> |
| 10 | |
Marc Slemko | 0e53ccd | 2006-07-17 23:51:05 +0000 | [diff] [blame] | 11 | target: libthrift.so libconcurrency.so |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 12 | |
| 13 | # Tools |
| 14 | LD = g++ |
Marc Slemko | 0e53ccd | 2006-07-17 23:51:05 +0000 | [diff] [blame] | 15 | CPP = g++ |
| 16 | |
| 17 | CC_COMMON_FLAGS = -g -c -Wall -Isrc -fPIC -fno-common |
| 18 | |
| 19 | LD_COMMON_FLAGS= |
| 20 | |
| 21 | LD_APP_FLAGS= $(LD_COMMON_FLAGS) |
| 22 | |
| 23 | LD_LIB_FLAGS= -dynamiclib $(LD_COMMON_FLAGS) |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 24 | |
| 25 | # Source files |
Mark Slee | 4e0d962 | 2006-06-26 23:56:08 +0000 | [diff] [blame] | 26 | SRCS = src/protocol/TBinaryProtocol.cc \ |
| 27 | src/transport/TBufferedTransport.cc \ |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 28 | src/transport/TChunkedTransport.cc \ |
Mark Slee | 4e0d962 | 2006-06-26 23:56:08 +0000 | [diff] [blame] | 29 | src/transport/TSocket.cc \ |
| 30 | src/transport/TServerSocket.cc \ |
| 31 | src/server/TSimpleServer.cc |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 32 | |
Marc Slemko | 0e53ccd | 2006-07-17 23:51:05 +0000 | [diff] [blame] | 33 | # Concurreny Utility Source files |
| 34 | CONCURRENCY_SRCS = src/concurrency/Monitor.cc \ |
| 35 | src/concurrency/Mutex.cc \ |
| 36 | src/concurrency/PosixThreadFactory.cc \ |
| 37 | src/concurrency/ThreadManager.cc \ |
| 38 | src/concurrency/TimerManager.cc |
| 39 | |
| 40 | CONCURRENCY_OBJS = $(patsubst %.cc,%.o,$(CONCURRENCY_SRCS)) |
| 41 | |
| 42 | $(CONCURRENCY_OBJS): %.o : %.cc |
| 43 | $(CC) $(CC_COMMON_FLAGS) $< -o $@ |
| 44 | |
| 45 | CONCURRENCY_TEST_SRCS = src/concurrency/test/TimerManagerTests.cc |
| 46 | |
| 47 | CONCURRENCY_TEST_OBJS = $(patsubst %.cc,%.o,$(CONCURRENCY_TEST_SRCS)) |
| 48 | |
| 49 | $(CONCURRENCY_TEST_OBJS): %.o : %.cc |
| 50 | $(CC) $(CC_COMMON_FLAGS) -I src/concurrency $< -o $@ |
| 51 | |
| 52 | # Linked libraries |
| 53 | |
| 54 | # thrift library |
| 55 | |
| 56 | THRIFT_OBJS = $(patsubst %.cc,%.o, $(SRCS)) |
| 57 | |
| 58 | $(THRIFT_OBJS): %.o : %.cc |
| 59 | $(CC) $(CC_COMMON_FLAGS) $< -o $@ |
| 60 | |
| 61 | libthrift.so: $(THRIFT_OBJS) |
| 62 | $(LD) -o $@ $(LD_LIB_FLAGS) $(THRIFT_OBJS) |
| 63 | |
| 64 | # concurrency util library |
| 65 | |
| 66 | libconcurrency.so: $(CONCURRENCY_OBJS) |
| 67 | $(LD) -o $@ $(LD_LIB_FLAGS) $(CONCURRENCY_OBJS) |
| 68 | |
| 69 | concurrency_tests: libconcurrency.so $(CONCURRENCY_TEST_OBJS) |
| 70 | $(LD) -o $@ $(LD_APP_FLAGS) -L. $(CONCURRENCY_TEST_OBJS) libconcurrency.so |
| 71 | |
| 72 | tests: concurrency_tests |
| 73 | |
| 74 | clean_libthrift: |
| 75 | rm -f libthrift.so |
| 76 | rm -f $(THRIFT_OBJS) |
| 77 | |
| 78 | clean_libconcurrency: |
| 79 | rm -f libconcurrency.so |
| 80 | rm -f $(CONCURRENCY_OBJS) |
| 81 | |
| 82 | clean_tests: |
| 83 | rm -f concurrency_tests |
| 84 | rm -f $(CONCURRENTY_TEST_OBJS) |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 85 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 86 | # Clean it up |
Marc Slemko | 0e53ccd | 2006-07-17 23:51:05 +0000 | [diff] [blame] | 87 | clean: clean_libthrift clean_libconcurrency clean_tests |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 88 | |
| 89 | # Install |
| 90 | install: libthrift |
| 91 | sudo install libthrift.so /usr/local/lib |