PageRenderTime 2583ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/ruby/1.9.1/gems/raindrops-0.13.0/pkg.mk

https://github.com/evenwestvang/skoolgate
Makefile | 175 lines | 146 code | 21 blank | 8 comment | 14 complexity | d9b18cb81480de3ce1d9e3028d72c41a MD5 | raw file
  1. RUBY = ruby
  2. RAKE = rake
  3. RSYNC = rsync
  4. WRONGDOC = wrongdoc
  5. GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
  6. @./GIT-VERSION-GEN
  7. -include GIT-VERSION-FILE
  8. -include local.mk
  9. DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
  10. RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
  11. RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
  12. lib := lib
  13. ifeq ($(shell test -f script/isolate_for_tests && echo t),t)
  14. isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/isolate.mk
  15. $(isolate_libs): script/isolate_for_tests
  16. @$(RUBY) script/isolate_for_tests
  17. -include $(isolate_libs)
  18. lib := $(lib):$(ISOLATE_LIBS)
  19. endif
  20. ext := $(firstword $(wildcard ext/*))
  21. ifneq ($(ext),)
  22. ext_pfx := tmp/ext/$(RUBY_ENGINE)-$(RUBY_VERSION)
  23. ext_h := $(wildcard $(ext)/*/*.h $(ext)/*.h)
  24. ext_src := $(wildcard $(ext)/*.c $(ext_h))
  25. ext_pfx_src := $(addprefix $(ext_pfx)/,$(ext_src))
  26. ext_d := $(ext_pfx)/$(ext)/.d
  27. $(ext)/extconf.rb: $(wildcard $(ext)/*.h)
  28. @>> $@
  29. $(ext_d):
  30. @mkdir -p $(@D)
  31. @> $@
  32. $(ext_pfx)/$(ext)/%: $(ext)/% $(ext_d)
  33. install -m 644 $< $@
  34. $(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_d) $(ext_h)
  35. $(RM) -f $(@D)/*.o
  36. cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb
  37. ext_sfx := _ext.$(DLEXT)
  38. ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
  39. $(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
  40. @echo $^ == $@
  41. $(MAKE) -C $(@D)
  42. lib := $(lib):$(ext_pfx)/$(ext)
  43. build: $(ext_dl)
  44. else
  45. build:
  46. endif
  47. pkg_extra += GIT-VERSION-FILE NEWS ChangeLog LATEST
  48. ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
  49. $(WRONGDOC) prepare
  50. NEWS LATEST: ChangeLog
  51. manifest:
  52. $(RM) .manifest
  53. $(MAKE) .manifest
  54. .manifest: $(pkg_extra)
  55. (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
  56. LC_ALL=C sort > $@+
  57. cmp $@+ $@ || mv $@+ $@
  58. $(RM) $@+
  59. doc:: .document .wrongdoc.yml $(pkg_extra)
  60. -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
  61. -find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
  62. $(RM) -r doc
  63. $(WRONGDOC) all
  64. install -m644 COPYING doc/COPYING
  65. install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
  66. ifneq ($(VERSION),)
  67. pkggem := pkg/$(rfpackage)-$(VERSION).gem
  68. pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
  69. release_notes := release_notes-$(VERSION)
  70. release_changes := release_changes-$(VERSION)
  71. release-notes: $(release_notes)
  72. release-changes: $(release_changes)
  73. $(release_changes):
  74. $(WRONGDOC) release_changes > $@+
  75. $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
  76. $(release_notes):
  77. $(WRONGDOC) release_notes > $@+
  78. $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
  79. # ensures we're actually on the tagged $(VERSION), only used for release
  80. verify:
  81. test x"$(shell umask)" = x0022
  82. git rev-parse --verify refs/tags/v$(VERSION)^{}
  83. git diff-index --quiet HEAD^0
  84. test $$(git rev-parse --verify HEAD^0) = \
  85. $$(git rev-parse --verify refs/tags/v$(VERSION)^{})
  86. fix-perms:
  87. -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
  88. -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
  89. gem: $(pkggem)
  90. install-gem: $(pkggem)
  91. gem install $(CURDIR)/$<
  92. $(pkggem): manifest fix-perms
  93. gem build $(rfpackage).gemspec
  94. mkdir -p pkg
  95. mv $(@F) $@
  96. $(pkgtgz): distdir = $(basename $@)
  97. $(pkgtgz): HEAD = v$(VERSION)
  98. $(pkgtgz): manifest fix-perms
  99. @test -n "$(distdir)"
  100. $(RM) -r $(distdir)
  101. mkdir -p $(distdir)
  102. tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
  103. cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
  104. mv $@+ $@
  105. package: $(pkgtgz) $(pkggem)
  106. test-release:: verify package $(release_notes) $(release_changes)
  107. # make tgz release on RubyForge
  108. @echo rubyforge add_release -f \
  109. -n $(release_notes) -a $(release_changes) \
  110. $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
  111. @echo gem push $(pkggem)
  112. @echo rubyforge add_file \
  113. $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
  114. release:: verify package $(release_notes) $(release_changes)
  115. # make tgz release on RubyForge
  116. rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
  117. $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
  118. # push gem to RubyGems.org
  119. gem push $(pkggem)
  120. # in case of gem downloads from RubyForge releases page
  121. rubyforge add_file \
  122. $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
  123. else
  124. gem install-gem: GIT-VERSION-FILE
  125. $(MAKE) $@ VERSION=$(GIT_VERSION)
  126. endif
  127. all:: test
  128. test_units := $(wildcard test/test_*.rb)
  129. test: test-unit
  130. test-unit: $(test_units)
  131. $(test_units): build
  132. $(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
  133. # this requires GNU coreutils variants
  134. ifneq ($(RSYNC_DEST),)
  135. publish_doc:
  136. -git set-file-times
  137. $(MAKE) doc
  138. find doc/images -type f | \
  139. TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
  140. $(MAKE) doc_gz
  141. $(RSYNC) -av doc/ $(RSYNC_DEST)/
  142. git ls-files | xargs touch
  143. endif
  144. # Create gzip variants of the same timestamp as the original so nginx
  145. # "gzip_static on" can serve the gzipped versions directly.
  146. doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
  147. doc_gz:
  148. for i in $(docs); do \
  149. gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
  150. check-warnings:
  151. @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
  152. do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
  153. .PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
  154. .PHONY: check-warnings