Add 'make dist' target to get a tarball to test in addition to the upload target.
[sysvinit.git] / Makefile
1 all install clean distclean:
2 $(MAKE) -C src $@
3
4 PACKAGE=sysvinit
5 VERSION=$(shell sed -rn '1s/.*[[:blank:]]\((.*)\)[[:blank:]].*/\1/p' doc/Changelog)
6 SVLOGIN=$(shell svn info | sed -rn '/Repository Root:/{ s|.*//(.*)\@.*|\1|p }')
7 override TMP:=$(shell mktemp -d $(VERSION).XXXXXXXX)
8 override TARBALL:=$(TMP)/$(PACKAGE)-$(VERSION).tar.bz2
9 override SFTPBATCH:=$(TMP)/$(VERSION)-sftpbatch
10
11 dist: $(TARBALL)
12 @cp $(TARBALL) .
13 @echo "tarball $(PACKAGE)-$(VERSION).tar.bz2 ready"
14 rm -rf $(TMP)
15
16 upload: $(SFTPBATCH)
17 echo @sftp -b $< $(SVLOGIN)@dl.sv.nongnu.org:/releases/$(PACKAGE)
18 rm -rf $(TMP)
19
20 $(SFTPBATCH): $(TARBALL).sig
21 @echo progress > $@
22 @echo put $(TARBALL) >> $@
23 @echo chmod 664 $(notdir $(TARBALL)) >> $@
24 @echo put $(TARBALL).sig >> $@
25 @echo chmod 664 $(notdir $(TARBALL)).sig >> $@
26 @echo rm $(PACKAGE)-latest.tar.bz2 >> $@
27 @echo symlink $(notdir $(TARBALL)) $(PACKAGE)-latest.tar.bz2 >> $@
28 @echo quit >> $@
29
30 $(TARBALL).sig: $(TARBALL)
31 @gpg -q -ba --use-agent -o $@ $<
32
33 $(TARBALL): $(TMP)/$(PACKAGE)-$(VERSION)
34 @tar --bzip2 --owner=nobody --group=nogroup -cf $@ -C $(TMP) $(PACKAGE)-$(VERSION)
35
36 $(TMP)/$(PACKAGE)-$(VERSION): .svn
37 svn export . $@
38 @chmod -R a+r,u+w,og-w $@
39 @find $@ -type d | xargs -r chmod a+rx,u+w,og-w