[Rprotobuf-commits] r336 - pkg/inst/examples/HighFrequencyFinance

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 17 21:14:36 CEST 2010


Author: edd
Date: 2010-07-17 21:14:36 +0200 (Sat, 17 Jul 2010)
New Revision: 336

Modified:
   pkg/inst/examples/HighFrequencyFinance/
   pkg/inst/examples/HighFrequencyFinance/Makefile
   pkg/inst/examples/HighFrequencyFinance/protoDump.cpp
Log:
improved Makefile
svn ignore on two binaries
small warning suppressed



Property changes on: pkg/inst/examples/HighFrequencyFinance
___________________________________________________________________
Added: svn:ignore
   + protoCreate
protoDump


Modified: pkg/inst/examples/HighFrequencyFinance/Makefile
===================================================================
--- pkg/inst/examples/HighFrequencyFinance/Makefile	2010-07-17 18:53:35 UTC (rev 335)
+++ pkg/inst/examples/HighFrequencyFinance/Makefile	2010-07-17 19:14:36 UTC (rev 336)
@@ -1,6 +1,6 @@
 
 # Rmath is in /usr/include on my system
-CPPFLAGS=		-I/usr/include -I. -Wall -O3
+CXXFLAGS=		-I/usr/include -I. -Wall -O3 -pipe
 
 # libRmath.so is in /usr/lib on my system, as are the proto library
 LDLIBS=			-L/usr/lib -lprotobuf -lprotoc -lpthread 
@@ -8,19 +8,26 @@
 RCPPINC=		$(shell Rscript -e 'Rcpp:::CxxFlags()')
 RCPPLIB=		$(shell Rscript -e 'Rcpp:::LdFlags()')
 
+TARGETS=		protoCreate protoDump protoLoadForR.so protoModule.so TradeData.pb.cc
+
+all:			$(TARGETS)
+
 protoCreate:		protoCreate.cpp TradeData.pb.cc
-			$(CXX) $(CPPLFLAGS) -o protoCreate protoCreate.cpp TradeData.pb.cc -lRmath $(LDLIBS)
+			$(CXX) $(CXXFLAGS) $^ -o $@ -lRmath $(LDLIBS)
 
 protoDump:		protoDump.cpp TradeData.pb.cc
-			$(CXX) $(CPPLFLAGS) -o protoDump protoDump.cpp TradeData.pb.cc $(LDLIBS)
+			$(CXX) $(CXXFLAGS) $^ -o $@ $(LDLIBS)
 
 protoLoadForR.so:	protoLoadForR.cpp TradeData.pb.cc
-			PKG_CXXFLAGS="$(CPPFLAGS) $(RCPPINC)" PKG_LIBS="$(LDLIBS) $(RCPPLIB)" \
-				R CMD SHLIB protoLoadForR.cpp TradeData.pb.cc
+			PKG_CXXFLAGS="$(CXXFLAGS) $(RCPPINC)" PKG_LIBS="$(LDLIBS) $(RCPPLIB)" \
+				R CMD SHLIB $^
 
 protoModule.so:		protoModule.cpp TradeData.pb.cc
-			PKG_CXXFLAGS="$(CPPFLAGS) $(RCPPINC)" PKG_LIBS="$(LDLIBS) $(RCPPLIB)" \
-				R CMD SHLIB protoModule.cpp TradeData.pb.cc
+			PKG_CXXFLAGS="$(CXXFLAGS) $(RCPPINC)" PKG_LIBS="$(LDLIBS) $(RCPPLIB)" \
+				R CMD SHLIB $^
 
 TradeData.pb.cc:	TradeData.proto
-			protoc --cpp_out=. TradeData.proto
\ No newline at end of file
+			protoc --cpp_out=. $^
+
+clean:
+			$(RM) $(TARGETS) TradeData.pb.h

Modified: pkg/inst/examples/HighFrequencyFinance/protoDump.cpp
===================================================================
--- pkg/inst/examples/HighFrequencyFinance/protoDump.cpp	2010-07-17 18:53:35 UTC (rev 335)
+++ pkg/inst/examples/HighFrequencyFinance/protoDump.cpp	2010-07-17 19:14:36 UTC (rev 336)
@@ -13,9 +13,8 @@
     // m_us is fractional (micro)secs is diff. between (fractional) m_d and m_tm
     unsigned int us = static_cast<int>( round( (ts - tt) * 1.0e6 ) );	
 
-    char buf[32], usec[16];
+    char buf[32], txt[32];
     strftime(buf, 31, "%Y-%m-%d %H:%M:%S", &tm);
-	char txt[32];
     snprintf(txt, 31, "%s.%.06d", buf, us);
     return std::string(txt);
 }



More information about the Rprotobuf-commits mailing list