# Generated automatically from Makefile.in by configure.
#***********************************************************************
#
# Makefile
#
# Makefile for Roaring Penguin's Linux PPPoE plugin.
#
# 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.
#
# $Id: Makefile,v 1.3 2010/03/18 10:07:10 cosmo Exp $
#***********************************************************************

DESTDIR = $(TARGET)
BINDIR = $(DESTDIR)/sbin
LIBDIR = $(DESTDIR)/lib/pppd/$(PPPDVERSION)

PPPDVERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)

INSTALL	= install

# Version is set ONLY IN THE MAKEFILE!  Don't delete this!
VERSION=3.3

CFLAGS+=-I../../../include/linux --static -s -DCOMPACK_SIZE
ifeq ($(RTL8186_KB),1)
CFLAGS+=-DCONFIG_RTL8186_KB
endif

CFLAGS += $(COPTS) -I../../../include/linux

all: rp-pppoe.so libplugin.a

ifeq ($(GR),1)
CFLAGS+=-DCONFIG_RTL8186_GR
endif

ifeq ($(RTL8186_TR),1)
CFLAGS+=-DCONFIG_RTL8186_TR 
endif

ifeq ($(CONFIG_RTL865X_SC),1)
CFLAGS+=-DCONFIG_RTL865X_SC
endif

CFLAGS += $(EXTRA_CFLAGS)

#all: libplugin.a

rp-pppoe.so: libplugin.a plugin.o
	$(CC) -o rp-pppoe.so -shared plugin.o libplugin.a

install: all
	$(INSTALL) -d -m 755 $(LIBDIR)
	$(INSTALL) -d -m 755 $(BINDIR)
	$(INSTALL) -d -m 755 $(BINDIR)
	#$(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR)

clean:
	rm -f *.o *.so
	rm -f pppoe-discovery

plugin.o:
	$(CC) '-DRP_VERSION="$(VERSION)"' $(CFLAGS) -I../../..  -c -o plugin.o  plugin.c

libplugin.a: discovery.o if.o common.o debug.o plugin.o
	$(AR) -rc $@ $^

discovery.o:
	$(CC) $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o discovery.o  discovery.c

if.o:
	$(CC) $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o if.o  if.c

debug.o:
	$(CC) $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o debug.o  debug.c

common.o:
	$(CC) $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o common.o  common.c

