#  Makefile
#
#  LUNAR - Lightweight Underlay Network Ad hoc Routing
#
#  Makefile for building MIPSEL versions of the kernel
#  modules ksapf.o and klunar.o (kernel 2.4.x)
#
#  Copyright (C) 2001-2003 Christophe Jelger <christophe.jelger@unibas.ch>
#
#  This file is distributed under the terms of the GNU general Public
#  License (GPL), see the file COPYING

SDKHOME=/home/OpenWRT/openwrt

CC=$(SDKHOME)/staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc
LD=$(SDKHOME)/staging_dir_mipsel/bin/mipsel-linux-uclibc-ld

CFLAGS=-Wall -Wstrict-prototypes -Wno-trigraphs -Os \
	-fno-strict-aliasing -fno-common -fomit-frame-pointer \
	-I $(SDKHOME)/build_mipsel/linux/linux-2.4.30/include/asm/gcc

CCFLAGS=-G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 \
	-mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 \
	-Wa,--trap -DMODULE -mlong-calls -nostdinc -iwithprefix include

MFLAGS=-DEXPORT_SYMTAB -I $(SDKHOME)/build_mipsel/linux/linux-2.4.30/include/

all:
	$(MAKE) -f Makefile-mipsel clean
	$(MAKE) -f Makefile-mipsel modules

modules:
	$(MAKE) -f Makefile-mipsel lunar.o

lunar.o:	./netbox_lnx.c ../src/xrp.c ../src/lunar_core.c \
		../src/lunar_init.c ../src/lunar_dhcp.c \
		../include/lunar.h ../include/lunar_decl.h \
		../include/netbox.h ../include/netbox_decl.h \
		../include/platform.h ../include/platform_lnx.h \
		../include/sapf.h ../include/sapf_decl.h \
		../include/xrp.h ../include/xrp_decl.h \
		../include/version.h
	$(CC) $(CFLAGS) $(CCFLAGS) $(MFLAGS) -c lunar.c

clean:
	rm -f *.o */*.o 
	rm -f *.ko */*.ko 
	rm -f *~ */*~ 
	rm -f *.o.{cmd,flags} */*.o.{cmd,flags}
	rm -f *.mod.o */*.mof.o
	rm -f *.mod.c */*.mod.c
