RDoc fixups
[clogger.git] / GNUmakefile
blobcfe11bc5e6dab43f6837c456e3d3d88da2326bcd
1 all:: test
2 RUBY = ruby
3 RAKE = rake
4 RSYNC = rsync
6 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7 @./GIT-VERSION-GEN
8 -include GIT-VERSION-FILE
9 -include local.mk
11 ifeq ($(DLEXT),) # "so" for Linux
12 DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
13 endif
15 ext/clogger_ext/Makefile: ext/clogger_ext/clogger.c ext/clogger_ext/extconf.rb
16 cd ext/clogger_ext && $(RUBY) extconf.rb
18 ext/clogger_ext/clogger.$(DLEXT): ext/clogger_ext/Makefile
19 $(MAKE) -C ext/clogger_ext
21 clean:
22 -$(MAKE) -C ext/clogger_ext clean
23 $(RM) ext/clogger_ext/Makefile lib/clogger_ext.$(DLEXT)
25 test_unit := $(wildcard test/test_*.rb)
26 test-unit: $(test_unit)
28 ifeq ($(CLOGGER_PURE),)
29 $(test_unit): mylib := ext/clogger_ext:lib
30 $(test_unit): ext/clogger_ext/clogger.$(DLEXT)
31 else
32 $(test_unit): mylib := lib
33 endif
35 $(test_unit):
36 $(RUBY) -I $(mylib) $@
38 test-ext:
39 CLOGGER_PURE= $(MAKE) test-unit
41 test-pure:
42 CLOGGER_PURE=1 $(MAKE) test-unit
44 test: test-ext test-pure
46 pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST
47 manifest: $(pkg_extra)
48 $(RM) .manifest
49 $(MAKE) .manifest
51 .manifest:
52 (git ls-files && \
53 for i in $@ $(pkg_extra); \
54 do echo $$i; done) | LC_ALL=C sort > $@+
55 cmp $@+ $@ || mv $@+ $@
56 $(RM) $@+
58 ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
59 wrongdoc prepare
61 doc: .document .wrongdoc.yml
62 find lib ext -type f -name '*.rbc' -exec rm -f '{}' ';'
63 $(RM) -r doc
64 wrongdoc all
65 install -m644 COPYING doc/COPYING
66 install -m644 $(shell grep '^[A-Z]' .document) doc/
68 # publishes docs to http://clogger.rubyforge.org/
69 # this preserves timestamps as best as possible to help HTTP caches out
70 # git set-file-times is here: http://git-scm.org/gitwiki/ExampleScripts
71 publish_doc:
72 -git set-file-times
73 $(MAKE) doc
74 -find doc/images -type f | \
75 TZ=UTC xargs touch -d '1970-01-01 00:00:03' doc/rdoc.css
76 $(RSYNC) -av doc/ rubyforge.org:/var/www/gforge-projects/clogger/
77 git ls-files | xargs touch
79 ifneq ($(VERSION),)
80 rfproject := clogger
81 rfpackage := clogger
82 pkggem := pkg/$(rfpackage)-$(VERSION).gem
83 pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
84 release_notes := release_notes-$(VERSION)
85 release_changes := release_changes-$(VERSION)
87 release-notes: $(release_notes)
88 release-changes: $(release_changes)
89 $(release_changes):
90 wrongdoc release_changes > $@+
91 $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
92 $(release_notes):
93 wrongdoc release_notes > $@+
94 $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
96 # ensures we're actually on the tagged $(VERSION), only used for release
97 verify:
98 test x"$(shell umask)" = x0022
99 git rev-parse --verify refs/tags/v$(VERSION)^{}
100 git diff-index --quiet HEAD^0
101 test `git rev-parse --verify HEAD^0` = \
102 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
104 fix-perms:
105 -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
106 -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
108 gem: $(pkggem)
110 install-gem: $(pkggem)
111 gem install $(CURDIR)/$<
113 $(pkggem): manifest fix-perms
114 gem build $(rfpackage).gemspec
115 mkdir -p pkg
116 mv $(@F) $@
118 $(pkgtgz): distdir = $(basename $@)
119 $(pkgtgz): HEAD = v$(VERSION)
120 $(pkgtgz): manifest fix-perms
121 @test -n "$(distdir)"
122 $(RM) -r $(distdir)
123 mkdir -p $(distdir)
124 tar cf - `cat .manifest` | (cd $(distdir) && tar xf -)
125 cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
126 mv $@+ $@
128 package: $(pkgtgz) $(pkggem)
130 release: verify package $(release_notes) $(release_changes)
131 rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
132 $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
133 gem push $(pkggem)
134 rubyforge add_file \
135 $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
136 $(RAKE) publish_news VERSION=$(VERSION)
137 else
138 gem install-gem: GIT-VERSION-FILE
139 $(MAKE) $@ VERSION=$(GIT_VERSION)
140 endif
142 .PHONY: .FORCE-GIT-VERSION-FILE test doc manifest
143 .PHONY: test test-ext test-pure $(test_unit)