# -*- Makefile -*-
#
# @file  Makefile.RedundancySolutionCore
# @brief RTComponent makefile for "RedundancySolutionCore component"
# @date  $Date$
#
# This file is generated by rtc-template with the following argments.
#
#   rtc-template -bcxx --module-name=RedundancySolutionCore 
#   --module-desc='ModuleDescription' --module-version=1.0.0 --module-vendor=tohoku 
#   --module-category=Category --module-comp-type=STATIC 
#   --module-act-type=PERIODIC --module-max-inst=0 
#   --inport=q_cur_in:RTC::TimedDoubleSeq --inport=xyzR_in:RTC::TimedDoubleSeq --inport=redun_ref_in:RTC::TimedDoubleSeq --outport=xyzR_out:RTC::TimedDoubleSeq --outport=q_ref_out:RTC::TimedDoubleSeq --outport=redun_cur_out:RTC::TimedDoubleSeq 
#   --service-idl=/home/takahiro/RTC/ver100/test/test_palSVC/Config.idl 
#   --service=config:config:RedundancyConfig 
#
#
# $Id$
#

#include ../Make.rules


TOP=../../
include $(TOP)Make.rules


USERLIB_DIR = lib


CXXFLAGS = `rtm-config --cflags` -I.\
	-I$(OPENHRP3_HOME)/DynamicsSimulator/server \
	-I$(OPENHRP3_HOME)/DynamicsSimulator/corba \
	-I$(OPENHRP3_HOME)/Controller/IOserver/include \
	-I$(OPENHRP3_HOME)/Controller/IOserver/corba \
	-I$(OPENHRP3_HOME)/ModelLoader/corba \
	-I$(OPENHRP3_HOME)/Common \
	-I$(OPENHRP3_HOME)/Controller/rtc \
	-I$(USERLIB_DIR)/

LDFLAGS  = `rtm-config --libs`\
	    -lhrpModel3 -L$(OPENHRP3_HOME)/DynamicsSimulator/server \
            -lomniORB4 -lomnithread -lhrpModel3 -L$(OPENHRP3_HOME)/DynamicsSimulator/server
SHFLAGS  = -shared

IDLC     = `rtm-config --idlc`
IDLFLAGS = `rtm-config --idlflags` -I`rtm-config --prefix`/include/rtm/idl
WRAPPER  = rtm-skelwrapper
WRAPPER_FLAGS = --include-dir="" --skel-suffix=Skel --stub-suffix=Stub

SKEL_OBJ = ConfigSkel.o 
STUB_OBJ = 
IMPL_OBJ = ConfigSVC_impl.o
USER_OBJ =
OBJS     = RedundancySolutionCore.o $(USER_OBJ) $(SKEL_OBJ) $(STUB_OBJ) $(IMPL_OBJ) 
HEADERS  = $(OBJS:.o=.h)
SRCS     = $(HEADERS:.h=.cpp)

LDLIBS   = $(USERLIB_DIR)/libRedundancy.so



.SUFFIXES : .so

all: RedundancySolutionCore.so RedundancySolutionCoreComp 


.cpp.o:
	rm -f $@
	$(CXX) $(CXXFLAGS) -c -o $@ $<

.o.so:
	rm -f $@
	$(MAKE) -C $(USERLIB_DIR)/
	$(CXX) $(SHFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)

RedundancySolutionCoreComp: RedundancySolutionCoreComp.o $(OBJS) $(SRCS) $(HEADERS) $(LDLIBS)
	$(MAKE) -C $(USERLIB_DIR)/
	$(CXX) -o $@ $(OBJS) RedundancySolutionCoreComp.o $(LDFLAGS) $(LDLIBS)


clean: clean_objs clean_skelstub
	rm -f *~

clean_objs:
	rm -f $(OBJS) RedundancySolutionCoreComp.o RedundancySolutionCore.so RedundancySolutionCoreComp

clean_skelstub:
	rm -f *Skel.h *Skel.cpp
	rm -f *Stub.h *Stub.cpp
	$(MAKE) -C $(USERLIB_DIR)/ clean

clean_log:
	rm -f log_*


ConfigSkel.cpp : Config.idl
	$(IDLC) $(IDLFLAGS) Config.idl
	$(WRAPPER) $(WRAPPER_FLAGS) --idl-file=Config.idl

ConfigSkel.h : Config.idl
	$(IDLC) $(IDLFLAGS) Config.idl
	$(WRAPPER) $(WRAPPER_FLAGS) --idl-file=Config.idl


RedundancySolutionCore.so: $(OBJS)
RedundancySolutionCore.o:  $(SRCS) $(HEADERS) #RedundancySolutionCore.h ConfigSkel.h ConfigSVC_impl.h JointName.h JointName.cpp
RedundancySolutionCoreComp.o: $(SRCS) $(HEADERS) #RedundancySolutionCoreComp.cpp RedundancySolutionCore.cpp RedundancySolutionCore.h ConfigSkel.h ConfigSVC_impl.h  JointName.h JointName.cpp

ConfigSVC_impl.o: ConfigSVC_impl.cpp ConfigSVC_impl.h ConfigSkel.h ConfigStub.h
ConfigSkel.o: ConfigSkel.cpp ConfigSkel.h ConfigStub.h
ConfigStub.o: ConfigStub.cpp ConfigStub.h

$(LDLIBS): ConfigSkel.h  $(USERLIB_DIR)/*.h  $(USERLIB_DIR)/*.cpp
	$(MAKE) -C $(USERLIB_DIR)/




############## modified by skd...
run: RedundancySolutionCoreComp
	LD_LIBRARY_PATH=$(OPENHRP3_HOME)/DynamicsSimulator/server ./RedundancySolutionCoreComp

SOURCES=$(OBJS:.o=.cpp)
depend:
	$(CXX) -MM $(INCLUDE) $(CXXFLAGS) $(SOURCES) > dependencies

-include dependencies
##############



# end of Makefile
