1# Copyright (C) 2000-2016 Boris Wesslowski
2# $Id: Makefile 741 2016-02-19 14:35:50Z bw $
3
4# You might want to add -DSHORT_NAMES to CFLAGS if you only intend to analyze
5# log formats with short list/chain/branch/interface names like ipchains.
6# You can also add -DLOGDOTS if your Cisco log host logs FQDNs and you only
7# want the host names in the output.
8# -DHAVE_ZLIB enables support for gzip compressed files.
9# -DHAVE_GETTEXT enables localization support.
10# -DHAVE_ADNS enables support for asynchronous DNS lookups.
11# -DHAVE_GEOIP enables support for GeoIP database lookups.
12
13# Linux
14#CC = gcc
15#CFLAGS = -DHAVE_ZLIB -DHAVE_GETTEXT -pipe -O2 -Wall #-pedantic -Wpointer-arith #-g #-p
16#LDFLAGS = -s #-g #-static -p
17#LIBS = -lcrypt -lz #-ladns -lGeoIP #-lc_p
18
19# Mac OS X
20#CC = gcc
21#CFLAGS = -DHAVE_ZLIB -pipe -O2 -Wall
22#LIBS = -lz
23
24# Solaris
25#LIBS = -lnsl -lsocket -lcrypt -lz
26#
27#CC = gcc
28#CFLAGS = -DSOLARIS -DHAVE_ZLIB -DHAVE_GETTEXT -pipe -O2 -Wall #-pedantic #-g
29#LDFLAGS = #-g
30#
31#CC = cc
32#CFLAGS = -DSOLARIS -DHAVE_ZLIB -DHAVE_GETTEXT -v -fast -xCC
33
34# OpenBSD
35#CC = gcc
36#CFLAGS = -DHAVE_ZLIB -DHAVE_GETTEXT -pipe -O2 -Wall -I/usr/local/include
37#LIBS = -L/usr/local/lib -lz -lintl
38
39# FreeBSD
40CC = cc
41CFLAGS = -DHAVE_ZLIB -DHAVE_GETTEXT -pipe -O2 -Wall -I/usr/local/include
42LIBS = -L/usr/local/lib -lcrypt -lz -lintl
43
44
45LEX = flex
46LFLAGS = -B --nounput #-f #-p -p -d
47
48INSTALL_PROGRAM = ${BSD_INSTALL_PROGRAM}
49INSTALL_SCRIPT = ${BSD_INSTALL_SCRIPT}
50INSTALL_DATA = ${BSD_INSTALL_DATA}
51INSTALL_DIR = ${DESTDIR}${PREFIX}
52CONF_DIR = ${INSTALL_DIR}/etc
53LOCALE_DIR = ${INSTALL_DIR}
54
55
56OBJS = cisco_ios.o cisco_pix.o compare.o ipchains.o ipfilter.o ipfw.o \
57       lancom.o main.o modes.o net.o netfilter.o netscreen.o output.o \
58       parser.o rcfile.o resolve.o response.o snort.o utils.o whois.o
59
60all:	fwlogwatch
61
62cisco_ios.o:	main.h utils.h
63cisco_pix.o:	main.h utils.h
64compare.o:	compare.h main.h output.h utils.h
65ipchains.o:	main.h utils.h
66ipfilter.o:	main.h utils.h
67ipfw.o:		main.h utils.h
68lancom.o:	main.h utils.h
69main.o:		main.h modes.h parser.h rcfile.h utils.h
70modes.o:	compare.h main.h net.h output.h parser.h rcfile.h \
71		resolve.h response.h utils.h whois.h
72net.o:		compare.h main.h output.h resolve.h response.h utils.h
73netfilter.o:	main.h utils.h
74netscreen.o:	main.h utils.h
75output.o:	main.h output.h resolve.h utils.h whois.h
76parser.o:	cisco_ios.h cisco_pix.h compare.h ipchains.h ipfilter.h \
77		ipfw.h main.h netfilter.h netscreen.h parser.h snort.h
78rcfile.o:	main.h parser.h rcfile.h utils.h
79resolve.o:	main.h resolve.h utils.h
80response.o:	main.h response.h utils.h
81snort.o:	main.h utils.h
82utils.o:	main.h
83whois.o:	main.h utils.h
84
85fwlogwatch:	$(OBJS)
86	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
87
88install:	all
89	$(INSTALL_PROGRAM) fwlogwatch $(INSTALL_DIR)/sbin/fwlogwatch
90	$(INSTALL_SCRIPT) contrib/fwlw_notify $(INSTALL_DIR)/sbin/fwlw_notify
91	$(INSTALL_SCRIPT) contrib/fwlw_respond $(INSTALL_DIR)/sbin/fwlw_respond
92	$(INSTALL_DATA) fwlogwatch.8 $(INSTALL_DIR)/man/man8/fwlogwatch.8
93
94install-config:
95	$(INSTALL_DATA) fwlogwatch.config $(CONF_DIR)/fwlogwatch.config
96
97install-i18n:
98	cd po; $(MAKE)
99	$(MKDIR) $(LOCALE_DIR)/share/locale/de/LC_MESSAGES
100	$(INSTALL_DATA) po/de.mo $(LOCALE_DIR)/share/locale/de/LC_MESSAGES/fwlogwatch.mo
101	$(MKDIR) $(LOCALE_DIR)/share/locale/ja/LC_MESSAGES
102	$(INSTALL_DATA) po/ja.mo $(LOCALE_DIR)/share/locale/ja/LC_MESSAGES/fwlogwatch.mo
103	$(MKDIR) $(LOCALE_DIR)/share/locale/pt/LC_MESSAGES
104	$(INSTALL_DATA) po/pt.mo $(LOCALE_DIR)/share/locale/pt/LC_MESSAGES/fwlogwatch.mo
105	$(MKDIR) $(LOCALE_DIR)/share/locale/sv/LC_MESSAGES
106	$(INSTALL_DATA) po/sv.mo $(LOCALE_DIR)/share/locale/sv/LC_MESSAGES/fwlogwatch.mo
107	$(MKDIR) $(LOCALE_DIR)/share/locale/zh_CN/LC_MESSAGES
108	$(INSTALL_DATA) po/zh_CN.mo $(LOCALE_DIR)/share/locale/zh_CN/LC_MESSAGES/fwlogwatch.mo
109	$(MKDIR) $(LOCALE_DIR)/share/locale/zh_TW/LC_MESSAGES
110	$(INSTALL_DATA) po/zh_TW.mo $(LOCALE_DIR)/share/locale/zh_TW/LC_MESSAGES/fwlogwatch.mo
111
112install-rhinit:
113	$(INSTALL_SCRIPT) contrib/fwlogwatch.init.redhat $(CONF_DIR)/rc.d/init.d/fwlogwatch
114
115uninstall:
116	@rm -f $(INSTALL_DIR)/sbin/fwlogwatch \
117		$(INSTALL_DIR)/sbin/fwlw_notify \
118		$(INSTALL_DIR)/sbin/fwlw_respond \
119		$(INSTALL_DIR)/share/man/man8/fwlogwatch.8 \
120		$(LOCALE_DIR)/share/locale/de/LC_MESSAGES/fwlogwatch.mo \
121		$(LOCALE_DIR)/share/locale/ja/LC_MESSAGES/fwlogwatch.mo \
122		$(LOCALE_DIR)/share/locale/pt/LC_MESSAGES/fwlogwatch.mo \
123		$(LOCALE_DIR)/share/locale/sv/LC_MESSAGES/fwlogwatch.mo \
124		$(LOCALE_DIR)/share/locale/zh_CN/LC_MESSAGES/fwlogwatch.mo \
125		$(LOCALE_DIR)/share/locale/zh_TW/LC_MESSAGES/fwlogwatch.mo \
126		$(CONF_DIR)/fwlogwatch.config \
127
128clean:
129	rm -f *.o *~ *.bak fwlogwatch
130	cd po; $(MAKE) clean
131
132indent:
133	indent --k-and-r-style --indent-level 2 --line-length 180 *.c *.h
134