#
# Makefile for OPEN-R Object on OPEN-R LINUX
#
# /* LICENSE:
#   =========================================================================
#     CMPack'03 Source Code Release for OPEN-R SDK v1.0
#     Copyright (C) 2003 Multirobot Lab [Project Head: Manuela Veloso]
#     School of Computer Science, Carnegie Mellon University
#     All rights reserved.
#   ========================================================================= */
#
# portions Copyright (C) 2001 Sony Corporation
# All Rights Reserved.
#

SHELL   = /bin/sh
CC      = g++
CFLAGS  = ${INCLUDE} ${DEFINE} ${OPTIONS}
LD      = ${CC}
OBJ     = ${SOURCE:.cc=.o}


TARGET  = PetProxy

SOURCE  = \
	PetProxy.cc \
	${STUB_SOURCE} \

INCLUDE = \
	-I. \
	-I$(OPENR_LINUX)/include \
	-I$(OPENR_LINUX)/include/APERIOS \

DEFINE  = \
#	-D_OPENR_DEBUG \

OPTIONS = \
	-g \
#	-O2 \


LIBRARY = \
	$(OPENR_LINUX)/lib/System/libObjectComm.a \
	$(OPENR_LINUX)/lib/System/libOPENR.a 

LDFLAGS = \


STUB_FILES  = \
	${STUB_HEADER} \
	${STUB_SOURCE} \

STUB_HEADER = \
	def.h \
	entry.h \

STUB_SOURCE = \
	PetProxyStub.cc \



.SUFFIXES :
.SUFFIXES : .o .cc
.cc.o :
	${CC} -c $< -o $@ ${CFLAGS}
 

${TARGET} : ${OBJ}
	${LD} -o $@ ${OBJ} ${LIBRARY} ${LDFLAGS}

all : depend
	${MAKE} libraries ${TARGET}

libraries : ${LIBRARY}

${LIBRARY} : check_update
	@ test "${@D}" = "./" || ( cd ${@D}; ${MAKE} ${@F} )

check_update :

${OBJ} : Makefile

${STUB_FILES} : stub.cfg
	$(OPENR_LINUX)/scripts/stubgen $?


touch :
	touch ${SOURCE}

rmtarget :
	rm -f ${TARGET}

clean : rmtarget
	rm -f ${OBJ}

clobber : clean
	- @ for dir in ${dir $(LIBRARY)}; do \
		( cd $$dir; ${MAKE} clean ) \
	done

rebuild : clobber all


DEPENDENCIES        = _dependencies
UPDATE_DEPENDENCIES = ${CC} -M ${SOURCE} ${CFLAGS} > ${DEPENDENCIES}

${DEPENDENCIES} : ${SOURCE} Makefile
	${UPDATE_DEPENDENCIES}

depend :
	${UPDATE_DEPENDENCIES}


include ${DEPENDENCIES}
