aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-02-19 14:45:41 -0800
committerGravatar Yang Gao <yangg@google.com>2015-02-19 14:45:41 -0800
commit72bc5647960e0ec6cc9e8b5889acdf68f346286f (patch)
treeb15b341c6c1d52decdb9f3c8f9089fe35d5dcb67
parentd95693724c45648f2f023cff29df11fc1d9910dd (diff)
Resolve comments on makefile
-rw-r--r--cpp/helloworld/Makefile25
1 files changed, 17 insertions, 8 deletions
diff --git a/cpp/helloworld/Makefile b/cpp/helloworld/Makefile
index 38f4ff081f..7211aa5cbe 100644
--- a/cpp/helloworld/Makefile
+++ b/cpp/helloworld/Makefile
@@ -29,19 +29,28 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-CC=g++
-CCFLAGS=-I/usr/local/include -std=c++11
-LDFLAGS=-L/usr/local/lib -lgrpc -lgrpc++ -lprotobuf -ldl
+CXX=g++
+CPPFLAGS=-I/usr/local/include -pthread
+CXXFLAGS=-std=c++11
+LDFLAGS=-L/usr/local/lib -lgrpc -lgrpc++ -lprotobuf -lpthread -ldl
all: greeter_client greeter_server
-greeter_client: helloworld.pb.cc greeter_client.cc
- $(CC) $(CCFLAGS) greeter_client.cc helloworld.pb.cc $(LDFLAGS) -o greeter_client.out
+helloworld.o: helloworld.pb.cc
+ $(CXX) -c $(CXXFLAGS) $^
+greeter_client.o: greeter_client.cc
+ $(CXX) -c $(CXXFLAGS) $^
-greeter_server: helloworld.pb.cc greeter_server.cc
- $(CC) $(CCFLAGS) greeter_server.cc helloworld.pb.cc $(LDFLAGS) -o greeter_server.out
+greeter_server.o: greeter_server.cc
+ $(CXX) -c $(CXXFLAGS) $^
+
+greeter_client: helloworld.pb.o greeter_client.o
+ $(CXX) $(CPPFLAGS) $^ $(LDFLAGS) -o $@
+
+greeter_server: helloworld.pb.o greeter_server.o
+ $(CXX) $(CPPFLAGS) $^ $(LDFLAGS) -o $@
clean:
- rm *.out
+ rm -f *.o greeter_client greeter_server