#
# $Id: Makefile,v 1.9 2011/06/03 19:42:19 thomasw Exp $
#
# General build makefile, only for examples.

PROJECT ?= seamax
EXPDIR ?=  /usr/local/share/${PROJECT}
APPDIR ?= /usr/local/bin

CXX ?=     /usr/bin/g++
MKDIR ?=   /bin/mkdir
CP ?=      /bin/cp
RM ?=      /bin/rm


## ============================================================================
MODEL = LinSSD
OBJS = TestIt.o
APPS = linssd

CFLAGS = -g -fomit-frame-pointer -Wall -O2 -I../../include
LIBFLG = -L../../lib -L../../cethernet -lseamax -lcethernet -lftdi -lusb


## ============================================================================
all: $(APPS)
	@echo

$(APPS): $(OBJS)
	@$(CXX) $(CFLAGS) $(OBJS) -o$@  $(LIBFLG)
	@echo "   *$@ created"


objs: $(OBJS)
	@echo

%.o: %.cpp %.h
	@echo "   *Compiling ${MODEL} example source file: ${*}.cpp"
	@$(CXX) $(CFLAGS) -c $<

install: $(APPS)
	@echo "   *Installing ${MODEL} executables to ${APPDIR}/"
	@for n in $(APPS); do $(CP) -r $$n ${APPDIR}; done
	@echo "   *Installing ${APPS} source to ${EXPDIR}/${APPS}"
	@$(MKDIR) -p ${EXPDIR}/${APPS}
	@$(CP) Makefile.installed ${EXPDIR}/${APPS}/Makefile
	@$(CP) -r * ${EXPDIR}/${APPS}
	@echo

uninstall:
	@echo "   *Uninstalling ${MODEL} executables from ${APPDIR}/"
	@for n in $(APPS); do $(RM) -rf ${APPDIR}/$$n; done
	@echo "   *Uninstalling ${APPS} source to ${EXPDIR}/${APPS}"
	@$(RM) -rf ${EXPDIR}/${APPS}	
	@echo

clean: 
	@echo "   *Removing ${APPS} example."
	@$(RM) -rf $(OBJS) $(APPS)
	@echo "     ${APPS} removed."
	@echo

