Permalink
Browse files

fixing up build process, linking correctly

  • Loading branch information...
1 parent 6eaff7c commit 848900f4e049b4296dd8f1520c757f41f32bf48e @tenderlove committed Sep 22, 2008
View
@@ -0,0 +1,149 @@
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+srcdir = .
+topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0
+hdrdir = $(topdir)
+VPATH = $(srcdir):$(topdir):$(hdrdir)
+prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
+exec_prefix = $(prefix)
+sitedir = $(DESTDIR)/Library/Ruby/Site
+rubylibdir = $(libdir)/ruby/$(ruby_version)
+docdir = $(datarootdir)/doc/$(PACKAGE)
+dvidir = $(docdir)
+datarootdir = $(prefix)/share
+archdir = $(rubylibdir)/$(arch)
+sbindir = $(exec_prefix)/sbin
+psdir = $(docdir)
+localedir = $(datarootdir)/locale
+htmldir = $(docdir)
+datadir = $(datarootdir)
+includedir = $(prefix)/include
+infodir = $(DESTDIR)/usr/share/info
+sysconfdir = $(prefix)/etc
+mandir = $(DESTDIR)/usr/share/man
+libdir = $(exec_prefix)/lib
+sharedstatedir = $(prefix)/com
+oldincludedir = $(DESTDIR)/usr/include
+pdfdir = $(docdir)
+sitearchdir = $(sitelibdir)/$(sitearch)
+bindir = $(exec_prefix)/bin
+localstatedir = $(prefix)/var
+sitelibdir = $(sitedir)/$(ruby_version)
+libexecdir = $(exec_prefix)/libexec
+
+CC = gcc
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
+
+RUBY_EXTCONF_H =
+CFLAGS = -fno-common -arch i386 -Os -pipe -fno-common -dynamiclib -bundle -flat_namespace -undefined suppress -pthread -fPIC
+INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) -I/Users/aaron/git/quail/vendor/include
+CPPFLAGS =
+CXXFLAGS = $(CFLAGS)
+DLDFLAGS = -L. -arch i386
+LDSHARED = cc -arch i386 -pipe -bundle -undefined dynamic_lookup
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby
+RUBY_SO_NAME = ruby
+arch = universal-darwin9.0
+sitearch = universal-darwin9.0
+ruby_version = 1.8
+ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
+RUBY = $(ruby)
+RM = rm -f
+MAKEDIRS = mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(libdir)
+LIBPATH = -L"." -L"$(libdir)"
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+
+extout =
+extout_prefix =
+target_prefix = /quail
+LOCAL_LIBS = /Users/aaron/git/quail/vendor/lib/libzmq.a
+LIBS = $(LIBRUBYARG_SHARED) -lstdc++ -lpthread -ldl -lm
+SRCS = native.c czmq.cpp
+OBJS = native.o czmq.o
+TARGET = native
+DLLIB = $(TARGET).bundle
+EXTSTATIC =
+STATIC_LIB =
+
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
+CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
+
+all: $(DLLIB)
+static: $(STATIC_LIB)
+
+clean:
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
+
+distclean: clean
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: $(RUBYARCHDIR)
+install-so: $(RUBYARCHDIR)/$(DLLIB)
+$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+$(RUBYARCHDIR):
+ $(MAKEDIRS) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+.SUFFIXES: .c .m .cc .cxx .cpp .C .o
+
+.cc.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.cxx.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.cpp.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.C.o:
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
+
+.c.o:
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
+
+$(DLLIB): $(OBJS)
+ @-$(RM) $@
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
+
+
+
+$(OBJS): ruby.h defines.h
File renamed without changes.
File renamed without changes.
View
Binary file not shown.
View
@@ -0,0 +1,15 @@
+ENV["ARCHFLAGS"] = "-arch #{`uname -p` =~ /powerpc/ ? 'ppc' : 'i386'}"
+
+require 'mkmf'
+
+$CFLAGS << " -dynamiclib -bundle -flat_namespace -undefined suppress -pthread -fPIC "
+vendor_dir = File.expand_path(
+ File.join(File.dirname(__FILE__), '../', '../', 'vendor')
+)
+
+$LOCAL_LIBS << "#{File.join(vendor_dir, 'lib', 'libzmq.a')}"
+
+$libs = append_library($libs, "stdc++")
+find_header('zmq/message.hpp', "#{File.join(vendor_dir, 'include')}")
+
+create_makefile('quail/native')
View
Binary file not shown.
View
@@ -0,0 +1,10 @@
+#include <native.h>
+
+VALUE mQuail;
+
+void Init_native()
+{
+ mQuail = rb_define_module("Quail");
+ rb_const_set(mQuail, rb_intern("LOCAL"), INT2NUM(CZMQ_SCOPE_LOCAL));
+ rb_const_set(mQuail, rb_intern("GLOBAL"), INT2NUM(CZMQ_SCOPE_GLOBAL));
+}
View
@@ -0,0 +1,8 @@
+#ifndef QUAIL_NATIVE
+#define QUAIL_NATIVE
+
+#include <stdlib.h>
+#include <ruby.h>
+#include <czmq.h>
+
+#endif
View
Binary file not shown.
View
@@ -1,86 +0,0 @@
-
-#include <stddef.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/time.h>
-
-#include "czmq.h"
-
-inline uint64_t now_usecs ()
-{
- struct timeval tv;
- int rc;
-
- rc = gettimeofday (&tv, NULL);
- assert (rc == 0);
- return tv.tv_sec * (uint64_t) 1000000 + tv.tv_usec;
-}
-
-int main (int argc, char *argv [])
-{
- const char *host;
- int message_size;
- int roundtrip_count;
- void *handle;
- int eid;
- int counter;
- void *out_buf;
- void *in_buf;
- size_t in_size;
- czmq_free_fn *in_ffn;
-
- // Parse command line arguments.
- if (argc != 4) {
- printf ("usage: local_lat <hostname> <message-size> "
- "<roundtrip-count>\n");
- return 1;
- }
- host = argv [1];
- message_size = atoi (argv [2]);
- roundtrip_count = atoi (argv [3]);
-
- // Print out the test parameters.
- printf ("message size: %d [B]\n", message_size);
- printf ("roundtrip count: %d\n", roundtrip_count);
-
- // Create 0MQ transport.
- handle = czmq_create (host);
-
- // Create the wiring.
- eid = czmq_create_exchange (handle, "EL", CZMQ_SCOPE_LOCAL, NULL);
- czmq_create_queue (handle, "QL", CZMQ_SCOPE_LOCAL, NULL);
- czmq_bind (handle, "EL", "QG");
- czmq_bind (handle, "EG", "QL");
-
- // Create message data to send.
- out_buf = malloc (message_size);
- assert (out_buf);
-
- // Get initial timestamp.
- uint64_t start = now_usecs ();
-
- for (counter = 0; counter != roundtrip_count; counter ++) {
- czmq_send (handle, eid, out_buf, message_size, NULL);
- czmq_receive (handle, &in_buf, &in_size, &in_ffn);
- assert (in_size == message_size);
- if (in_ffn)
- in_ffn (in_buf);
- }
-
- // Get final timestamp.
- uint64_t end = now_usecs ();
-
- // Compute and print out the latency.
- double latency = (double) (end - start) / roundtrip_count / 2;
- printf ("Your average latency is %.2lf [us]\n", latency);
-
- // Destroy 0MQ transport.
- czmq_destroy (handle);
-
- // Clean up.
- free (out_buf);
-
- return 0;
-}
View
@@ -1,90 +0,0 @@
-
-#include <stddef.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/time.h>
-
-#include "czmq.h"
-
-inline uint64_t now_usecs ()
-{
- struct timeval tv;
- int rc;
-
- rc = gettimeofday (&tv, NULL);
- assert (rc == 0);
- return tv.tv_sec * (uint64_t) 1000000 + tv.tv_usec;
-}
-
-int main (int argc, char *argv [])
-{
- const char *host;
- const char *interface;
- int message_size;
- int message_count;
- void *handle;
- int eid;
- int counter;
- void *buf;
- size_t size;
- czmq_free_fn *ffn;
- uint64_t start;
- uint64_t end;
-
- // Parse command line arguments.
- if (argc != 5) {
- printf ("usage: local_thr <hostname> <interface> "
- "<message-size> <message-count>\n");
- return 1;
- }
- host = argv [1];
- interface = argv [2];
- message_size = atoi (argv [3]);
- message_count = atoi (argv [4]);
-
- // Print out the test parameters.
- printf ("message size: %d [B]\n", message_size);
- printf ("message count: %d\n", message_count);
-
- // Create 0MQ transport.
- handle = czmq_create (host);
-
- // Create the wiring.
- czmq_create_queue (handle, "Q", CZMQ_SCOPE_GLOBAL, interface);
-
- // Receive first message.
- czmq_receive (handle, &buf, &size, &ffn);
- assert (size == message_size);
- if (buf && ffn)
- ffn (buf);
-
- // Get initial timestamp.
- start = now_usecs ();
-
- for (counter = 0; counter != message_count; counter ++) {
- czmq_receive (handle, &buf, &size, &ffn);
- assert (size == message_size);
- if (buf && ffn)
- ffn (buf);
- }
-
- // Get terminal timestamp.
- end = now_usecs ();
-
- // Compute and print out the throughput.
- uint64_t message_throughput = 1000000 * (uint64_t) message_count /
- (end - start);
- uint64_t megabit_throughput = message_throughput * message_size * 8 /
- 1000000;
- printf ("Your average throughput is %ld [msg/s]\n",
- (long) message_throughput);
- printf ("Your average throughput is %ld [Mb/s]\n",
- (long) megabit_throughput);
-
- // Destroy 0MQ transport.
- czmq_destroy (handle);
-
- return 0;
-}
Oops, something went wrong.

0 comments on commit 848900f

Please sign in to comment.