Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. UNAME_S = $(shell uname -s)
  2. ifeq ($(UNAME_S),Linux)
  3. CFLAGS = -Xcc -DTSI_OPENSSL_ALPN_SUPPORT=0
  4. else
  5. CFLAGS = -Xcc -ISources/BoringSSL/include
  6. endif
  7. all:
  8. swift build -v $(CFLAGS)
  9. cp .build/debug/protoc-gen-swift .
  10. cp .build/debug/protoc-gen-swiftgrpc .
  11. project:
  12. swift package generate-xcodeproj
  13. # Optional: set the generated project's indentation settings.
  14. -ruby fix-indentation-settings.rb || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."
  15. test: all
  16. swift test -v $(CFLAGS)
  17. test-echo: all
  18. cp .build/debug/Echo .
  19. ./Echo serve & /bin/echo $$! > echo.pid
  20. ./Echo get | tee test.out
  21. ./Echo expand | tee -a test.out
  22. ./Echo collect | tee -a test.out
  23. ./Echo update | tee -a test.out
  24. kill -9 `cat echo.pid`
  25. diff -u test.out Sources/Examples/Echo/test.gold
  26. test-plugin:
  27. swift build -v $(CFLAGS) --product protoc-gen-swiftgrpc
  28. 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
  29. diff -u /tmp/echo.grpc.swift Sources/Examples/Echo/Generated/echo.grpc.swift
  30. clean:
  31. rm -rf Packages
  32. rm -rf .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