summaryrefslogtreecommitdiff
path: root/package/ppp/patches/patch-pppd_plugins_pppol2tp_Makefile_linux
blob: 481f1e41ccb444cb9cfc3834e29d22e924b8d7d2 (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
--- ppp-2.4.5.orig/pppd/plugins/pppol2tp/Makefile.linux	2009-11-16 23:26:07.000000000 +0100
+++ ppp-2.4.5/pppd/plugins/pppol2tp/Makefile.linux	2011-01-21 21:30:05.208658673 +0100
@@ -1,29 +1,27 @@
-#CC	= gcc
-COPTS	= -O2 -g
-CFLAGS	= $(COPTS) -I. -I../.. -I../../../include -fPIC
-LDFLAGS	= -shared
-INSTALL	= install
+VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
 
-#***********************************************************************
+include ../../../Makedefs.com
 
-DESTDIR = @DESTDIR@
-LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
+CPPFLAGS += -I. -I../.. -I../../../include
+ifeq (,$(filter -fPIC,$(CFLAGS)))
+CFLAGS += -fPIC
+endif
+ifeq (,$(filter -shared,$(LDFLAGS)))
+LDFLAGS += -shared
+endif
 
-VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
+#***********************************************************************
 
 PLUGINS := pppol2tp.so openl2tp.so
 
 all: $(PLUGINS)
 
 %.so: %.o
-	$(CC) $(CFLAGS) -o $@ -shared $^ $(LIBS)
+	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
-install: all
+install: $(PLUGINS)
 	$(INSTALL) -d -m 755 $(LIBDIR)
-	$(INSTALL) -c -m 4550 $(PLUGINS) $(LIBDIR)
+	$(INSTALL) $(STRIP) -c -m 755 $(PLUGINS) $(LIBDIR)
 
 clean:
 	rm -f *.o *.so
-
-%.o: %.c
-	$(CC) $(CFLAGS) -c -o $@ $<