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