--- ppp-2.4.5.orig/pppd/plugins/rp-pppoe/Makefile.linux	2009-11-16 23:26:07.000000000 +0100
+++ ppp-2.4.5/pppd/plugins/rp-pppoe/Makefile.linux	2011-01-21 21:29:58.318658312 +0100
@@ -1,6 +1,4 @@
-# Generated automatically from Makefile.in by configure.
 #***********************************************************************
-#
 # Makefile
 #
 # Makefile for Roaring Penguin's Linux PPPoE plugin.
@@ -14,51 +12,35 @@
 # $Id: Makefile.linux,v 1.8 2008/06/09 08:34:23 paulus Exp $
 #***********************************************************************
 
-DESTDIR = $(INSTROOT)@DESTDIR@
-BINDIR = $(DESTDIR)/sbin
-LIBDIR = $(DESTDIR)/lib/pppd/$(PPPDVERSION)
-
-PPPDVERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
+VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
 
-INSTALL	= install
+include ../../../Makedefs.com
 
 # Version is set ONLY IN THE MAKEFILE!  Don't delete this!
 RP_VERSION=3.8p
 
-COPTS=-O2 -g
-CFLAGS=$(COPTS) -I../../../include '-DRP_VERSION="$(RP_VERSION)"'
+CPPFLAGS += -I../../../include -I../../..
+CPPFLAGS += '-DRP_VERSION="$(RP_VERSION)"'
+ifeq (,$(filter -fPIC,$(CFLAGS)))
+CFLAGS += -fPIC
+endif
+ifeq (,$(filter -shared,$(LDFLAGS)))
+LDFLAGS += -shared
+endif
+
 all: rp-pppoe.so pppoe-discovery
 
 pppoe-discovery: pppoe-discovery.o debug.o
-	$(CC) -o pppoe-discovery pppoe-discovery.o debug.o
-
-pppoe-discovery.o: pppoe-discovery.c
-	$(CC) $(CFLAGS) -c -o pppoe-discovery.o pppoe-discovery.c
-
-debug.o: debug.c
-	$(CC) $(CFLAGS) -c -o debug.o debug.c
+	$(CC) $(LDFLAGS) -o $@ $^
 
 rp-pppoe.so: plugin.o discovery.o if.o common.o
-	$(CC) -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o
+	$(CC) $(LDFLAGS) -o $@ $^
 
 install: all
 	$(INSTALL) -d -m 755 $(LIBDIR)
-	$(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR)
+	$(INSTALL) $(STRIP) -c -m 4550 rp-pppoe.so $(LIBDIR)
 	$(INSTALL) -d -m 755 $(BINDIR)
-	$(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR)
+	$(INSTALL) $(STRIP) -c -m 555 pppoe-discovery $(BINDIR)
 
 clean:
 	rm -f *.o *.so pppoe-discovery
-
-plugin.o: plugin.c
-	$(CC) $(CFLAGS) -I../../.. -c -o plugin.o -fPIC plugin.c
-
-discovery.o: discovery.c
-	$(CC) $(CFLAGS) -I../../.. -c -o discovery.o -fPIC discovery.c
-
-if.o: if.c
-	$(CC) $(CFLAGS) -I../../.. -c -o if.o -fPIC if.c
-
-common.o: common.c
-	$(CC) $(CFLAGS) -I../../.. -c -o common.o -fPIC common.c
-
