# $Revision: 1 $
# $Date: 4/17/06 5:06p $
# Makefile for HPDI32 sample application.

CC			= gcc
CC_FLAGS	= -c -Wall -I../driver -I../docsrc -I../utils
DEP_FILE	= makefile.dep
TARGET		= irq
VPATH		= ../utils

LIB_FILES	=							\
			../docsrc/HPDI32DocSrcLib.a

OBJ_FILES	=				\
			irq.o			\
			irq0.o			\
			irq1.o			\
			irq2.o			\
			irq3.o			\
			irq4.o			\
			irq5.o			\
			irq6.o			\
			irq7.o			\
			irq8.o			\
			irq9.o			\
			irq10.o			\
			irq11.o			\
			irq12.o			\
			irq13.o			\
			irq14.o			\
			irq15.o			\
			main.o			\
			rx.o			\
							\
			util_count.o	\
			util_id.o		\
			util_label.o	\
			util_select.o



.c.o:
	@echo == Compiling: $<
	@-chmod +rw ${DEP_FILE}
	@# Get the dependency list for this module.
	@-${CC} -MM ${CC_FLAGS} $< > .tmp1
	@# Remove the trailing white space and backslash.
	@-sed -e "s/[ ]*[\\\\]//g" < .tmp1 > .tmp2
	@# Put everything on seperate lines.
	@-tr '[:space:]' '\n' < .tmp2 > .tmp3
	@# Remove all of the system include files.
	@-grep -v "^[ ]*/" < .tmp3 > .tmp4
	@# Remove all empty lines.
	@-grep "[[:alnum:]]" < .tmp4 > .tmp5
	@# Put everything on the same line.
	@-tr '\n' '\040' < .tmp5 > .tmp6
	@echo -e '\012' >> .tmp6
	@# Add all of the other dependencies to the end of this file.
	@-echo >> ${DEP_FILE}
	@-grep -v "^[ ]*$@" < ${DEP_FILE} >> .tmp6
	@# Remove blank lines from the list.
	@-grep "[[:alnum:]]" < .tmp6 > .tmp7
	@# Sort the list and put it in the dependency file.
	@-sort < .tmp7 > ${DEP_FILE}
	@# Cleanup.
	@rm -f ${DEP_FILE}.tmp* .tmp*
	@# Compile the module.
	@${CC} ${CC_FLAGS} $< -o $@



all: ${TARGET}
	@echo ==== All Done

release: ${TARGET}
	@rm -f *.o
	@echo ==== Release Done

${TARGET}: ${OBJ_FILES}
	@echo ==== Linking: $@
	@${CC} ${OBJ_FILES} ${LIB_FILES} -o $@

clean:
	@echo ==== Cleaning ...
	@rm -f *.o ${TARGET}
	@echo > ${DEP_FILE}

${DEP_FILE}:
	@echo ==== Creating: $@
	@echo > ${DEP_FILE}

include ${DEP_FILE}

