[TeamTalk 27]: [564] TeamTalk/Agents/PrimitiveComm: linux builds automatically handle dependencies

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Thu Dec 21 01:00:03 EST 2006


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20061221/1875af09/attachment.html
-------------- next part --------------
Modified: TeamTalk/Agents/PrimitiveComm/Makefile
===================================================================
--- TeamTalk/Agents/PrimitiveComm/Makefile	2006-12-21 05:49:58 UTC (rev 563)
+++ TeamTalk/Agents/PrimitiveComm/Makefile	2006-12-21 06:00:03 UTC (rev 564)
@@ -2,6 +2,17 @@
 
 INCLUDES = -I. -I$(BOEINGLIB_DIR)/boeing -I$(BOEINGLIB_DIR)/coralshared
 
+VERBOSE = 1
+
+DEP_ECHO   = @echo Dependency: $@
+CC_ECHO    = @echo Compiling: $@
+LINK_ECHO  = @echo Linking: $@
+CLEAN_ECHO = @echo Cleaning.
+
+ifneq ($(VERBOSE), 1)
+  Q := @
+endif
+
 CPPFLAGS = $(DEFS) $(INCLUDES)
 CXXFLAGS = -g -Wall -O0
 CXXCOMPILE = $(CXX)  -c $(CPPFLAGS) $(CXXFLAGS)
@@ -13,54 +24,51 @@
 
 LIBRARIES = libboeingrobotserver.a
 
+# Include the dependencies
+-include $(OBJECTS:.o=.d)
+
 all: $(LIBRARIES)
 
 libboeingrobotserver.a: $(OBJECTS)
-	ar cru $@ $(OBJECTS)
-	ranlib $@
+	$(LINK_ECHO)
+	$(Q)ar cru $@ $(OBJECTS)
+	$(Q)ranlib $@
 
-geometry.o: geometry.cpp geometry.h
-	$(CXXCOMPILE) -o $@ $<
+boeing_robot_server.o: $(BOEINGLIB_DIR)/boeing/boeing_robot_server.cc
+	$(CC_ECHO)
+	$(Q)$(CXXCOMPILE) -o $@ $<
 
-robot_packet2.o: robot_packet2.cpp robot_packet2.h geometry.h \
- $(BOEINGLIB_DIR)/boeing/boeing_robot_packet.h \
- $(BOEINGLIB_DIR)/boeing/boeing_net.h \
- $(BOEINGLIB_DIR)/boeing/boeing_trader_packet.h \
- $(BOEINGLIB_DIR)/boeing/boeing_map_packet.h
-	$(CXXCOMPILE) -o $@ $<
+boeing_trader_server.o: $(BOEINGLIB_DIR)/boeing/boeing_trader_server.cc
+	$(CC_ECHO)
+	$(Q)$(CXXCOMPILE) -o $@ $<
 
-udpsocket.o: udpsocket.cc udpsocket.h
-	$(CXXCOMPILE) -o $@ $<
+boeing_map_server.o: $(BOEINGLIB_DIR)/boeing/boeing_map_server.cc
+	$(CC_ECHO)
+	$(Q)$(CXXCOMPILE) -o $@ $<
 
-utils.o: utils.cpp utils.h
-	$(CXXCOMPILE) -o $@ $<
+boeing_map_packet.o: $(BOEINGLIB_DIR)/boeing/boeing_map_packet.cc
+	$(CC_ECHO)
+	$(Q)$(CXXCOMPILE) -o $@ $<
 
-boeing_robot_server.o: $(BOEINGLIB_DIR)/boeing/boeing_robot_server.cc \
- $(BOEINGLIB_DIR)/boeing/boeing_robot_server.h udpsocket.h \
- $(BOEINGLIB_DIR)/boeing/boeing_robot_packet.h \
- $(BOEINGLIB_DIR)/boeing/boeing_net.h \
- $(BOEINGLIB_DIR)/boeing/boeing_map_packet.h $(BOEINGLIB_DIR)/coralshared/timer.h \
- $(BOEINGLIB_DIR)/coralshared/error_check.h $(BOEINGLIB_DIR)/coralshared/util.h
-	$(CXXCOMPILE) -o $@ $<
+# Compilation rule
+%.o: %.cc
+	$(CC_ECHO)
+	$(Q)$(CXXCOMPILE) -o $@ $<
 
-boeing_trader_server.o: $(BOEINGLIB_DIR)/boeing/boeing_trader_server.cc \
- $(BOEINGLIB_DIR)/boeing/boeing_trader_server.h udpsocket.h \
- $(BOEINGLIB_DIR)/boeing/boeing_trader_packet.h \
- $(BOEINGLIB_DIR)/boeing/boeing_net.h $(BOEINGLIB_DIR)/coralshared/timer.h \
- $(BOEINGLIB_DIR)/coralshared/error_check.h $(BOEINGLIB_DIR)/coralshared/util.h
-	$(CXXCOMPILE) -o $@ $<
+%.o: %.cpp
+	$(CC_ECHO)
+	$(Q)$(CXXCOMPILE) -o $@ $<
 
