1#
2# Makefile for webalizer - a web server log analysis program
3#
4# Copyright (C) 1997-2013  Bradford L. Barrett
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version, and provided that the above
10# copyright and permission notice is included with all distributed
11# copies of this or derived software.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details (file "COPYING").
17#
18
19prefix          = @prefix@
20exec_prefix     = @exec_prefix@
21datadir         = @datarootdir@
22
23BINDIR          = @bindir@
24MANDIR          = @mandir@/man1
25ETCDIR          = @sysconfdir@
26GEODB           = @GEODB_LOC@
27CC              = @CC@
28CFLAGS          = @CFLAGS@ @CPPFLAGS@
29LIBS            = @LIBS@
30WCMGR_LIBS      = @WCMGR_LIBS@
31DEFS            = -DETCDIR=\"${ETCDIR}\" -DGEODB_LOC=\"${GEODB}\" @DEFS@ @OPTS@
32LDFLAGS         = @LDFLAGS@
33INSTALL         = @INSTALL@
34INSTALL_PROGRAM = @INSTALL_PROGRAM@
35INSTALL_DATA    = @INSTALL_DATA@
36DEFLANG         = @DEFAULT_LANG@
37
38# Shouldn't have to touch below here!
39
40all: webalizer wcmgr
41
42webalizer:	webalizer.o webalizer.h hashtab.o hashtab.h  \
43		linklist.o linklist.h preserve.o preserve.h  \
44                dns_resolv.o dns_resolv.h parser.o parser.h  \
45                output.o output.h graphs.o graphs.h lang.h   \
46		webalizer_lang.h
47	$(CC) ${LDFLAGS} -o webalizer webalizer.o hashtab.o linklist.o preserve.o parser.o output.o dns_resolv.o graphs.o ${LIBS}
48	rm -f webazolver
49	@LN_S@ webalizer webazolver
50
51webalizer.o:	webalizer.c webalizer.h parser.h output.h preserve.h \
52		graphs.h dns_resolv.h webalizer_lang.h
53	$(CC) ${CFLAGS} ${DEFS} -c webalizer.c
54
55parser.o:	parser.c parser.h webalizer.h lang.h
56	$(CC) ${CFLAGS} ${DEFS} -c parser.c
57
58hashtab.o:	hashtab.c hashtab.h dns_resolv.h webalizer.h lang.h
59	$(CC) ${CFLAGS} ${DEFS} -c hashtab.c
60
61linklist.o:	linklist.c linklist.h webalizer.h lang.h
62	$(CC) ${CFLAGS} ${DEFS} -c linklist.c
63
64output.o:	output.c output.h webalizer.h preserve.h \
65		hashtab.h graphs.h lang.h
66	$(CC) ${CFLAGS} ${DEFS} -c output.c
67
68preserve.o:	preserve.c preserve.h webalizer.h parser.h   \
69		hashtab.h graphs.h lang.h
70	$(CC) ${CFLAGS} ${DEFS} -c preserve.c
71
72dns_resolv.o:	dns_resolv.c dns_resolv.h lang.h webalizer.h
73	$(CC) ${CFLAGS} ${DEFS} -c dns_resolv.c
74
75graphs.o:	graphs.c graphs.h webalizer.h lang.h
76	$(CC) ${CFLAGS} ${DEFS} -c graphs.c
77
78wcmgr:	wcmgr.o
79	$(CC) ${LDFLAGS} -o wcmgr wcmgr.o ${WCMGR_LIBS}
80
81wcmgr.o:	wcmgr.c webalizer.h
82	$(CC) ${CFLAGS} ${DEFS} -c wcmgr.c
83
84clean:
85	rm -f webalizer webazolver wcmgr *.o usage*.png daily*.png hourly*.png
86	rm -f ctry*.png *.html *.hist *.current core *.gif
87
88distclean: clean
89	rm -f webalizer.conf *.tar *.tgz *.Z *.tar.gz
90	rm -f Makefile webalizer_lang.h config.cache config.log config.status
91	@LN_S@ lang/webalizer_lang.@DEFAULT_LANG@ webalizer_lang.h
92
93install: all
94	mkdir -p ${DESTDIR}${BINDIR}
95	mkdir -p ${DESTDIR}${MANDIR}
96	mkdir -p ${DESTDIR}${ETCDIR}
97	$(INSTALL_PROGRAM) webalizer ${DESTDIR}${BINDIR}/webalizer
98	$(INSTALL_PROGRAM) wcmgr ${DESTDIR}${BINDIR}/wcmgr
99	rm -f ${DESTDIR}${BINDIR}/webazolver
100	@LN_S@ webalizer ${DESTDIR}${BINDIR}/webazolver
101	$(INSTALL_DATA) webalizer.1 ${DESTDIR}${MANDIR}/webalizer.1
102	$(INSTALL_DATA) wcmgr.1 ${DESTDIR}${MANDIR}/wcmgr.1
103	rm -f ${DESTDIR}${MANDIR}/webazolver.1
104	@LN_S@ webalizer.1 ${DESTDIR}${MANDIR}/webazolver.1
105	$(INSTALL_DATA) sample.conf ${DESTDIR}${ETCDIR}/webalizer.conf.sample
106
107uninstall:
108	rm -f ${DESTDIR}${BINDIR}/webalizer
109	rm -f ${DESTDIR}${BINDIR}/webazolver
110	rm -f ${DESTDIR}${BINDIR}/wcmgr
111	rm -f ${DESTDIR}${MANDIR}/webalizer.1
112	rm -f ${DESTDIR}${MANDIR}/webazolver.1
113	rm -f ${DESTDIR}${MANDIR}/wcmgr.1
114	rm -f ${DESTDIR}${ETCDIR}/webalizer.conf.sample
115	rm -f webalizer_lang.h
116	@LN_S@ lang/webalizer_lang.${DEFLANG} webalizer_lang.h
117