• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# See README.txt.
2
3.PHONY: all cpp java python clean
4
5all: cpp java python
6
7cpp:    add_person_cpp    list_people_cpp
8java:   add_person_java   list_people_java
9python: add_person_python list_people_python
10
11clean:
12	rm -f add_person_cpp list_people_cpp add_person_java list_people_java add_person_python list_people_python
13	rm -f javac_middleman AddPerson*.class ListPeople*.class com/example/tutorial/*.class
14	rm -f protoc_middleman addressbook.pb.cc addressbook.pb.h addressbook_pb2.py com/example/tutorial/AddressBookProtos.java
15	rm -f *.pyc
16	rmdir com/example/tutorial 2>/dev/null || true
17	rmdir com/example 2>/dev/null || true
18	rmdir com 2>/dev/null || true
19
20protoc_middleman: addressbook.proto
21	protoc --cpp_out=. --java_out=. --python_out=. addressbook.proto
22	@touch protoc_middleman
23
24add_person_cpp: add_person.cc protoc_middleman
25	pkg-config --cflags protobuf  # fails if protobuf is not installed
26	c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
27
28list_people_cpp: list_people.cc protoc_middleman
29	pkg-config --cflags protobuf  # fails if protobuf is not installed
30	c++ list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
31
32javac_middleman: AddPerson.java ListPeople.java protoc_middleman
33	javac AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
34	@touch javac_middleman
35
36add_person_java: javac_middleman
37	@echo "Writing shortcut script add_person_java..."
38	@echo '#! /bin/sh' > add_person_java
39	@echo 'java -classpath .:$$CLASSPATH AddPerson "$$@"' >> add_person_java
40	@chmod +x add_person_java
41
42list_people_java: javac_middleman
43	@echo "Writing shortcut script list_people_java..."
44	@echo '#! /bin/sh' > list_people_java
45	@echo 'java -classpath .:$$CLASSPATH ListPeople "$$@"' >> list_people_java
46	@chmod +x list_people_java
47
48add_person_python: add_person.py protoc_middleman
49	@echo "Writing shortcut script add_person_python..."
50	@echo '#! /bin/sh' > add_person_python
51	@echo './add_person.py "$$@"' >> add_person_python
52	@chmod +x add_person_python
53
54list_people_python: list_people.py protoc_middleman
55	@echo "Writing shortcut script list_people_python..."
56	@echo '#! /bin/sh' > list_people_python
57	@echo './list_people.py "$$@"' >> list_people_python
58	@chmod +x list_people_python
59