]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/pppoe/Makefile.linux
Install with standard permissions (#221)
[ppp.git] / pppd / plugins / pppoe / Makefile.linux
index 7fc97eb2b14cf2ec1840aef785f680922583dffe..6d2469fd71385e72a9457723a249856c0acc5639 100644 (file)
@@ -1,42 +1,65 @@
-CC     = gcc
-CFLAGS = -g  -I.. -I../.. -I../../../include -D_linux_=1 -fPIC
-LDFLAGS        = -shared
-INSTALL        = install -o root
+#***********************************************************************
+#
+# Makefile
+#
+# Makefile for Roaring Penguin's Linux PPPoE plugin.
+# Modified for integration with pppd sources by Paul Mackerras.
+#
+# Copyright (C) 2001 Roaring Penguin Software Inc.
+#
+# This program may be distributed according to the terms of the GNU
+# General Public License, version 2 or (at your option) any later version.
+#
+#***********************************************************************
 
-all: pppoe.so pppoed
+CROSS_COMPILE=@CROSS_COMPILE@
+CC=$(CROSS_COMPILE)@CC@
+COPTS=@CFLAGS@
 
-PLUGINDIR = $(LIBDIR)/plugins
-PLUGINSRCS= pppoe.c libpppoe.c utils.c pppoehash.c pppoe_client.c \
-               pppoe_relay.c pppoe_server.c pppd_utils.c
+DESTDIR = $(INSTROOT)@DESTDIR@
+BINDIR = $(DESTDIR)/sbin
+LIBDIR = $(DESTDIR)/lib/pppd/$(PPPDVERSION)
 
-# include dependencies if present
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+PPPDVERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
 
+INSTALL        = install
+LN_S   = ln -sf
 
-pppoefwd: pppoefwd.o libpppoe.a 
-       $(CC) -o $@ $^
+CFLAGS=$(COPTS) -I../../../include
+all: pppoe.so pppoe-discovery
 
-pppoed: pppoed.o pppd_utils.o libpppoe.a 
-       $(CC) -o $@ $^
+pppoe-discovery: pppoe-discovery.o debug.o
+       $(CC) $(LDFLAGS) -o pppoe-discovery pppoe-discovery.o debug.o
 
-libpppoe.a: pppoehash.o pppoe_client.o pppoe_relay.o pppoe_server.o \
-       utils.o libpppoe.o 
-       ar -rc $@ $^
+pppoe-discovery.o: pppoe-discovery.c
+       $(CC) $(CFLAGS) -I../../.. -c -o pppoe-discovery.o pppoe-discovery.c
 
-pppoe.so: pppoe.o libpppoe.a
-       $(CC) -o $@ $(LDFLAGS) $^
+debug.o: debug.c
+       $(CC) $(CFLAGS) -I../../.. -c -o debug.o debug.c
 
-%.so: %.c
-       $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^
-
-clean: 
-       rm -f *.o *.so *.a pppoefwd pppoed
+pppoe.so: plugin.o discovery.o if.o common.o
+       $(CC) $(LDFLAGS) -o pppoe.so -shared plugin.o discovery.o if.o common.o
 
 install: all
        $(INSTALL) -d -m 755 $(LIBDIR)
-       $(INSTALL) -s -c -m 4550 pppoe.so $(LIBDIR)
+       $(INSTALL) -c -m 755 pppoe.so $(LIBDIR)
+       # Symlink for backward compatibility
+       $(LN_S) pppoe.so $(LIBDIR)/rp-pppoe.so
+       $(INSTALL) -d -m 755 $(BINDIR)
+       $(INSTALL) -c -m 755 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
 
-depend:
-       $(CPP) -M $(CFLAGS) $(PLUGINSRCS) >.depend