|
1 | 1 |
|
2 |
| -BINS = client_sync server_sync server_async |
| 2 | +CPP_BINS = client_sync server_sync server_async |
3 | 3 |
|
4 | 4 | # consider also -lboost_thread-mt -lpthread
|
5 |
| -LIBS = -lboost_system-mt -lprotobuf |
6 |
| -CFLAGS = -Wall -O2 --std=c++11 -L/usr/local/lib |
| 5 | +CPP_LIBS = -lboost_system-mt -lprotobuf |
| 6 | +CPP_FLAGS = -Wall -O2 --std=c++11 -L/usr/local/lib |
7 | 7 |
|
8 |
| -all: $(BINS) msg_pb2.py |
| 8 | +all: CPP Python |
9 | 9 |
|
| 10 | +CPP: $(CPP_BINS) |
10 | 11 |
|
11 |
| -$(BINS): %: %.cc msg.pb.cc asio_server.h |
12 |
| - clang++ $(CFLAGS) $@.cc msg.pb.cc -o $@ $(LIBS) |
| 12 | +Python: Python/gen/msg_pb2.py |
13 | 13 |
|
14 |
| -msg.pb.cc: msg.proto |
15 |
| - protoc --cpp_out=. msg.proto |
| 14 | +$(CPP_BINS): %: C++/src/%.cc C++/gen/msg.pb.cc C++/src/asio_server.h |
| 15 | + clang++ $(CPP_FLAGS) C++/src/$@.cc C++/gen/msg.pb.cc -o C++/bin/$@ $(CPP_LIBS) |
| 16 | + cp C++/bin/$@ bin/cpp_$@ |
16 | 17 |
|
17 |
| -msg_pb2.py: msg.proto |
18 |
| - protoc --python_out=. msg.proto |
| 18 | +C++/gen/msg.pb.cc: msg.proto |
| 19 | + protoc --cpp_out=C++/gen msg.proto |
| 20 | + |
| 21 | +Python/gen/msg_pb2.py: msg.proto |
| 22 | + touch Python/gen/__init__.py # I hate this. |
| 23 | + protoc --python_out=Python/gen msg.proto |
| 24 | + echo "#!/bin/sh\n\npython Python/client.py" > bin/python_client.sh |
| 25 | + chmod +x bin/python_client.sh |
| 26 | + echo "#!/bin/sh\n\npython Python/server.py" > bin/python_server.sh |
| 27 | + chmod +x bin/python_server.sh |
19 | 28 |
|
20 | 29 | .PHONY : clean
|
21 | 30 | clean:
|
22 |
| - rm -f $(BINS) msg.pb.cc msg.pb.h msg_pb2.py msg_pb2.pyc |
| 31 | + rm -f C++/bin/* C++/gen/* Python/gen/* bin/* |
0 commit comments