#
# Makefile for the kernel character device drivers.
#
# 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).
#
# Note 2! The CFLAGS definitions are now inherited from the
# parent makes..
#
#
# FIXME: The audio stuff should be made optional in the kernel
# configuration tool! -- Erik Mouw (J.A.K.Mouw@its.tudelft.nl),
# 26-apr-2000

# Links to make
LK = console_macros.h keyboard.c pc_keyb.c defkeymap.c serial.c

L_TARGET	:= special.a
L_OBJS		:= 
LX_OBJS		:= 

# Sort out all the architecture stuff...

KEYB_arc	:= defkeymap-acorn.o
KEYB_a5k	:= defkeymap-acorn.o
KEYB_rpc	:= defkeymap-acorn.o
KEYB_ebsa110	:=
KEYB_footbridge	:= defkeymap.o pc_keyb.o

ifeq ($(CONFIG_SA1100_BRUTUS),y)
  KEYB_sa1100 := brutus_keyb.o defkeymap-acorn.o
endif
ifeq ($(CONFIG_SA1100_TIFON),y)
  KEYB_sa1100   := defkeymap-tifon.o tifon_keyb.o
endif
ifeq ($(CONFIG_SA1100_THINCLIENT),y)
  KEYB_sa1100 := defkeymap.o
endif
ifeq ($(CONFIG_SA1100_BITSY),y)
  KEYB_sa1100 := defkeymap.o
endif
ifeq ($(CONFIG_SA1100_ASSABET),y)
  KEYB_sa1100 := defkeymap.o
endif
ifeq ($(CONFIG_SA1100_GRAPHICSCLIENT),y)
  KEYB_sa1100 := defkeymap.o
endif

ifeq ($(MACHINE),arc)
SOLD_$(CONFIG_SERIAL)		+= serial6850.o
else
S_$(CONFIG_SERIAL)		+= serial.o
endif
S_$(CONFIG_ATOMWIDE_SERIAL)	+= serial.o
S_$(CONFIG_DUALSP_SERIAL)	+= serial.o

ifeq ($(CONFIG_VT),y)
  ifneq ($(KEYB_$(MACHINE)),)
    L_OBJS += $(KEYB_$(MACHINE))
    LX_OBJS += console.o keyboard.o
  endif
endif

ifdef S_y
  LX_OBJS += $(sort $(S_y))
else
  ifdef S_m
    MX_OBJS += $(sort $(S_m))
  endif
endif

ifdef SOLD_y
  LX_OBJS += $(SOLD_y)
else
  ifdef SOLD_m
    MX_OBJS += $(SOLD_m)
  endif
endif


ifdef CONFIG_SA1100_BRUTUS
  L_OBJS  += audio-sa1100-mcp.o
  LX_OBJS += mcp_common.o
endif


ifdef CONFIG_SA1100_LART
  L_OBJS  += audio-sa1100-mcp.o
  LX_OBJS += mcp_common.o
endif


ifdef CONFIG_SA1100_TIFON
  L_OBJS  += audio-sa1100-mcp.o
  LX_OBJS += mcp_common.o
endif



# Common dependencies

all: links first_rule

fastdep: links

include $(TOPDIR)/Rules.make

.PHONY: links
links:
	-@for f in $(LK); do \
		if [ ! -e $$f ]; then \
			echo "ln -s ../../../drivers/char/$$f .";\
			ln -s ../../../drivers/char/$$f .; \
		fi; \
	done

mrproper:
	-@for f in $(LK); do \
		if [ -L $$f ]; then \
			echo $(RM) $$f; \
			$(RM) $$f; \
		elif [ -f $$f ]; then \
			echo not removing $$f; \
		fi; \
	done
	$(RM) conmakehash
