# $USAGI: Makefile,v 1.10 2002/11/29 10:36:27 yoshfuji Exp $
#
# Makefile for some libs needed in the kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#

L_TARGET := lib.a

export-objs := cmdline.o dec_and_lock.o rwsem-spinlock.o rwsem.o rbtree.o \
               zlib.o idr.o
ifeq ($(CONFIG_NEW_USB),y)
  export-objs += crc32.o
endif

obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o \
		bust_spinlocks.o rbtree.o md5.o dump_stack.o idr.o

obj-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
obj-$(CONFIG_ZLIB) += zlib.o

ifneq ($(CONFIG_HAVE_DEC_LOCK),y) 
  obj-y += dec_and_lock.o
endif

obj-$(CONFIG_CRC32)	+= crc32.o

subdir-$(CONFIG_ZLIB_INFLATE) += zlib_inflate
subdir-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate

ifeq ($(CONFIG_NEW_USB),y)
  include $(TOPDIR)/drivers/net/Makefile.lib
  include $(TOPDIR)/drivers/bluetooth/Makefile.lib
  include $(TOPDIR)/fs/Makefile.lib
  include $(TOPDIR)/net/bluetooth/bnep/Makefile.lib
  include $(TOPDIR)/drivers/usb_new/Makefile.lib
endif

# Include the subdirs, if necessary.
obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o))

include $(TOPDIR)/Rules.make

crc32.o: crc32table.h
                                                                                
gen_crc32table: gen_crc32table.c
	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
                                                                                
crc32table.h: gen_crc32table
	./$< > $@
