1 # See README.txt. 2 3 .PHONY: all cpp java python clean 4 5 all: cpp java python 6 7 cpp: add_person_cpp list_people_cpp 8 go: add_person_go list_people_go 9 gotest: add_person_gotest list_people_gotest 10 java: add_person_java list_people_java 11 python: add_person_python list_people_python 12 13 clean: 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 24 protoc_middleman: addressbook.proto 25 protoc --cpp_out=. --java_out=. --python_out=. addressbook.proto 26 @touch protoc_middleman 27 28 protoc_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 33 add_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 37 list_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 41 add_person_go: add_person.go protoc_middleman_go 42 go build -o add_person_go add_person.go 43 44 add_person_gotest: add_person_test.go add_person_go 45 go test add_person.go add_person_test.go 46 47 list_people_go: list_people.go protoc_middleman_go 48 go build -o list_people_go list_people.go 49 50 list_people_gotest: list_people.go list_people_go 51 go test list_people.go list_people_test.go 52 53 javac_middleman: AddPerson.java ListPeople.java protoc_middleman 54 javac AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java 55 @touch javac_middleman 56 57 add_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 63 list_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 69 add_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 75 list_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