-boeing_map_server.o: $(BOEINGLIB_DIR)/boeing/boeing_map_server.cc \
- $(BOEINGLIB_DIR)/boeing/boeing_map_server.h udpsocket.h \
- $(BOEINGLIB_DIR)/boeing/boeing_map_packet.h \
- $(BOEINGLIB_DIR)/boeing/boeing_net.h $(BOEINGLIB_DIR)/coralshared/timer.h \
- $(BOEINGLIB_DIR)/coralshared/error_check.h $(BOEINGLIB_DIR)/coralshared/util.h
-	$(CXXCOMPILE) -o $@ $<
+# Dependency generation rule
+%.d: %.cc
+	$(DEP_ECHO)
+	$(Q)$(CXX) -c $(CPPFLAGS) -MM $< | ../fixdepend $(dir $<) > $@
 
-boeing_map_packet.o: $(BOEINGLIB_DIR)/boeing/boeing_map_packet.cc \
- $(BOEINGLIB_DIR)/boeing/boeing_map_packet.h \
- $(BOEINGLIB_DIR)/boeing/boeing_net.h
-	$(CXXCOMPILE) -o $@ $<
+%.d: %.cpp
+	$(DEP_ECHO)
+	$(Q)$(CXX) -c $(CPPFLAGS) -MM $< | ../fixdepend $(dir $<) > $@
 
+# Clean rule
 clean:
-	rm -f *.o $(LIBRARIES)
+	$(CLEAN_ECHO)
+	$(Q)rm -f *.o $(LIBRARIES)

Modified: TeamTalk/Agents/PrimitiveComm/geometry.h
===================================================================
--- TeamTalk/Agents/PrimitiveComm/geometry.h	2006-12-21 05:49:58 UTC (rev 563)
+++ TeamTalk/Agents/PrimitiveComm/geometry.h	2006-12-21 06:00:03 UTC (rev 564)
@@ -9,7 +9,8 @@
 
 namespace geometry {
 
-template<typename T> struct Point {
+template<typename T> struct Point 
+{
   T x, y;
   Point<T>() : x(0), y(0) {};
   Point<T>(T X, T Y) : x(X), y(Y) {};
@@ -41,10 +42,11 @@
     y += rhs.y;
     return *this;
   }
-  bool operator!() {return x != 0 || y != 0;}
+  bool operator!() {return x == 0 && y == 0;}
 };
 
-template<typename T> struct Polygon : public vector< Point<T> > {
+template<typename T> struct Polygon : public vector< Point<T> > 
+{
 	Polygon<T>() : vector< Point<T> >() {};
 	Polygon<T> (int n) : vector< Point<T> >(n) {};
 	Polygon<T>(const Polygon<T>& p) : vector< Point<T> >(p) {};
@@ -70,7 +72,7 @@
   Quadrilateral<T>(Point<T> p1, Point<T> p2, Point<T> p3, Point<T> p4): Polygon<T>(4) {
     push_back(p1); push_back(p2); push_back(p3); push_back(p4);
   };
-  operator Polygon<T>() const {return *this;}
+  //operator Polygon<T>() const {return *this;}
   Point<T> ll() const {
     Point<T> retval = this->at(0);
     for(int i=1; i<4; i++) {
@@ -101,7 +103,8 @@
   };
 };
 
-template<typename T> struct Pose {
+template<typename T> struct Pose 
+{
   Point<T> loc;
   T yaw;
   Pose<T>() : loc(), yaw(0) {}
@@ -112,15 +115,23 @@
 } //end namespace geometry
 
 template<typename T> 
-ostream& operator<<(ostream& out, const geometry::Point<T>& p) {
+ostream& operator<<(ostream& out, const geometry::Point<T>& p) 
+{
   return out << '(' << p.x << ' ' << p.y << ')';
 }
 template<typename T>
-istream& operator>>(istream& in, geometry::Point<T>& p) {
+istream& operator>>(istream& in, geometry::Point<T>& p) 
+{
   if(istreamLookFor(in, '(').fail()) return in;
   if((in >> p.x).fail()) return in;
   if((in >> p.y).fail()) return in;
   return istreamLookFor(in, ')');
 }
 
+template<typename T>
+ostream& operator<<(ostream& out, const geometry::Pose<T>& pose)
+{
+  return out << pose.loc << ' ' << pose.yaw << " rad";
+}
+
 #endif //GEOMETRY

Modified: TeamTalk/Agents/PrimitiveComm/robot_packet2.cpp
===================================================================
--- TeamTalk/Agents/PrimitiveComm/robot_packet2.cpp	2006-12-21 05:49:58 UTC (rev 563)
+++ TeamTalk/Agents/PrimitiveComm/robot_packet2.cpp	2006-12-21 06:00:03 UTC (rev 564)
@@ -469,11 +469,7 @@
   
 //instantiation from a Boeing packet
 MsgRobActionAck::MsgRobActionAck(string sender, double tstamp, int taskID, int status)
-: Msg(sender, tstamp), taskID_(taskID) {
-  if(status <= Boeing::FAILED) status_ = FAILED;
-  else if(status = Boeing::INPROGRESS) status_ = IN_PROGRESS;
-  else status = SUCCEEDED;
-}
+: Msg(sender, tstamp), taskID_(taskID), status_(statusOfBoeing(status)) {}
   
 int MsgRobActionAck::getTaskID() const {return taskID_;}
 


More information about the TeamTalk-developers mailing list