1# frontends/www/Makefile
2#
3# RCS: $Id: Makefile,v 1.16 2006/02/22 17:25:32 gert Exp $
4#
5# $Log: Makefile,v $
6# Revision 1.16  2006/02/22 17:25:32  gert
7# remove "make fullclean", do everything in "make clean"
8#
9# Revision 1.15  2004/11/17 15:40:57  gert
10# create install directories if not present yet
11#
12# Revision 1.14  2004/11/17 15:07:50  gert
13# adapt path names to current MEDAT system (D3.0)
14# install *.gif images (if not yet installed)
15#
16# Revision 1.13  1998/12/04 15:56:44  gert
17# faxsend added
18#
19# Revision 1.12  1998/11/24 16:25:43  gert
20# add faxhists.in/cgi
21#
22# Revision 1.11  1998/11/22 10:16:14  gert
23# add dependencies for index-e.html
24#
25# Revision 1.10  1998/11/22 10:13:35  gert
26# fix sed/@CGI_HREF@ for empty definition
27#
28# Revision 1.9  1998/10/27 12:37:27  gert
29# new index page (english)
30#
31# Revision 1.8  1998/10/22 12:55:22  gert
32# add (first cut) 'make install' support
33#
34#...
35# Revision 1.1  1998/08/28 14:25:24  gert
36# initial release
37#
38
39CGI=faxq.cgi faxq-v.cgi faxhist.cgi faxhists.cgi \
40		viewfax.cgi nph-vf-gif.cgi faxsend.cgi
41HTML=index-d.html index-e.html
42IMAGES=delete.gif pfeild.gif pfeill.gif pfeilr.gif
43
44# the directory for the HTML file(s)
45# leave empty if you do not want to install the HTML files
46HTMLDIR=/david/html/quickfax/
47
48# the directory for the sample image files (left/right arrows, logo, ...)
49# (whether this is the same as HTMLDIR or not depends on local preferences,
50#  but don't forget to adapt the http path name in wwwgui.conf accordingly)
51IMAGEDIR=/stf/html/images/
52
53# this is the directory the CGI binaries will be installed in
54# check with your local webmaster or the WWW server documentation!
55CGIBINDIR=/david/html/quickfax/cgi-bin/
56
57# this is the logical path from the WWW root to the CGI binaries
58# (if the CGI binaries are in the same directory as "index.html", just
59# leave it empty: CGI_HREF="")
60CGI_HREF=/cgi-bin/
61# CGI_HREF=""
62
63all: $(CGI) $(HTML) wwwgui.conf
64
65clean:
66	rm -f $(CGI)
67	rm -f $(HTML)
68	rm -f wwwgui.conf
69
70# install from here is ugly, 'cause we have to go "up" to get LIBDIR etc.
71install: all
72	@echo "automatic installation largely untested - expect problems"
73	sleep 5
74	cd ../.. ; $(MAKE) install.www
75
76install.www:
77	test -d $(CGIBINDIR) || \
78		mkdir -p $(CGIBINDIR)
79	test -d $(IMAGEDIR) || \
80		mkdir -p $(IMAGEDIR)
81	test -d $(HTMLDIR) || \
82		mkdir -p $(HTMLDIR)
83	-@for i in $(CGI); do \
84		echo "$$i -> $(CGIBINDIR)..." ; \
85		mv -f $(CGIBINDIR)/$$i $(CGIBINDIR)/$$i.old 2>/dev/null ; \
86		$(INSTALL) -m 755 $$i $(CGIBINDIR) ; \
87	done
88	-@for i in $(IMAGES); do \
89		echo "$$i -> $(IMAGEDIR)..." ; \
90		test -f $(IMAGEDIR)/$$i || \
91		    $(INSTALL) -m 644 $$i $(IMAGEDIR) ; \
92	done
93	test -z "$(HTMLDIR)" || \
94	    for i in $(HTML); do \
95		test -f $(HTMLDIR)/$$i || \
96		    $(INSTALL) -m 644 $$i $(HTMLDIR) ; \
97	    done
98	test -f $(CONFDIR)/wwwgui.conf || \
99		$(INSTALL) -o root -m 644 wwwgui.conf $(CONFDIR)/
100	$(INSTALL) -m 755 simplequant.pl $(LIBDIR)/
101	$(INSTALL) -m 755 wwwsub.pl $(LIBDIR)/
102
103# explicit dependencies
104
105faxq.cgi: faxq.in ../../sedscript
106faxq-v.cgi: faxq-v.in ../../sedscript
107index-d.html: index-d.in ../../sedscript Makefile
108index-e.html: index-e.in ../../sedscript Makefile
109faxhist.cgi: faxhist.in ../../sedscript
110faxhists.cgi: faxhists.in ../../sedscript
111viewfax.cgi: viewfax.in ../../sedscript
112nph-vf-gif.cgi: nph-vf-gif.in ../../sedscript
113vf-faxov.cgi: vf-faxov.in ../../sedscript
114service.cgi: service.in ../../sedscript
115faxsend.cgi: faxsend.in ../../sedscript
116
117wwwgui.conf: wwwgui.cfg.in ../../sedscript
118	../../sedscript <wwwgui.cfg.in >wwwgui.conf
119
120../../sedscript: ../../policy.h ../../Makefile ../../mksed.c
121	@cd ../.. ; $(MAKE) sedscript
122
123#
124# inference rules for creating CGI binaries / HTML pages from *.in files
125#
126.SUFFIXES: .in .cgi .html
127
128.in.cgi:
129	rm -f $*.cgi
130	../../sedscript <$< >$*.cgi
131	chmod +x $*.cgi
132
133.in.html:
134	rm -f $*.html
135	../../sedscript <$< | \
136		sed -e "s!@CGI_HREF@!$(CGI_HREF)!" >$*.html
137
138