############################################################################
#                           CONFIDENTIAL
#
#               C-Bus Module for Linux - Console demo
#
#          Copyright (c) 2004 Clipsal Integrated Systems Pty Ltd
#                              PO Box 103
#                            Hindmarsh 5007
#                           South Australia
#
############################################################################
#
# FILE    : makefile
# PURPOSE : describe source dependancies for Linux C-Bus Module console demo
#
# DESCRIPTION:
#   Used by GNU make to work out the source dependancies, and compile
#   and link the C-Bus Module for Linux.
#
# ASSUMPTIONS:
#   None.
#
# AUTHOR:
#   Ashleigh Quick
#
# MODIFICATION HISTORY:
#   Revision     Date     Author  Change Description
#     0.1     09-Nov-04    AGQ    Original.
#
############################################################################

############################################################################
#
# Clear the Suffixes list and set to the file name suffixes that we want
# Make to understand
#
############################################################################
.SUFFIXES:
.SUFFIXES:	.c .h .a .o


############################################################################
#
# Tools:
#   gcc used for compilation & linking
#   rm  used to remove files
#
############################################################################
CC := gcc -c
RM := rm -f
LINK := gcc

CCOPTS := -fpack-struct -Wall -std=gnu99 -pedantic -g


############################################################################
#
# Library & Include search paths
#
############################################################################
CCLIBS := -I/usr/local/include/cbus
LINKLIBS := -L/usr/local/lib
CBM := -lcbm


############################################################################
#
# Implicit Translation Rules (using GNU Makefile pattern rules)
#
############################################################################
#
# C compilation. Build an object from its C source.
#
%.o:	%.c

%.o:	%.c
	$(CC) $(CCOPTS) $(CCLIBS) $<

#
# Linking - just link everything together
#
%:	%.o
	$(LINK) $(LINKOPTS) $(LINKLIBS) $^ $(CBM) -o $@


############################################################################
#                     ###############################
#           #########           TARGETS              #########
#                     ###############################
############################################################################

console:	console.o

console.o:	console.c



############################################################################
#
# Cleanup targets. Use "make clean" or "make veryclean" to activate.
#
############################################################################
.PHONY:	clean veryclean
clean:
	-$(RM) *.c~
	-$(RM) *.h~
	-$(RM) *.c.~*~
	-$(RM) *.h.~*~
	-$(RM) *.o
	-$(RM) *.a

veryclean:
	-$(RM) *.c~
	-$(RM) *.h~
	-$(RM) *.c.~*~
	-$(RM) *.h.~*~
	-$(RM) *.o
	-$(RM) *.a
	-$(RM) *.exe
	-$(RM) *.*~
	-$(RM) makefile~
	-$(RM) "#*.*#"

############################################################################
#                            ##################
#                  #########         END       #########
#                            ##################
############################################################################
