Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. UNAME_S = $(shell uname -s)
  2. ifeq ($(UNAME_S),Linux)
  3. else
  4. CFLAGS = -Xcc -ISources/BoringSSL/include -Xlinker -lz
  5. endif
  6. all:
  7. swift build $(CFLAGS)
  8. cp .build/debug/protoc-gen-swift .
  9. cp .build/debug/protoc-gen-swiftgrpc .
  10. project:
  11. swift package $(CFLAGS) generate-xcodeproj
  12. @-ruby fix-project-settings.rb || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."
  13. test: all
  14. swift test $(CFLAGS)
  15. test-echo: all
  16. cp .build/debug/Echo .
  17. ./Echo serve & /bin/echo $$! > echo.pid
  18. ./Echo get | tee test.out
  19. ./Echo expand | tee -a test.out
  20. ./Echo collect | tee -a test.out
  21. ./Echo update | tee -a test.out
  22. kill -9 `cat echo.pid`
  23. diff -u test.out Sources/Examples/Echo/test.gold
  24. test-plugin:
  25. swift build $(CFLAGS) --product protoc-gen-swiftgrpc
  26. protoc Sources/Examples/Echo/echo.proto --proto_path=Sources/Examples/Echo --plugin=.build/debug/protoc-gen-swift --plugin=.build/debug/protoc-gen-swiftgrpc --swiftgrpc_out=/tmp --swiftgrpc_opt=TestStubs=true
  27. diff -u /tmp/echo.grpc.swift Sources/Examples/Echo/Generated/echo.grpc.swift
  28. xcodebuild: project
  29. xcodebuild -configuration "Debug" -parallelizeTargets -target SwiftGRPC -target Echo -target Simple -target protoc-gen-swiftgrpc build
  30. clean:
  31. rm -rf Packages
  32. rm -rf .build build
  33. rm -rf SwiftGRPC.xcodeproj
  34. rm -rf Package.pins Package.resolved
  35. rm -rf protoc-gen-swift protoc-gen-swiftgrpc
  36. cd Examples/Echo/PackageManager; make clean
  37. cd Examples/Simple/PackageManager; make clean