###############################################################################
#
#  Filename: Makefile
#
#  copyright 2000 by STMicroelectronics, Inc.  All rights reserved
#
#  Description:
#
#  History:
#  Date      Developer    Comments
#  ---------------------------------------------------------------------------
#  12/20/00  S. Miller    Initial Coding
#
###############################################################################

#
# Possible settings:
# _CPIA2_DEBUG_ will make the driver _verbose_ (via syslog KERN_DEBUG) ,
#   please let this switched on until we have version 1.0, we need the
#   output in case of troubles
# 
# Comment out the MODVER line if you don't used versioned modules
#

CC       = gcc
#DEBUG    = -D_CPIA2_DEBUG_
WARN     = -Wall -Wstrict-prototypes
OPTIMIZE = -O2 -fomit-frame-pointer  -pipe -fno-strength-reduce -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
CODESTYL = -fomit-frame-pointer -fno-strength-reduce
INCLUDES = -I. -I/usr/src/linux/include -I/usr/include/linux
DEFINES  = -D__KERNEL__ -DMODULE -DCONFIG_VIDEO_CPIA2_MODULE
MODVER   = -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h
CFLAGS   = $(DEBUG) $(WARN) $(OPTIMIZE) $(CODESTYL) $(INCLUDES) $(DEFINES) $(MODVER)
LIBS     =
LFLAGS   =

OBJ     =  cpia2_v4l.o cpia2_usb.o cpia2_proc.o cpia2_core.o

SRC	 = $(OBJ:.o=.c)

all: .depend cpia2.o

cpia2.o : $(OBJ)
	$(LD) -r $^ -o $@

.c.o:
	$(CC) -c $(CFLAGS) $<

install:  cpia2.o
	install -m 644 -o root -g root cpia2.o /lib/modules/`uname -r`/kernel/drivers/media/video
	/sbin/depmod -a
	install -m 644 -o root -g root cpia2dev.h /usr/include/linux

clean:
	rm -f *.o *~ core .depend

dep:
	rm -f .depend
	make .depend

.depend:
	echo '# Program dependencies' >.depend
	gcc -M $(CFLAGS) ${SRC} >>.depend

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
