#############################################################################
# These are the default build rules for various types of source/target combos
#############################################################################

%.d: %.c
	    @echo Generating dependencies for $<
	    $(DEPEND_TOOL) $(INCLUDES) $< > $@.$$$$; \
		sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
		rm -f $@.$$$$

%.d: %.cc
	    @echo Generating dependencies for $<
	    $(DEPEND_TOOL) $(INCLUDES) $< > $@.$$$$; \
		sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
		rm -f $@.$$$$

%.o: %.c 
	    $(CC) $(CFLAGS) $(INCLUDES) $< -o $@	

%.o: %.cc
	    $(CCPP) $(CPPFLAGS) $(INCLUDES) $< -o $@

%.tab.cc:%.y
	$(YACC) -b $(basename $<) -d -v $<
	mv $(basename $<).tab.c $@ 

%.yy.cc:%.l
	$(LEX) $<
	mv lex.yy.c $@

%.a:
	@echo Building Library $@
	$(AR) $@ +- $?
	@echo Done building library $@

DEST	    = .

MAKEFILE    = Makefile

clean:
	rm -f core *.o $(OBJS:.o=.d) *.lib \
		*.yy *.yy.err *.yy.cc *.output \
		*.tab.* $(TARGETS) $(ADDITIONAL_CLEAN)

update:
	cvs update $(CC_SRCS) $MAKEFILE

commit:
	cvs commit $(CC_SRCS) $MAKEFILE

install:
		cp -f $(TARGETS)	$(AUV_BIN_DIR)/. 

##########################################################################
#only include the dependencies if we aren't making clean

ifneq ($(MAKECMDGOALS),clean)
include $(OBJS:.o=.d)
endif


