DEST=/usr/local/bin/

LDFLAGS =  -lusb
INCLUDES = -Ishared
DEFINES = 

CFLAGS = -c -O2 ${INCLUDES} ${DEFINES} -Wall -W \
         -Werror \
         -Wunused -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \
         -Wcast-align -Wwrite-strings -Waggregate-return \
         -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
         -Wnested-externs -Winline

OBJS = shared/sky-control.o sky-control-lib.o shared/gnome.o \
       shared/serial.o shared/buffer.o
EXAMPLEOBJS = sky-example.o sky-control-lib.o

all:		sky-example sky-control
		@echo "### $@ built."

sky-example:		${EXAMPLEOBJS}
		@echo "### Linking $@..."
		@${CC} -o $@ ${EXAMPLEOBJS} ${LDFLAGS}
		@echo "### $@ built."

sky-control:		${OBJS}
		@echo "### Linking $@..."
		@${CC} -o $@ ${OBJS} ${LDFLAGS}
		@echo "### $@ built."

clean:		
		@rm -f Makefile.dep Makefile.dep.bak core sky-control-example \
		sky-control  ${OBJS}  ${EXAMPLEOBJS}

.c.o:
		@echo "### Compiling $<..."
		@${CC} ${CFLAGS} ${DEFS} $< -o $@

install: all
		@echo "### Install..."
		install --owner root --mode=a+rx,u+ws sky-control ${DEST}
		@echo "### Install done."
