#
## lines starting with ## are not implemented yet
#
# do not edit this file
# all user configuration options are in
#
#		Makefile.config
#
# Use "make clean" to tidy up the source directory
#
## Use "make check_linux" to get some basic info about your Linux
#
## Use "make trial_patch" to see if the kernel patch would apply
#
## Use "make apply_patch" to patch the kernel
#
## Use "make devices" to create the cldd devices
#
# Use "make" or "make all" to compile the user programs
#            (note you must patch the kernel first)
# 
## Use "make install" to install the user programs
#
# Please do not use any of the other make functions directly
#

include Makefile.config

CLDD_REVISION = 0.20
CC = gcc
AR = ar
ARFLAGS = -r
CFLAGS = -O2
SLDFLAGS = -static
WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes

# End of configuration section.

KSOURCE_PATH = $(KERNEL_PATH)/linux

COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
ARCH = $(AR) $(ARFLAGS)
LINK = $(CC) $(LDFLAGS)
SLINK = $(CC) $(SLDFLAGS)

SBINPROGS = clddsetup 
SBINSCRIPTS =
IRDPROGS =  
PROGS = $(SBINPROGS) $(IRDPROGS)

LO_OBJS = 

 
all: $(PROGS)

%.o: %.c
	$(COMPILE) $<

clddsetup: clddsetup.o errors.o intro.o
	$(LINK) $^ -o $@

clddsetup.o: clddmount.h errors.h
errors.o: errors.h


clean:
	@rm -f a.out core *~ *.o $(PROGS) 
	@echo Clean

devices:
	@(for N in 0 1 2 3 4 5 6 7; \
	do \
		rm -f /dev/cldm$$N; \
		rm -f /dev/clds$$N; \
		mknod -m 660 /dev/cldm$$N b ${DEVICE_MAJOR} $$N; \
		mknod -m 660 /dev/clds$$N b ${DEVICE_MAJOR} $$[ $$N + 64 ]; \
		chown 0.0 /dev/cldm$$N; \
		chown 0.0 /dev/clds$$N; \
	done)
	@echo
	@echo You should have 8 cldm and 8 clds devices
	@echo
	@ls -l /dev/cld* 

