Lots of changes. They aren't visible though.
[egate.git] / www / Makefile
1 # Makefile for www gateway utility
2 # Europagate, 1995
3 #
4 # $Id: Makefile,v 1.34 1996/03/07 12:46:07 adam Exp $
5 #
6 SHELL=/bin/sh
7
8 ZLIB=../../yaz/lib/libyaz.a
9
10 IRTCLDIR=../../ir-tcl
11 IRTCLLIB=$(IRTCLDIR)/libirtcl.a
12 IRTCLINC=-I$(IRTCLDIR)
13
14 #MOSILIB=../../xtimosi/src/libmosi.a ../../yaz/lib/librfc.a
15 #NETLIB=-lnsl -lsocket
16
17 OLIB=../lib/util.a ../lib/libres+log.a 
18 TCLLIB=/usr/local/lib/libtcl7.5.a
19 TCLINC=
20
21 WSCRIPTS=egwscript targets.egw query.egw search.egw showfull.egw z39util.tcl \
22  mtargets.egw mquery.egw msearch.egw history.egw tform.egw tdefine.egw sameas.egw
23 HSCRIPTS=egwindex.html
24 CONFFILES=egw.res ztargets.conf
25 TPROG1=egwcgi
26 TPROG2=egwsh
27 TPROG3=wtest
28 TPROG4=egwwais
29 P1=wcgi.o
30 P2=wproto.o winterp.o wsh.o wtcl.o whtml.o wirtcl.o wshmain.o
31 P3=wproto.o wtest.o
32 P4=wproto.o winterp.o waissh.o wtcl.o wirtcl.o wshmain.o wwaistcl.o
33 CPP=$(CC) -E
34
35 HTTPDDIR=/usr/local/etc/httpd
36 CGIDIR=$(HTTPDDIR)/cgi-bin
37 HTDOCS=$(HTTPDDIR)/htdocs
38 EGWDIR=$(HTTPDDIR)/egw
39 LOGDIR=$(HTTPDDIR)/logs
40 GIFDIR=$(HTDOCS)/egwgif
41
42 #HTTPDDIR=/usr/local/www
43 #CGIDIR=/usr/local/www/cgi-bin
44 #HTDOCS=/data2/html/egw/html
45 #EGWDIR=/data2/html/egw/scripts
46 #LOGDIR=/data2/html/egw/logs
47 #GIFDIR=/data2/html/egw/gif
48
49 INCLUDE=-I../include $(TCLINC) $(IRTCLINC)
50 DEFS=$(INCLUDE) $(ZDEFS) -DEGWDIR=\"$(EGWDIR)\"
51
52 all: $(TPROG1) $(TPROG2)
53
54 $(TPROG1): $(P1) $(OLIB)
55         $(CC) $(CFLAGS) -o $(TPROG1) $(P1) $(OLIB)
56
57 $(TPROG2): $(P2) $(OLIB)
58         $(CC) $(CFLAGS) -o $(TPROG2) $(P2) $(OLIB) $(IRTCLLIB) \
59                 $(ZLIB) $(MOSILIB) $(NETLIB) $(TCLLIB) -lm
60
61 $(TPROG3): $(P3) $(OLIB)
62         $(CC) $(CFLAGS) -o $(TPROG3) $(P3) $(OLIB)
63
64
65 WAISDIR=../../freeWAIS-sf-2.0
66 WAISLIB=$(IRTCLDIR)/wais-tcl.o $(WAISDIR)/ir/libwais.a
67
68 $(TPROG4): $(P4) $(OLIB)
69         $(CC) $(CFLAGS) -o $(TPROG4) $(P4) \
70                 $(OLIB) $(IRTCLLIB) \
71                 $(WAISLIB) $(ZLIB) $(MOSILIB) $(NETLIB) $(TCLLIB) -lm
72
73 install: install.prog install.script install.gif
74
75 install.prog: $(TPROG1) $(TPROG2)
76         @if [ ! -d $(CGIDIR) ]; then \
77                 echo "Making directory $(CGIDIR)"; \
78                 mkdir $(CGIDIR); \
79         fi        
80         @if [ ! -d $(EGWDIR) ]; then \
81                 echo "Making directory $(EGWDIR)"; \
82                 mkdir $(EGWDIR); \
83         fi        
84         @for x in $(TPROG1); do \
85                 echo Installing $$x; \
86                 cp $$x $(CGIDIR); \
87                 chmod a+x $(CGIDIR)/$$x; \
88         done; \
89         for x in $(TPROG2); do \
90                 echo Installing $$x; \
91                 cp $$x $(EGWDIR); \
92                 chmod a+x $(EGWDIR)/$$x; \
93         done; \
94         for p in egwtcl egwirtcl egwhtml; do \
95                 rm -f $(EGWDIR)/$$p; \
96                 ln $(EGWDIR)/$(TPROG2) $(EGWDIR)/$$p; \
97         done
98         @if [ -x $(TPROG4) ]; then \
99                 echo Installing $(TPROG4); \
100                 cp $(TPROG4) $(EGWDIR)/$(TPROG4); \
101                 chmod a+x $(EGWDIR)/$(TPROG4); \
102         fi
103
104 install.script:
105         @if [ ! -d $(EGWDIR) ]; then \
106                 echo "Making directory $(EGWDIR)"; \
107                 mkdir $(EGWDIR); \
108         fi        
109         @if [ ! -d $(HTDOCS) ]; then \
110                 echo "Making directory $(HTDOCS)"; \
111                 mkdir $(HTDOCS); \
112         fi        
113         @for x in $(WSCRIPTS); do \
114                 echo Installing $$x; \
115                 cp $$x $(EGWDIR)/$$x; \
116         done
117         @for x in $(HSCRIPTS); do \
118                 echo Installing $$x; \
119                 cp $$x $(HTDOCS); \
120         done
121         @for x in $(CONFFILES); do \
122                 echo Installing $$x; \
123                 cp $$x $(EGWDIR); \
124         done
125
126 install.gif:
127         @if [ ! -d $(GIFDIR) ]; then \
128                 echo "Making directory $(GIFDIR)"; \
129                 mkdir $(GIFDIR); \
130         fi        
131         @for x in gif/*.gif; do \
132                 echo Installing $$x; \
133                 cp $$x $(GIFDIR); \
134         done
135
136 .c.o:
137         $(CC) -c $(DEFS) $(CFLAGS) $<
138
139 clean:
140         rm -f *.log *.[oa] $(TPROG1) $(TPROG2) $(TPROG3) 
141         rm -f core mon.out gmon.out errlist *~
142
143 depend: depend2
144
145 depend1:
146         sed '/^#Depend/q' <Makefile >Makefile.tmp
147         $(CPP) $(DEFS) -M *.c >>Makefile.tmp
148         mv -f Makefile.tmp Makefile
149
150 depend2:
151         $(CPP) $(DEFS) -M *.c >.depend  
152
153 #GNU make style depend
154 ifeq (.depend,$(wildcard .depend))
155 include .depend
156 endif
157
158 #Depend --- DOT NOT DELETE THIS LINE