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 8go: add_person_go list_people_go 9gotest: add_person_gotest list_people_gotest 10java: add_person_java list_people_java 11python: add_person_python list_people_python 12 13clean: 14 rm -f add_person_cpp list_people_cpp add_person_java list_people_java add_person_python list_people_python 15 rm -f javac_middleman AddPerson*.class ListPeople*.class com/example/tutorial/*.class 16 rm -f protoc_middleman addressbook.pb.cc addressbook.pb.h addressbook_pb2.py com/example/tutorial/AddressBookProtos.java 17 rm -f *.pyc 18 rm -f protoc_middleman_go tutorial/*.pb.go add_person_go list_people_go 19 rmdir tutorial 2>/dev/null || true 20 rmdir com/example/tutorial 2>/dev/null || true 21 rmdir com/example 2>/dev/null || true 22 rmdir com 2>/dev/null || true 23 24protoc_middleman: addressbook.proto 25 protoc --cpp_out=. --java_out=. --python_out=. addressbook.proto 26 @touch protoc_middleman 27 28protoc_middleman_go: addressbook.proto 29 mkdir tutorial # make directory for go package 30 protoc --go_out=tutorial addressbook.proto 31 @touch protoc_middleman_go 32 33add_person_cpp: add_person.cc protoc_middleman 34 pkg-config --cflags protobuf # fails if protobuf is not installed 35 c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` 36 37list_people_cpp: list_people.cc protoc_middleman 38 pkg-config --cflags protobuf # fails if protobuf is not installed 39 c++ list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf` 40 41add_person_go: add_person.go protoc_middleman_go 42 go build -o add_person_go add_person.go 43 44add_person_gotest: add_person_test.go add_person_go 45 go test add_person.go add_person_test.go 46 47list_people_go: list_people.go protoc_middleman_go 48 go build -o list_people_go list_people.go 49 50list_people_gotest: list_people.go list_people_go 51 go test list_people.go list_people_test.go 52 53javac_middleman: AddPerson.java ListPeople.java protoc_middleman 54 javac AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java 55 @touch javac_middleman 56 57add_person_java: javac_middleman 58 @echo "Writing shortcut script add_person_java..." 59 @echo '#! /bin/sh' > add_person_java 60 @echo 'java -classpath .:$$CLASSPATH AddPerson "$$@"' >> add_person_java 61 @chmod +x add_person_java 62 63list_people_java: javac_middleman 64 @echo "Writing shortcut script list_people_java..." 65 @echo '#! /bin/sh' > list_people_java 66 @echo 'java -classpath .:$$CLASSPATH ListPeople "$$@"' >> list_people_java 67 @chmod +x list_people_java 68 69add_person_python: add_person.py protoc_middleman 70 @echo "Writing shortcut script add_person_python..." 71 @echo '#! /bin/sh' > add_person_python 72 @echo './add_person.py "$$@"' >> add_person_python 73 @chmod +x add_person_python 74 75list_people_python: list_people.py protoc_middleman 76 @echo "Writing shortcut script list_people_python..." 77 @echo '#! /bin/sh' > list_people_python 78 @echo './list_people.py "$$@"' >> list_people_python 79 @chmod +x list_people_python 80