clogger.git  about / heads / tags
configurable request logging for Rack
blob 1d88a9fd9ec27d1fdc6617af92e3fd49e1c4e93e 3262 bytes (raw)
$ git show v0.0.6:GNUmakefile	# shows this blob on the CLI

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
 
all:: test
ruby = ruby
rake = rake

-include local.mk

ifeq ($(DLEXT),) # "so" for Linux
  DLEXT := $(shell $(ruby) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
endif

ext/clogger_ext/Makefile: ext/clogger_ext/clogger.c ext/clogger_ext/extconf.rb
	cd ext/clogger_ext && $(ruby) extconf.rb

ext/clogger_ext/clogger.$(DLEXT): ext/clogger_ext/Makefile
	$(MAKE) -C ext/clogger_ext

clean:
	-$(MAKE) -C ext/clogger_ext clean
	$(RM) ext/clogger_ext/Makefile lib/clogger_ext.$(DLEXT)

test-ext: ext/clogger_ext/clogger.$(DLEXT)
	$(ruby) -Iext/clogger_ext:lib test/test_clogger.rb

test-pure:
	CLOGGER_PURE=t $(ruby) -Ilib test/test_clogger.rb

test: test-ext test-pure

History:
	$(rake) -s history > $@+
	mv $@+ $@

.manifest: History
	(git ls-files; for i in $^ $@; do echo $$i; done) | LC_ALL=C sort > $@+
	mv $@+ $@

VERSION := $(shell git describe 2>/dev/null | sed 's/^v//')

ifneq ($(VERSION),)
v := /^v$(VERSION)$$/
vPREV := $(shell git tag -l 2>/dev/null | sed -n -e '$(v)!h' -e '$(v){x;p;q}')
release_notes := release_notes-$(VERSION).txt
release_changes := release_changes-$(VERSION).txt
release-notes: $(release_notes)
release-changes: $(release_changes)
$(release_changes): verify
	git diff --stat $(vPREV) v$(VERSION) > $@+
	echo >> $@+
	git log $(vPREV)..v$(VERSION) >> $@+
	$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
$(release_notes): verify package
	gem spec pkg/clogger-$(VERSION).gem description | sed -ne '/\w/p' > $@+
	echo >> $@+
	git cat-file tag v$(VERSION) | awk 'p>1{print $$0}/^$$/{++p}' >> $@+
	$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
verify:
	@test -n "$(VERSION)" || { echo >&2 VERSION= not defined; exit 1; }
	git rev-parse --verify refs/tags/v$(VERSION)^{}
	@test -n "$(VISUAL)" || { echo >&2 VISUAL= not defined; exit 1; }
	git diff-index --quiet HEAD^0
	test `git rev-parse --verify HEAD^0` = \
	     `git rev-parse --verify refs/tags/v$(VERSION)^{}`

pkg/clogger-$(VERSION).gem: .manifest History clogger.gemspec
	gem build clogger.gemspec
	mkdir -p pkg
	mv $(@F) $@

pkg/clogger-$(VERSION).tgz: HEAD = v$(VERSION)
pkg/clogger-$(VERSION).tgz: .manifest History
	$(RM) -r $(basename $@)
	git archive --format=tar --prefix=$(basename $@)/ $(HEAD) | tar xv
	install -m644 $^ $(basename $@)
	cd pkg && tar cv $(basename $(@F)) | gzip -9 > $(@F)+
	mv $@+ $@

package: pkg/clogger-$(VERSION).gem pkg/clogger-$(VERSION).tgz

# not using Hoe's release system since we release 2 gems but only one tgz
release: package $(release_notes) $(release_changes)
	rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
	  clogger clogger $(VERSION) pkg/clogger-$(VERSION).gem
	rubyforge add_file \
	  clogger clogger $(VERSION) pkg/clogger-$(VERSION).tgz
endif

doc: .document History
	rdoc -Na -t "$(shell sed -ne '1s/^= //p' README)"
	install -m644 COPYING doc/COPYING
	cd doc && ln README.html tmp.html && mv tmp.html index.html

# publishes docs to http://clogger.rubyforge.org/
# this preserves timestamps as best as possible to help HTTP caches out
# git set-file-times can is here: http://git-scm.org/gitwiki/ExampleScripts
publish_doc:
	git set-file-times
	$(RM) -r doc
	$(MAKE) doc
	rsync -av --delete doc/ rubyforge.org:/var/www/gforge-projects/clogger/
	git ls-files | xargs touch

.PHONY: test doc .manifest release History

git clone https://yhbt.net/clogger.git