1# -*-Makefile-*-
2# This Makefile fragment is shared between fileutils, sh-utils, textutils.
3
4maintainer-check:
5	if head ChangeLog| grep 'Version $(VERSION)' > /dev/null; then \
6	  :; \
7	else \
8	  echo "$(VERSION) not in ChangeLog; not tagging" 1>&2; \
9	  exit 1; \
10	fi
11	$(MAKE) distcheck
12	$(MAKE) my-distcheck
13
14# Tag before making distribution.  Also, don't make a distribution if
15# checks fail.  Also, make sure the NEWS file is up-to-date.
16# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
17cvs-dist: maintainer-check
18	pkg=`echo "$(PACKAGE)" | tr a-z A-Z`; \
19	ver=`echo "$(VERSION)" | sed 's/\./_/g'`; \
20	tag="$$pkg-$$ver"; \
21	echo tag=$$tag; \
22	if cvs -n log -h README| grep -e $$tag: > /dev/null; then \
23	  echo "VERSION not new; not tagging" 1>&2; \
24	  exit 1; \
25	fi; \
26	cvs update po; \
27	cvs tag -c $$tag
28	$(MAKE) dist
29
30t=./=test
31my-distcheck:
32	-rm -rf $(t)
33	mkdir $(t)
34	GZIP=$(GZIP) $(TAR) -C $(t) -zxf $(distdir).tar.gz
35	cd $(t)/$(distdir) \
36	  && ./configure --with-gd=no --with-qt=no --with-tutorial \
37	  && $(MAKE) CFLAGS='-Wformat -Werror' \
38	  && $(MAKE) check \
39	  && $(MAKE) distclean
40	cd $(t) && mv $(distdir) $(distdir).old \
41	  && $(TAR) -zxf ../$(distdir).tar.gz
42	diff -ur $(t)/$(distdir).old $(t)/$(distdir)
43	-rm -rf $(t)
44	@echo "========================"; \
45	echo "$(distdir).tar.gz is ready for distribution"; \
46	echo "========================"
47
48THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
49# FIXME: this works only for Gnits-style test releases.
50PREV_VERSION := $(shell echo $(VERSION)|tr a-z Xa-y)
51PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
52v = Version
53url-host-prefix = ftp://ftp.ucc.ie/
54url = $(url-host-prefix)/pub/gnuplot/$(distdir).tar.gz
55md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/  -//')
56
57rel-check:
58	tarz=/tmp/rel-check-tarz-$$$$; \
59	md5_tmp=/tmp/rel-check-md5-$$$$; \
60	set -e; \
61	trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
62	wget -q --output-document=$$tarz $(url); \
63	echo "$(md5)  -" > $$md5_tmp; \
64	md5sum -c $$md5_tmp < $$tarz
65
66announcement: NEWS ChangeLog $(distdir).tar.gz
67	@( \
68	  echo Subject: $(distdir) released; \
69	  echo; \
70	  echo FIXME: put comments here; \
71	  echo; \
72	  echo "  $(url)"; \
73	  echo; \
74	  echo "$(md5)  $(distdir).tar.gz"; \
75	  echo; \
76	  echo NEWS:; \
77	  sed -n "/$(THIS_VERSION_REGEXP)/,/$(PREV_VERSION_REGEXP)/p" NEWS \
78	    | grep -v '^\['; \
79	  echo; \
80	  echo ChangeLog entries:; \
81	  sed -n "1,/$v $(PREV_VERSION_REGEXP)/p" \
82	    ChangeLog; \
83	)
84
85alpha:
86	$(MAKE) cvs-dist
87	$(MAKE) -s announcement > /tmp/announcement
88	ln $(distdir).tar.gz ../release
89	chmod a-w $(distdir).tar.gz
90	@echo =====================================
91	@echo 'ncftp -u $(url-host-prefix)/fs/share/ftp/gnu/fetish/'
92	@echo '#   put $(distdir).tar.gz'
93	@echo '# send the /tmp/announcement e-mail'
94	@echo 'pot-mail $(distdir).tar.gz | bash'
95	@echo =====================================
96
97amfiles:
98	for subdir in config demo m4 term tutorial ; do \
99	  make -C $$subdir -f Makefile.am.in Makefile.am ; \
100	done
101
102ReleaseNotes.html: RELEASE_NOTES
103	txt2html -pm --style_url ReleaseNotes.css RELEASE_NOTES \
104	         --outfile ReleaseNotes.html
105