--- ppp-2.4.6.orig/pppd/plugins/pppol2tp/Makefile.linux	2014-01-02 05:42:08.000000000 +0100
+++ ppp-2.4.6/pppd/plugins/pppol2tp/Makefile.linux	2014-06-06 08:18:13.000000000 +0200
@@ -1,22 +1,20 @@
-#CC	= gcc
-COPTS	= -O2 -g
-CFLAGS	= $(COPTS) -I. -I../.. -I../../../include -fPIC
-LDFLAGS	= -shared
-INSTALL	= install
-
-#***********************************************************************
-
-DESTDIR = @DESTDIR@
-LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
-
 VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
 
+include ../../../Makedefs.com
+CPPFLAGS += -I. -I../.. -I../../../include
+ifeq (,$(filter -fPIC,$(CFLAGS)))
+CFLAGS += -fPIC
+endif
+ifeq (,$(filter -shared,$(LDFLAGS)))
+LDFLAGS += -shared
+endif
+
 PLUGINS := pppol2tp.so openl2tp.so
 
 all: $(PLUGINS)
 
 %.so: %.o
-	$(CC) $(CFLAGS) -o $@ -shared $^ $(LIBS)
+	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 install: all
 	$(INSTALL) -d -m 755 $(LIBDIR)
@@ -24,6 +22,3 @@ install: all
 
 clean:
 	rm -f *.o *.so
-
-%.o: %.c
-	$(CC) $(CFLAGS) -c -o $@ $<
