Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

OS-1677 Add Makefile sections for node-dtrace module.

  • Loading branch information...
commit 84c61f02bf3ecc96e6c6b597e50e88d9ed455595 1 parent 212dd78
@joshwilsdon joshwilsdon authored
Showing with 68 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +66 −0 src/Makefile
  3. +1 −0  src/manifest
View
1  .gitignore
@@ -46,6 +46,7 @@ man/man/man1m/vmadmd.1m
src/diskinfo
src/disklayout
src/mkzpool
+src/node-dtrace-provider/build
src/node-sqlite3/build/
src/node-zsock/.lock-wscript
src/node-zsock/build/
View
66 src/Makefile
@@ -114,6 +114,48 @@ $(KSTAT.NODE) : LDFLAGS += $(NODE_LDFLAGS)
$(KSTAT.NODE) : LIBS += -lkstat
#
+# The dtrace-provider add-on uses a combination of C, assembly and C++ files in
+# multiple directories.
+#
+DTRACE_PROVIDER_OBJDIR = node-dtrace-provider/build/Release
+DTRACE_PROVIDER_SRCDIR = node-dtrace-provider
+DTRACE_PROVIDER.NODE = $(DTRACE_PROVIDER_OBJDIR)/dtrace-provider.node
+
+DTRACE_PROVIDER_SRCS += \
+ dtrace_probe.cc \
+ dtrace_provider.cc
+
+DTRACE_PROVIDER_LIBUSDT_SRCS += \
+ libusdt/usdt.c \
+ libusdt/usdt_dof_file.c \
+ libusdt/usdt_probe.c \
+ libusdt/usdt_dof.c \
+ libusdt/usdt_dof_sections.c
+
+DTRACE_PROVIDER_LIBUSDT_ASM_SRCS += \
+ libusdt/usdt_tracepoints_i386.s
+
+DTRACE_PROVIDER_HDRS += \
+ node-dtrace-provider/dtrace_provider.h \
+ node-dtrace-provider/libusdt/usdt_internal.h \
+ node-dtrace-provider/libusdt/usdt.h
+
+DTRACE_PROVIDER_OBJS += \
+ $(DTRACE_PROVIDER_SRCS:%.cc=$(DTRACE_PROVIDER_OBJDIR)/%.o) \
+ $(DTRACE_PROVIDER_LIBUSDT_SRCS:%.c=$(DTRACE_PROVIDER_OBJDIR)/%.o) \
+ $(DTRACE_PROVIDER_LIBUSDT_ASM_SRCS:%.s=$(DTRACE_PROVIDER_OBJDIR)/%.o)
+
+$(DTRACE_PROVIDER.NODE) : WARN_FLAGS += -Wno-unused -Wno-sign-compare
+$(DTRACE_PROVIDER.NODE) : CFLAGS += $(NODE_CFLAGS)
+$(DTRACE_PROVIDER.NODE) : CPPFLAGS += \
+ $(NODE_CPPFLAGS) \
+ -Inode-dtrace-provider/libusdt
+$(DTRACE_PROVIDER.NODE) : CXXFLAGS += $(NODE_CFLAGS)
+$(DTRACE_PROVIDER.NODE) : LDFLAGS += $(NODE_LDFLAGS)
+
+CLEANFILES += $(DTRACE_PROVIDER.NODE) $(DTRACE_PROVIDER_OBJS)
+
+#
# The sqlite3 add-on uses a combination of C + C++ files in multiple
# directories, and has multiple header directories as well.
#
@@ -243,6 +285,7 @@ TARGETS = \
zfs_send \
zoneevent \
$(EXPAT.NODE) \
+ $(DTRACE_PROVIDER.NODE) \
$(KSTAT.NODE) \
$(SYSLOG.NODE) \
$(SQLITE3_BINDINGS.NODE) \
@@ -293,6 +336,7 @@ install: all
cp $(ZUTIL_BINDINGS.NODE) \
$(PREFIX_NODE)/node_modules/zutil/build/Release
cp $(EXPAT.NODE) $(PREFIX_NODE)/node_modules/expat_binding.node
+ cp $(DTRACE_PROVIDER.NODE) $(PREFIX_NODE)/node_modules/dtrace-provider.node
sed -e "s|var expat.*;|var expat = require('./expat_binding');|" \
< node-expat/lib/node-expat.js \
> $(PREFIX_NODE)/node_modules/node-expat.js
@@ -390,6 +434,28 @@ $(EXPAT.NODE): node-expat/node-expat.cc
@mkdir -p $(EXPAT_OBJDIR)
$(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
+#
+# The next two are used to build libusdt files into
+# $(DTRACE_PROVIDER_OBJDIR)/libusdt/*.o, instead of building libusdt.a
+#
+$(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.c \
+ $(DTRACE_PROVIDER_HDRS)
+ @mkdir -p $(DTRACE_PROVIDER_OBJDIR)/libusdt
+ $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
+$(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.s
+ @mkdir -p $(DTRACE_PROVIDER_OBJDIR)/libusdt
+ $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
+$(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.cc \
+ $(DTRACE_PROVIDER_HDRS)
+ @mkdir -p $(DTRACE_PROVIDER_OBJDIR)
+ $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ -c $<
+
+$(DTRACE_PROVIDER.NODE): $(DTRACE_PROVIDER_OBJS)
+ @mkdir -p $(DTRACE_PROVIDER_OBJDIR)
+ $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $(DTRACE_PROVIDER_OBJS) $(LIBS)
+
$(KSTAT.NODE): node-kstat/kstat.cc
@mkdir -p $(KSTAT_OBJDIR)
$(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
View
1  src/manifest
@@ -138,6 +138,7 @@ d usr/node/0.8 0555 root bin
d usr/node/0.8/node_modules 0555 root bin
f usr/node/0.8/node_modules/async.js 0444 root bin
f usr/node/0.8/node_modules/disklayout.js 0444 root bin
+f usr/node/0.8/node_modules/dtrace-provider.node 0444 root bin
f usr/node/0.8/node_modules/getopt.js 0444 root bin
f usr/node/0.8/node_modules/kstat.node 0444 root bin
f usr/node/0.8/node_modules/onlyif.js 0444 root bin
Please sign in to comment.
Something went wrong with that request. Please try again.