summaryrefslogtreecommitdiff
blob: f10531646ad0aaffb2cfd591116f76c2c8c5a20e (plain)
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
diff --git a/grok-0.9.2/Makefile b/grok-0.9.2/Makefile
index adfe869..fdced25 100644
--- a/grok-0.9.2/Makefile
+++ b/grok-0.9.2/Makefile
@@ -25,10 +25,12 @@ else
 GPERF?=/usr/bin/gperf
 endif
 
+LIBS=-lpcre -levent -rdynamic -ltokyocabinet
+
 # For linux, we need libdl for dlopen()
 # On FreeBSD, comment this line out.
 ifeq ($(PLATFORM), GNULinux)
-LDFLAGS+=-ldl
+LIBS+=-ldl
 endif
 
 # #############################################
@@ -41,8 +43,7 @@ VERSION=$(shell sh $(BASE)/version.sh)
 #CFLAGS+=-g
 #LDFLAGS+=-g
 
-CFLAGS+=-pipe -fPIC -I. -O2
-LDFLAGS+=-lpcre -levent -rdynamic -ltokyocabinet
+CFLAGS+=-fPIC -I.
 
 LIBSUFFIX=$(shell sh $(BASE)/platform.sh libsuffix)
 VERLIBSUFFIX=$(shell sh $(BASE)/platform.sh libsuffix $(MAJOR))
@@ -50,8 +51,8 @@ DYNLIBFLAG=$(shell sh $(BASE)/platform.sh dynlibflag)
 LIBNAMEFLAG=$(shell sh $(BASE)/platform.sh libnameflag $(MAJOR) $(INSTALLLIB))
 
 # Sane includes
-CFLAGS+=-I/usr/local/include
-LDFLAGS+=-L/usr/local/lib
+#CFLAGS+=-I/usr/local/include
+#LDFLAGS+=-L/usr/local/lib
 
 # Platform so we know what to dlopen
 CFLAGS+=-DPLATFORM_$(PLATFORM)
@@ -97,6 +98,7 @@ install: libgrok.$(LIBSUFFIX) grok discogrok $(GROKHEADER)
 	install -m 755 grok $(DESTDIR)$(PREFIX)/bin
 	install -m 755 discogrok $(DESTDIR)$(PREFIX)/bin
 	install -m 644 libgrok.$(LIBSUFFIX) $(DESTDIR)$(PREFIX)/lib
+	ln -s libgrok.$(LIBSUFFIX) $(DESTDIR)$(PREFIX)/lib/libgrok.$(LIBSUFFIX).1
 	for header in $(GROKHEADER); do \
 		install -m 644 $$header $(DESTDIR)$(PREFIX)/include; \
 	done 
@@ -162,14 +164,14 @@ cleanver:
 # Binary creation
 grok: LDFLAGS+=-levent
 grok: $(GROKOBJ) conf.tab.o conf.yy.o main.o grok_config.o
-	$(CC) $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
 
 discogrok: $(GROKOBJ) discover_main.o
-	$(CC) $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
 
 libgrok.$(LIBSUFFIX): 
 libgrok.$(LIBSUFFIX): $(GROKOBJ) 
-	$(CC) $(LDFLAGS) -fPIC $(DYNLIBFLAG) $(LIBNAMEFLAG) $^ -o $@
+	$(CC) $(LDFLAGS) -fPIC $(DYNLIBFLAG) $(LIBNAMEFLAG) $^ $(LIBS) -o $@
 
 libgrok.$(VERLIBSUFFIX): libgrok.$(LIBSUFFIX);
 	ln -s $< $@