1# Makefile for `wget' utility
2# Copyright (C) 1995, 1996, 1997, 2007, 2008, 2009 Free Software
3# Foundation, Inc.
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18#
19# Version: @VERSION@
20#
21
22# Program to convert DVI files to PostScript
23DVIPS = dvips -D 300
24# Program to convert texinfo files to html
25TEXI2HTML = texi2html -expandinfo -split_chapter
26
27manext     = 1
28RM = rm -f
29
30TEXI2POD     = $(srcdir)/texi2pod.pl
31POD2MAN      = @POD2MAN@
32MAN          = wget.$(manext)
33WGETRC       = $(sysconfdir)/wgetrc
34SAMPLERCTEXI = sample.wgetrc.munged_for_texi_inclusion
35
36#
37# Dependencies for building
38#
39
40man_MANS = $(MAN)
41
42all: wget.info @COMMENT_IF_NO_POD2MAN@$(MAN)
43
44everything: all wget_us.ps wget_a4.ps wget_toc.html
45
46$(SAMPLERCTEXI): $(srcdir)/sample.wgetrc
47	sed s/@/@@/g $? > $@
48
49info_TEXINFOS = wget.texi
50wget_TEXINFOS = fdl.texi sample.wgetrc.munged_for_texi_inclusion
51
52EXTRA_DIST = sample.wgetrc \
53	     $(SAMPLERCTEXI) \
54	     texi2pod.pl
55
56wget.pod: $(srcdir)/wget.texi version.texi
57	$(TEXI2POD) $(srcdir)/wget.texi $@
58
59$(MAN): wget.pod
60	$(POD2MAN) --center="GNU Wget" --release="GNU Wget @VERSION@" $? > $@
61
62#wget.cat: $(MAN)
63#	nroff -man $? > $@
64
65wget_us.ps: wget.dvi
66	$(DVIPS) -t letter -o $@ wget.dvi
67
68wget_a4.ps: wget.dvi
69	$(DVIPS) -t a4 -o $@ wget.dvi
70
71wget_toc.html: $(srcdir)/wget.texi
72	$(TEXI2HTML) $(srcdir)/wget.texi
73
74#
75# Dependencies for installing
76#
77
78# install all the documentation
79install-data-local: install.wgetrc @COMMENT_IF_NO_POD2MAN@install.man
80
81# uninstall all the documentation
82uninstall-local: @COMMENT_IF_NO_POD2MAN@uninstall.man
83
84
85# install man page, creating install directory if necessary
86install.man: $(MAN)
87	$(mkinstalldirs) $(DESTDIR)$(mandir)/man$(manext)
88	$(INSTALL_DATA) $(MAN) $(DESTDIR)$(mandir)/man$(manext)/$(MAN)
89
90# install sample.wgetrc
91install.wgetrc: $(srcdir)/sample.wgetrc
92	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
93	@if test -f $(DESTDIR)$(WGETRC); then \
94	  if cmp -s $(srcdir)/sample.wgetrc $(DESTDIR)$(WGETRC); then echo ""; \
95	     else \
96	     echo ' $(INSTALL_DATA) $(srcdir)/sample.wgetrc $(DESTDIR)$(WGETRC).new'; \
97	     $(INSTALL_DATA) $(srcdir)/sample.wgetrc $(DESTDIR)$(WGETRC).new; \
98	     echo; \
99	     echo "WARNING: Differing \`$(DESTDIR)$(WGETRC)'"; \
100	     echo "         exists and has been spared.  You might want to"; \
101	     echo "         consider merging in the new lines from"; \
102	     echo "         \`$(DESTDIR)$(WGETRC).new'."; \
103	     echo; \
104	  fi; \
105	else \
106	  $(INSTALL_DATA) $(srcdir)/sample.wgetrc $(DESTDIR)$(WGETRC); \
107	fi
108
109# uninstall man page
110uninstall.man:
111	$(RM) $(DESTDIR)$(mandir)/man$(manext)/$(MAN)
112
113#
114# Dependencies for cleanup
115#
116
117CLEANFILES = *~ *.bak *.cat *.pod
118DISTCLEANFILES = $(MAN)
119