-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·129 lines (110 loc) · 3.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#
# Makefile for fetchlog
#
# $Id: Makefile,v 1.9 2010/07/01 16:39:24 afrika Exp $
#
# 23 Nov 2003
#
# Alexander Haderer
#
# alexander.haderer@loescap.de
#
#
# distribution version number
#
FETCHLOG_VERSION=1.4
### ------------------------------------------------------------------------
### user settings
### ------------------------------------------------------------------------
###
### compiler
### gcc
CC=gcc
CFLAGS= -O -Werror -Wall -Wcast-qual -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Winline -Wcast-align
### cc
#CC=cc
#CFLAGS=-O
###
### file compressor (only needed when generating new dists)
FILE_COMP=gzip
#FILE_COMP=compress
###
### comment the line below if
### 1. compilation fails with 'MADV_RANDOM' undeclared'
### (This will most probably happen on Linux 2.2 systems)
### or
### 2. fetchlog fails witch 'ERROR: fetchlog: madvise: Invalid argument'
### (This will most probably happen on SGI's IRIX using cc or gcc)
HAS_MADVISE=-DHAS_MADVISE
###
### comment the line below if compilation fails because of a missing
### regex functions. Errors are like
### compiler: "fetchlog.c: 45: Can't find include file regex.h"
### compiler: "fetchlog.c: unknown symbol REG_EXTENDED / REG_NOSUB"
### linker: "unknown symbol regexec/regcomp/regerror"
###
HAS_REGEX=-DHAS_REGEX
###
### installdir
### will use $INSTDIR/bin and $INSTDIR/man/man1,
### both dirs have to exist for installation
INSTDIR=/usr/local
### ------------------------------------------------------------------------
### --- end of user settings -----------------------------------------------
### ------------------------------------------------------------------------
# all files of this dist
# ----------------------
MYFILES= Makefile LICENSE CHANGES README README.SNMP README.Nagios \
fetchlog-Makefile.hpux fetchlog.psf \
fetchlog.cfg fetchlog_service.cfg notify.cfg.example \
test-all fetchlog.c fetchlog.1
# compiler stuff
# --------------
CC_OPT= $(CFLAGS) -DFETCHLOG_VERSION_NO=\"$(FETCHLOG_VERSION)\" \
$(HAS_MADVISE) $(HAS_REGEX)
# all
# ---
all: fetchlog
# fetchlog
# -------
fetchlog: fetchlog.c
$(CC) $(CC_OPT) fetchlog.c -o fetchlog
# install
# -------
install: fetchlog
strip fetchlog
cp fetchlog $(INSTDIR)/bin
chmod 0755 $(INSTDIR)/bin/fetchlog
cp fetchlog.1 $(INSTDIR)/man/man1
chmod 0444 $(INSTDIR)/man/man1/fetchlog.1
# test
# ----
test: fetchlog
@echo "testing basic fetchlog:"
@echo > ./testfile "--> basic fetchlog works!"
@./fetchlog -f 1:100:500: `pwd`/testfile /tmp/dummy/bookmark || true
@echo "testing regex fetchlog:"
@echo > ./testfile "--> regex fetchlog works!"
@./fetchlog -f 1:100:500: `pwd`/testfile /tmp/dummy/bookmark 't'|| true
@echo "testing completed"
@rm ./testfile
# testall
# -------
testall:
@echo "now testing all fetchlog features"
@./test-all
# clean
# -----
clean:
rm -f *~ core *.core *.o fetchlog
# dist
# ----
dist:
rm -rf fetchlog-$(FETCHLOG_VERSION)
mkdir fetchlog-$(FETCHLOG_VERSION)
cp $(MYFILES) fetchlog-$(FETCHLOG_VERSION)
tar cf fetchlog-$(FETCHLOG_VERSION).tar \
fetchlog-$(FETCHLOG_VERSION)
rm -rf fetchlog-$(FETCHLOG_VERSION)
$(FILE_COMP) fetchlog-$(FETCHLOG_VERSION).tar