Browse Source

Makefile: set VERSION properly on release.

Heikki Hokkanen 16 years ago
parent
commit
4042ac12e7
2 changed files with 6 additions and 3 deletions
  1. 6
    2
      Makefile
  2. 0
    1
      doc/TODO.txt

+ 6
- 2
Makefile View File

4
 RESOURCES=gitstats.css sortable.js *.gif
4
 RESOURCES=gitstats.css sortable.js *.gif
5
 BINARIES=gitstats
5
 BINARIES=gitstats
6
 VERSION=$(shell git describe 2>/dev/null || git rev-parse --short HEAD)
6
 VERSION=$(shell git describe 2>/dev/null || git rev-parse --short HEAD)
7
+SEDVERSION=sed -i 's/VERSION = 0/VERSION = "$(VERSION)"/'
7
 
8
 
8
 all: help
9
 all: help
9
 
10
 
19
 	install -d $(BINDIR) $(RESOURCEDIR)
20
 	install -d $(BINDIR) $(RESOURCEDIR)
20
 	install -v $(BINARIES) $(BINDIR)
21
 	install -v $(BINARIES) $(BINDIR)
21
 	install -v -m 644 $(RESOURCES) $(RESOURCEDIR)
22
 	install -v -m 644 $(RESOURCES) $(RESOURCEDIR)
22
-	sed -i 's/VERSION = 0/VERSION = "$(VERSION)"/' $(BINDIR)/gitstats
23
+	$(SEDVERSION) $(BINDIR)/gitstats
23
 
24
 
24
 release:
25
 release:
25
-	@tar --owner=0 --group=0 --transform 's!^!gitstats/!' -zcf gitstats-$(VERSION).tar.gz $(BINARIES) $(RESOURCES) doc/ Makefile
26
+	@cp gitstats gitstats.tmp
27
+	@$(SEDVERSION) gitstats.tmp
28
+	@tar --owner=0 --group=0 --transform 's!^!gitstats/!' --transform 's!gitstats.tmp!gitstats!' -zcf gitstats-$(VERSION).tar.gz gitstats.tmp $(RESOURCES) doc/ Makefile
29
+	@$(RM) gitstats.tmp
26
 
30
 
27
 .PHONY: all help install release
31
 .PHONY: all help install release

+ 0
- 1
doc/TODO.txt View File

1
 []
1
 []
2
-- Makefile: 'release' target does not replace "VERSION" in binary
3
 
2
 
4
 - https://sourceforge.net/tracker/index.php?func=detail&aid=2865754&group_id=203965&atid=987714
3
 - https://sourceforge.net/tracker/index.php?func=detail&aid=2865754&group_id=203965&atid=987714
5
 	- gitstats is a great tool, but the one thing that I miss is the number of
4
 	- gitstats is a great tool, but the one thing that I miss is the number of