PageRenderTime 48ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/Makefile

https://code.google.com/p/protoc-gen-as3/
Makefile | 217 lines | 173 code | 36 blank | 8 comment | 5 complexity | 1892ae94619d25db988abe1e530593a0 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. # Copyright (c) 2010 , NetEase.com,Inc. All rights reserved.
  2. #
  3. # Author: Yang Bo (pop.atry@gmail.com)
  4. #
  5. # Use, modification and distribution are subject to the "New BSD License"
  6. # as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.
  7. include config.mk
  8. ifeq ($(OS), Windows_NT)
  9. PROTOC_GEN_AS3=dist\\protoc-gen-as3$(BAT)
  10. else
  11. PROTOC_GEN_AS3=dist/protoc-gen-as3$(BAT)
  12. endif
  13. ALL=dist/protoc-gen-as3 dist/protoc-gen-as3.bat dist/LICENSE\
  14. dist/protobuf.swc dist/README dist/options.proto\
  15. dist/protoc-gen-as3.jar dist/protobuf-java-$(PROTOBUF_VERSION).jar
  16. all: $(ALL)
  17. classes/com/netease/protocGenAs3/Main.class: \
  18. plugin.proto.java/google/protobuf/compiler/Plugin.java \
  19. options.proto.java/com \
  20. compiler/com/netease/protocGenAs3/Main.java \
  21. $(PROTOBUF_DIR)/java/target/protobuf-java-$(PROTOBUF_VERSION).jar \
  22. | classes
  23. $(JAVAC) -source 1.5 -target 1.5 -encoding UTF-8 -d classes \
  24. -classpath "$(PROTOBUF_DIR)/java/target/protobuf-java-$(PROTOBUF_VERSION).jar" \
  25. -sourcepath "plugin.proto.java$(PATH_SEPARATOR)compiler$(PATH_SEPARATOR)options.proto.java" \
  26. compiler/com/netease/protocGenAs3/Main.java
  27. plugin.proto.java/google/protobuf/compiler/Plugin.java: \
  28. $(PROTOCDEPS) | plugin.proto.java
  29. $(PROTOC) \
  30. "--proto_path=$(PROTOBUF_DIR)/src" --java_out=plugin.proto.java \
  31. "$(PROTOBUF_DIR)/src/google/protobuf/compiler/plugin.proto"
  32. dist.tar.gz: $(ALL)
  33. tar -acf dist.tar.gz -C dist .
  34. dist/LICENSE: LICENSE | dist
  35. cp $< $@
  36. dist/README: README | dist
  37. cp $< $@
  38. dist/options.proto: options.proto | dist
  39. cp $< $@
  40. dist/protoc-gen-as3: dist/protoc-gen-as3.jar dist/protobuf-java-$(PROTOBUF_VERSION).jar \
  41. | dist
  42. (echo '#!/bin/sh';\
  43. echo 'cd `dirname "$$0"` && java -jar protoc-gen-as3.jar') > $@
  44. chmod +x $@
  45. dist/protoc-gen-as3.bat: dist/protoc-gen-as3.jar dist/protobuf-java-$(PROTOBUF_VERSION).jar \
  46. | dist
  47. (echo '@cd %~dp0';\
  48. echo '@java -jar protoc-gen-as3.jar') > $@
  49. chmod +x $@
  50. COMMA=,
  51. # ??????dist/protobuf.swc?compc????
  52. # Workaround: ???????
  53. tiny-protobuf.swc: $(filter-out as3/com/netease/protobuf/CustomOption.as,$(wildcard as3/com/netease/protobuf/*/*.as as3/com/netease/protobuf/*.as))
  54. $(COMPC) -target-player=10 \
  55. -output=$@ \
  56. -source-path+=as3 \
  57. -include-sources+='$(subst $(EMPTY) ,'$(COMMA)',$^)'
  58. dist/protobuf.swc: as3/com/netease/protobuf/CustomOption.as descriptor.proto.as3/google tiny-protobuf.swc | dist
  59. $(COMPC) -target-player=10 \
  60. -source-path+=as3,descriptor.proto.as3 \
  61. -output=$@ \
  62. -include-libraries+=tiny-protobuf.swc \
  63. google.protobuf.MethodOptions \
  64. google.protobuf.ServiceOptions \
  65. com.netease.protobuf.CustomOption
  66. doc: \
  67. $(wildcard as3/com/netease/protobuf/*/*.as as3/com/netease/protobuf/*.as) \
  68. descriptor.proto.as3/google \
  69. | dist
  70. $(ASDOC) -target-player=10 \
  71. --doc-sources+=as3 \
  72. --source-path+=descriptor.proto.as3 \
  73. -output=$@ \
  74. -exclude-sources+=as3/com/netease/protobuf/CustomOption.as
  75. doc.tar.gz: doc
  76. tar -acf $@ $<
  77. MANIFEST.MF:
  78. echo Class-Path: protobuf-java-$(PROTOBUF_VERSION).jar > $@
  79. dist/protoc-gen-as3.jar: classes/com/netease/protocGenAs3/Main.class \
  80. MANIFEST.MF | dist
  81. $(JAR) cemf com/netease/protocGenAs3/Main MANIFEST.MF $@ -C classes .
  82. dist/protobuf-java-$(PROTOBUF_VERSION).jar: \
  83. $(PROTOBUF_DIR)/java/target/protobuf-java-$(PROTOBUF_VERSION).jar \
  84. | dist
  85. cp $< $@
  86. options.proto.java descriptor.proto.as3 classes plugin.proto.java unittest.proto.as3 dist:
  87. mkdir $@
  88. ifndef PROTOC
  89. PROTOC=$(PROTOBUF_DIR)/src/protoc$(EXE)
  90. PROTOCDEPS=$(PROTOC)
  91. $(PROTOC): $(PROTOBUF_DIR)/Makefile
  92. cd $(PROTOBUF_DIR) && $(MAKE)
  93. $(PROTOBUF_DIR)/Makefile: $(PROTOBUF_DIR)/configure
  94. cd $(PROTOBUF_DIR) && ./configure
  95. $(PROTOBUF_DIR)/configure:
  96. cd $(PROTOBUF_DIR) && ./autogen.sh
  97. $(PROTOBUF_DIR)/java/target/protobuf-java-$(PROTOBUF_VERSION).jar: \
  98. $(PROTOBUF_DIR)/src \
  99. $(PROTOC)
  100. cd $(PROTOBUF_DIR)/java && $(MVN) package
  101. endif
  102. clean:
  103. -$(RM) -r doc
  104. -$(RM) doc.tar.gz
  105. -$(RM) -r dist
  106. -$(RM) dist.tar.gz
  107. -$(RM) -r classes
  108. -$(RM) -r unittest.proto.as3
  109. -$(RM) -r descriptor.proto.as3
  110. -$(RM) -r plugin.proto.java
  111. -$(RM) test.swc
  112. -$(RM) test.swf
  113. -$(RM) -r options.proto.java
  114. test: test.swf
  115. (sleep 1s; echo c; sleep 3s; echo c; sleep 1s) | $(FDB) $<
  116. haxe-test: haxe-test.swf
  117. (sleep 1s; echo c; sleep 1s; echo c; sleep 1s) | $(FDB) $<
  118. haxe-test.swc: test/com/netease/protobuf/test/TestAll.as \
  119. dist/protobuf.swc test.swc descriptor.proto.as3/google unittest.bin
  120. $(RM) -r $@
  121. $(COMPC) -target-player=10 \
  122. -directory -include-sources+=$< \
  123. -source-path+=descriptor.proto.as3 \
  124. -library-path+=test.swc,dist/protobuf.swc \
  125. -output=$@
  126. haxe-test.swf: haxe-test.swc test/com/netease/protobuf/test/HaxeTest.hx test.swf
  127. $(HAXE) -cp test -main com.netease.protobuf.test.HaxeTest \
  128. -debug -D fdb --macro 'patchTypes("haxe-test.patch")' \
  129. -swf $@ -swf-version 10 -swf-lib $</library.swf
  130. test.swf: test.swc test/com/netease/protobuf/test/TestAll.as \
  131. test/com/netease/protobuf/test/Test.mxml dist/protobuf.swc \
  132. descriptor.proto.as3/google unittest.bin
  133. $(MXMLC) -target-player=10 \
  134. -library-path+=test.swc,dist/protobuf.swc -output=$@ \
  135. -source-path+=descriptor.proto.as3,test test/com/netease/protobuf/test/Test.mxml -debug
  136. test.swc: unittest.proto.as3/protobuf_unittest dist/protobuf.swc
  137. $(COMPC) -target-player=10 \
  138. -include-sources+=unittest.proto.as3 \
  139. -external-library-path+=dist/protobuf.swc -output=$@
  140. options.proto.java/com: \
  141. options.proto \
  142. $(PROTOCDEPS) \
  143. | options.proto.java
  144. $(PROTOC) \
  145. --proto_path=. \
  146. "--proto_path=$(PROTOBUF_DIR)/src" \
  147. --java_out=options.proto.java $<
  148. touch $@
  149. descriptor.proto.as3/google: \
  150. $(PROTOCDEPS) \
  151. dist/protoc-gen-as3$(BAT) \
  152. | descriptor.proto.as3
  153. $(PROTOC) \
  154. --plugin=protoc-gen-as3=$(PROTOC_GEN_AS3) \
  155. "--proto_path=$(PROTOBUF_DIR)/src" \
  156. --as3_out=descriptor.proto.as3 \
  157. "$(PROTOBUF_DIR)/src/google/protobuf/descriptor.proto"
  158. touch $@
  159. unittest.bin: $(PROTOCDEPS) $(wildcard test/*.proto)
  160. $(PROTOC) \
  161. --proto_path=test --proto_path=. \
  162. "--proto_path=$(PROTOBUF_DIR)/src" \
  163. --descriptor_set_out=$@ \
  164. $(PROTOBUF_DIR)/src/google/protobuf/unittest.proto \
  165. $(PROTOBUF_DIR)/src/google/protobuf/unittest_import.proto \
  166. test/*.proto
  167. unittest.proto.as3/protobuf_unittest: \
  168. $(PROTOCDEPS) \
  169. dist/protoc-gen-as3$(BAT) \
  170. $(wildcard test/*.proto) \
  171. | unittest.proto.as3
  172. $(PROTOC) \
  173. --plugin=protoc-gen-as3=$(PROTOC_GEN_AS3) \
  174. --proto_path=test --proto_path=. \
  175. "--proto_path=$(PROTOBUF_DIR)/src" \
  176. --as3_out=unittest.proto.as3 \
  177. $(PROTOBUF_DIR)/src/google/protobuf/unittest.proto \
  178. $(PROTOBUF_DIR)/src/google/protobuf/unittest_import.proto \
  179. test/*.proto
  180. touch $@
  181. .PHONY: plugin all clean test doc