1 #
   2 # Copyright (c) 2012, Joyent, Inc.  All rights reserved.
   3 #
   4 
   5 include Makefile.defs
   6 
   7 #
   8 # ROOT is used only when building and running the below tools.
   9 #
  10 ROOT =          $(PWD)/..
  11 JSSTYLE =       $(ROOT)/tools/jsstyle/jsstyle
  12 JSLINT =        $(ROOT)/tools/javascriptlint/build/install/jsl
  13 CSTYLE =        $(ROOT)/tools/cstyle
  14 
  15 #
  16 # Tool options
  17 #
  18 JSSTYLE_OPTS = -o indent=4,strict-indent=1,doxygen,unparenthesized-return=0,continuation-at-front=1,leading-right-paren-ok=1
  19 
  20 JSSTYLE_OLDSKOOL_OPTS =
  21 
  22 #
  23 # Installation configuration.  Note that DESTDIR in particular is also
  24 # assumed to contain various build tools, headers, libraries, and other
  25 # artifacts of the platform build from which we incorporate runtime
  26 # dependency information.  The default DESTDIR is for standalone builds
  27 # only (i.e., without the rest of the platform) and is unlikely to work
  28 # without extra effort; it is overridden when make is invoked in this
  29 # subdirectory.
  30 #
  31 DESTDIR =               ../proto
  32 
  33 #
  34 # DESTNAME is used for the manifest target.  We set it to something
  35 # obvious here so that if it's not set, the manifest target doesn't do
  36 # bad things.
  37 #
  38 DESTNAME =      live.manifest
  39 
  40 SMARTDCBINDIR = $(DESTDIR)/smartdc/bin
  41 SMARTDCLIBDIR = $(DESTDIR)/smartdc/lib
  42 
  43 #
  44 # Per-target variable definitions go here.  See Makefile.defs and the targets
  45 # below and in Makefile.targ to see what's useful to append to or override.
  46 # If you need to create your own target anyway, you can either modify
  47 # variables here or incorporate your changes directly into the target; we
  48 # prefer modifying the generic variable to the extent that the change fits
  49 # naturally with an existing one so that we can pick up general changes in
  50 # Makefile.defs even for custom targets.
  51 #
  52 bootparams :    LIBS +=         -ldevinfo
  53 bootparams :    WARN_FLAGS +=   -Wno-unused
  54 diskinfo :      LIBS +=         -ldladm -ldiskmgt -lnvpair
  55 zfs_recv :      LIBS +=         -lsocket
  56 zfs_send :      LIBS +=         -lsocket
  57 vmbundle :      CPPFLAGS +=     -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
  58 sdc-on-tty :    CFLAGS +=       $(OPT_FLAG)
  59 zoneevent :     LIBS +=         -lnvpair -lsysevent
  60 
  61 # These files will get run through jsstyle and jslint on 'make check'
  62 JS_CHECK_TARGETS=\
  63         node_modules/{system,onlyif}.js \
  64         vm/sbin/*.js \
  65         vm/node_modules/{qmp,VM,dladm}.js \
  66         img/lib/*.js \
  67         img/sbin/imgadm
  68 
  69 JS_CHECK_OLDSKOOL_TARGETS = \
  70         disklayout.js \
  71         mkzpool.js \
  72         node_modules/disklayout.js
  73 
  74 # These files will get run through cstyle on 'make check'
  75 C_CHECK_TARGETS=\
  76         qemu-exec.c \
  77         vmunbundle.c \
  78         zfs_recv.c \
  79         zfs_send.c \
  80         zoneevent.c
  81 
  82 #
  83 # Generic flags we apply by default to everything.
  84 #
  85 CFLAGS +=       $(WARN_FLAGS)
  86 CXXFLAGS =      $(CFLAGS)
  87 
  88 #
  89 # Node native add-on patterns.  For add-ons with a single source file in the
  90 # root of the add-on tree and no headers of its own, follow the EXPAT.NODE
  91 # pattern here and below in the targets.  More complex examples (source
  92 # subdirectory, headers, multiple C++ sources) follow; see associated comments
  93 # if you are looking for a pattern to copy.
  94 #
  95 EXPAT_OBJDIR =  node-expat/build/Release
  96 EXPAT.NODE =    $(EXPAT_OBJDIR)/node-expat.node
  97 
  98 $(EXPAT.NODE) : WARN_FLAGS +=   -Wno-unused
  99 $(EXPAT.NODE) : CPPFLAGS +=     $(NODE_CPPFLAGS)
 100 $(EXPAT.NODE) : CXXFLAGS +=     $(NODE_CFLAGS)
 101 $(EXPAT.NODE) : LDFLAGS +=      $(NODE_LDFLAGS)
 102 $(EXPAT.NODE) : LIBS +=         -lexpat
 103 
 104 #
 105 # The kstat Node add-on follows the same pattern as EXPAT.NODE.
 106 #
 107 KSTAT_OBJDIR =  node-kstat/build/Release
 108 KSTAT.NODE =    $(KSTAT_OBJDIR)/kstat.node
 109 
 110 $(KSTAT.NODE) : WARN_FLAGS +=   -Wno-unused -Wno-write-strings -Wno-sign-compare
 111 $(KSTAT.NODE) : CPPFLAGS +=     $(NODE_CPPFLAGS)
 112 $(KSTAT.NODE) : CXXFLAGS +=     $(NODE_CFLAGS)
 113 $(KSTAT.NODE) : LDFLAGS +=      $(NODE_LDFLAGS)
 114 $(KSTAT.NODE) : LIBS +=         -lkstat
 115 
 116 #
 117 # The dtrace-provider add-on uses a combination of C, assembly and C++ files in
 118 # multiple directories.
 119 #
 120 DTRACE_PROVIDER_OBJDIR =        node-dtrace-provider/build/Release
 121 DTRACE_PROVIDER_SRCDIR =        node-dtrace-provider
 122 DTRACE_PROVIDER.NODE =          $(DTRACE_PROVIDER_OBJDIR)/dtrace-provider.node
 123 
 124 DTRACE_PROVIDER_SRCS += \
 125                         dtrace_probe.cc \
 126                         dtrace_provider.cc
 127 
 128 DTRACE_PROVIDER_LIBUSDT_SRCS += \
 129                         libusdt/usdt.c \
 130                         libusdt/usdt_dof_file.c \
 131                         libusdt/usdt_probe.c \
 132                         libusdt/usdt_dof.c \
 133                         libusdt/usdt_dof_sections.c
 134 
 135 DTRACE_PROVIDER_LIBUSDT_ASM_SRCS += \
 136                         libusdt/usdt_tracepoints_i386.s
 137 
 138 DTRACE_PROVIDER_HDRS += \
 139                         node-dtrace-provider/dtrace_provider.h \
 140                         node-dtrace-provider/libusdt/usdt_internal.h \
 141                         node-dtrace-provider/libusdt/usdt.h
 142 
 143 DTRACE_PROVIDER_OBJS += \
 144                         $(DTRACE_PROVIDER_SRCS:%.cc=$(DTRACE_PROVIDER_OBJDIR)/%.o) \
 145                         $(DTRACE_PROVIDER_LIBUSDT_SRCS:%.c=$(DTRACE_PROVIDER_OBJDIR)/%.o) \
 146                         $(DTRACE_PROVIDER_LIBUSDT_ASM_SRCS:%.s=$(DTRACE_PROVIDER_OBJDIR)/%.o)
 147 
 148 $(DTRACE_PROVIDER.NODE) :       WARN_FLAGS +=   -Wno-unused -Wno-sign-compare
 149 $(DTRACE_PROVIDER.NODE) :       CFLAGS +=       $(NODE_CFLAGS)
 150 $(DTRACE_PROVIDER.NODE) :       CPPFLAGS +=     \
 151                                         $(NODE_CPPFLAGS) \
 152                                         -Inode-dtrace-provider/libusdt
 153 $(DTRACE_PROVIDER.NODE) :       CXXFLAGS +=     $(NODE_CFLAGS)
 154 $(DTRACE_PROVIDER.NODE) :       LDFLAGS +=      $(NODE_LDFLAGS)
 155 
 156 CLEANFILES +=   $(DTRACE_PROVIDER.NODE) $(DTRACE_PROVIDER_OBJS)
 157 
 158 #
 159 # The sqlite3 add-on uses a combination of C + C++ files in multiple
 160 # directories, and has multiple header directories as well.
 161 #
 162 SQLITE3_OBJDIR =        node-sqlite3/build/Release
 163 SQLITE3_SRCDIR =        node-sqlite3/src
 164 SQLITE3_LIBSRCDIR =     node-sqlite3/deps/sqlite3
 165 SQLITE3_BINDINGS.NODE = $(SQLITE3_OBJDIR)/node_sqlite3.node
 166 
 167 SQLITE3_SRCS += \
 168         database.cc \
 169         node_sqlite3.cc \
 170         statement.cc
 171 
 172 SQLITE3_LIBSRCS +=      sqlite3.c
 173 
 174 SQLITE3_NODEHDRS += \
 175         async.h \
 176         macros.h \
 177         statement.h \
 178         threading.h
 179 
 180 SQLITE3_LIBHDRS += \
 181         sqlite3.h \
 182         sqlite3ext.h
 183 
 184 SQLITE3_OBJS =          \
 185                         $(SQLITE3_SRCS:%.cc=$(SQLITE3_OBJDIR)/%.o) \
 186                         $(SQLITE3_LIBSRCS:%.c=$(SQLITE3_OBJDIR)/%.o)
 187 SQLITE3_HDRS =          \
 188                         $(SQLITE3_NODEHDRS:%=$(SQLITE3_SRCDIR)/%) \
 189                         $(SQLITE3_LIBHDRS:%=$(SQLITE3_LIBSRCDIR)/%)
 190 CLEANFILES +=           $(SQLITE3_OBJS)
 191 
 192 SQLITE3_FLAGS = \
 193                                 -fdata-sections \
 194                                 -ffunction-sections \
 195                                 -fno-omit-frame-pointer \
 196                                 -fno-strict-aliasing \
 197                                 -fno-exceptions
 198 
 199 $(SQLITE3_BINDINGS.NODE) :      WARN_FLAGS =    -Wall -Werror
 200 $(SQLITE3_BINDINGS.NODE) :      CPPFLAGS += \
 201                                 $(NODE_CPPFLAGS) \
 202                                 -I$(SQLITE3_LIBSRCDIR) \
 203                                 -D_SQLITE_THREADSAFE=1 \
 204                                 -D_SQLITE_ENABLE_FTS3 \
 205                                 -D_SQLITE_ENABLE_RTREE \
 206                                 -D_LARGEFILE_SOURCE \
 207                                 -D_FILE_OFFSET_BITS=64 \
 208                                 -D_REENTRANT \
 209                                 -D_NDEBUG \
 210                                 -D_POSIX_PTHREAD_SEMANTICS
 211 $(SQLITE3_BINDINGS.NODE) :      CFLAGS += \
 212                                 $(NODE_CFLAGS) \
 213                                 $(SQLITE3_FLAGS)
 214 $(SQLITE3_BINDINGS.NODE) :      LDFLAGS += \
 215                                 $(NODE_LDFLAGS) \
 216                                 -Wl,-soname=node_sqlite3.node
 217 $(SQLITE3_BINDINGS.NODE) :      LIBS += -lpthread
 218 
 219 #
 220 # The zsock add-on places its single source file in a subdirectory.
 221 #
 222 ZSOCK_OBJDIR =  node-zsock/build/Release
 223 ZSOCK_SRCDIR =  node-zsock/src
 224 ZSOCK_BINDINGS.NODE =   $(ZSOCK_OBJDIR)/zsock_bindings.node
 225 
 226 $(ZSOCK_BINDINGS.NODE) :        WARN_FLAGS =    -Wall -Werror
 227 $(ZSOCK_BINDINGS.NODE) :        CPPFLAGS += \
 228                                 $(NODE_CPPFLAGS) \
 229                                 -D_REENTRANT \
 230                                 -D_POSIX_PTHREAD_SEMANTICS \
 231                                 -D_XOPEN_SOURCE_EXTENDED=1 \
 232                                 -D__EXTENSIONS__ \
 233                                 -DSunOS
 234 $(ZSOCK_BINDINGS.NODE) :        CXXFLAGS += \
 235                                 $(NODE_CFLAGS) \
 236                                 -std=c++98
 237 $(ZSOCK_BINDINGS.NODE) :        LDFLAGS +=      $(NODE_LDFLAGS)
 238 $(ZSOCK_BINDINGS.NODE) :        LIBS +=         -lsocket -lnsl -lcontract
 239 
 240 #
 241 # The zutil add-on places its multiple source files in a subdirectory, and
 242 # builds them against some headers that it also supplies and needs to depend on.
 243 # Because we must build intermediate object files, this requires a
 244 # different target pattern as well; see below.
 245 #
 246 ZUTIL_OBJDIR =  node-zutil/build/Release
 247 ZUTIL_SRCDIR =  node-zutil/src
 248 ZUTIL_BINDINGS.NODE =   $(ZUTIL_OBJDIR)/zutil_bindings.node
 249 
 250 ZUTIL_SRCS += \
 251         zone.cc \
 252         zonecfg.cc \
 253         zutil_bindings.cc
 254 
 255 ZUTIL_HDRS += \
 256         zone.h \
 257         zonecfg.h \
 258         zutil_common.h
 259 
 260 ZUTIL_BINDINGS_OBJS =   $(ZUTIL_SRCS:%.cc=$(ZUTIL_OBJDIR)/%.o)
 261 ZUTIL_BINDINGS_HDRS =   $(ZUTIL_HDRS:%=$(ZUTIL_SRCDIR)/%)
 262 CLEANFILES +=           $(ZUTIL_BINDINGS_OBJS)
 263 
 264 $(ZUTIL_BINDINGS.NODE) :        WARN_FLAGS +=   -Wno-unused
 265 $(ZUTIL_BINDINGS.NODE) :        CPPFLAGS +=     $(NODE_CPPFLAGS) -DSunOS
 266 $(ZUTIL_BINDINGS.NODE) :        CXXFLAGS +=     $(NODE_CFLAGS)
 267 $(ZUTIL_BINDINGS.NODE) :        LDFLAGS +=      $(NODE_LDFLAGS)
 268 $(ZUTIL_BINDINGS.NODE) :        LIBS +=         -lzonecfg
 269 
 270 #
 271 # List of targets.  TARGETS, SMARTDC_TARGETS, and SMARTDC_LIB_TARGETS must
 272 # include only those files that are safe to remove when the clean target is
 273 # built.
 274 #
 275 TARGETS = \
 276         bootparams \
 277         diskinfo \
 278         disklayout \
 279         disklist \
 280         disk_size \
 281         mkzpool \
 282         removable_disk \
 283         vmunbundle \
 284         zfs_recv \
 285         zfs_send \
 286         zoneevent \
 287         $(EXPAT.NODE) \
 288         $(DTRACE_PROVIDER.NODE) \
 289         $(KSTAT.NODE) \
 290         $(SYSLOG.NODE) \
 291         $(SQLITE3_BINDINGS.NODE) \
 292         $(ZSOCK_BINDINGS.NODE) \
 293         $(ZUTIL_BINDINGS.NODE)
 294 
 295 USR_LIB_TARGETS = \
 296         measure_terminal
 297 
 298 SMARTDC_TARGETS = \
 299         qemu-exec
 300 
 301 SMARTDC_LIB_TARGETS = \
 302         sdc-on-tty
 303 
 304 all: $(TARGETS) $(USR_LIB_TARGETS) sysinfo $(SMARTDC_TARGETS) \
 305         $(SMARTDC_LIB_TARGETS)
 306 
 307 install: all
 308         mkdir -p $(DESTDIR)/usr/bin
 309         cp -p $(TARGETS) sysinfo $(DESTDIR)/usr/bin
 310         cp -p $(USR_LIB_TARGETS) sysinfo $(DESTDIR)/usr/lib
 311         mkdir -p $(DESTDIR)/smartdc/bin
 312         cp -p $(SMARTDC_TARGETS) $(DESTDIR)/smartdc/bin
 313         mkdir -p $(DESTDIR)/smartdc/lib
 314         cp -p $(SMARTDC_LIB_TARGETS) $(DESTDIR)/smartdc/lib
 315         mkdir -m 0755 -p $(PREFIX_NODE)/node_modules
 316         cp -Pr node_modules/* $(PREFIX_NODE)/node_modules
 317         cp $(KSTAT.NODE) $(PREFIX_NODE)/node_modules/
 318         rm -rf $(DESTDIR)/usr/vm
 319         cp -PR vm $(DESTDIR)/usr/
 320         mkdir -m 0755 -p $(DESTDIR)/usr/vm/node_modules
 321         mkdir -p $(PREFIX_NODE)/node_modules/{zsock,zutil}/build/Release
 322         mkdir -p $(DESTDIR)/usr/vm/test/tests
 323         cp -Pr vm/common $(DESTDIR)/usr/vm/test/
 324         cp -Pr vm/node-tap $(DESTDIR)/usr/vm/test/
 325         cp -Pr vm/tests $(DESTDIR)/usr/vm/test/
 326         cp vm/runtest $(DESTDIR)/usr/vm/test/
 327         cp vm/runtests $(DESTDIR)/usr/vm/test/
 328         cp -Pr node-zsock/{package.json,lib} \
 329             $(PREFIX_NODE)/node_modules/zsock
 330         cp -Pr node-zutil/{package.json,lib} \
 331             $(PREFIX_NODE)/node_modules/zutil
 332         cp $(SQLITE3_BINDINGS.NODE) \
 333             $(PREFIX_NODE)/node_modules
 334         (sed -e "s|var sqlite3.*;|var sqlite3 = module.exports = exports = require('./node_sqlite3');|" | \
 335             sed -e "s|var trace = require.*;|var trace = require('./sqlite3_trace')|") \
 336             < node-sqlite3/lib/sqlite3.js \
 337             > $(PREFIX_NODE)/node_modules/sqlite3.js
 338         cp node-sqlite3/lib/trace.js $(PREFIX_NODE)/node_modules/sqlite3_trace.js
 339         cp $(ZSOCK_BINDINGS.NODE) \
 340             $(PREFIX_NODE)/node_modules/zsock/build/Release
 341         cp $(ZUTIL_BINDINGS.NODE) \
 342             $(PREFIX_NODE)/node_modules/zutil/build/Release
 343         cp $(EXPAT.NODE) $(PREFIX_NODE)/node_modules/expat_binding.node
 344         cp $(DTRACE_PROVIDER.NODE) $(PREFIX_NODE)/node_modules/dtrace-provider.node
 345         sed -e "s|require('./build.*DTraceProviderBindings')|require('/usr/node/node_modules/dtrace-provider.node')|" \
 346             < $(DTRACE_PROVIDER_SRCDIR)/dtrace-provider.js \
 347             > $(PREFIX_NODE)/node_modules/dtrace-provider.js
 348         sed -e "s|var expat.*;|var expat = require('./expat_binding');|" \
 349             < node-expat/lib/node-expat.js \
 350             > $(PREFIX_NODE)/node_modules/node-expat.js
 351         cp zoneevent $(DESTDIR)/usr/vm/sbin/zoneevent
 352         cp zfs_send $(DESTDIR)/usr/vm/sbin/zfs_send
 353         cp zfs_recv $(DESTDIR)/usr/vm/sbin/zfs_recv
 354         cp vmunbundle $(DESTDIR)/usr/vm/sbin/vmunbundle
 355         mkdir -p $(DESTDIR)/lib/svc/manifest/system
 356         cp vm/smf/system-vmadmd.xml \
 357             $(DESTDIR)/lib/svc/manifest/system/system-vmadmd.xml
 358         cp vm/smf/system-metadata.xml \
 359             $(DESTDIR)/lib/svc/manifest/system/system-metadata.xml
 360         mv $(DESTDIR)/usr/vm/sbin/vmadmd.js $(DESTDIR)/usr/vm/sbin/vmadmd
 361         mv $(DESTDIR)/usr/vm/sbin/vmadm.js $(DESTDIR)/usr/vm/sbin/vmadm
 362         mv $(DESTDIR)/usr/vm/sbin/add-userscript.js \
 363             $(DESTDIR)/usr/vm/sbin/add-userscript
 364         mv $(DESTDIR)/usr/vm/sbin/metadata.js $(DESTDIR)/usr/vm/sbin/metadata
 365         mkdir -p $(DESTDIR)/usr/share/man/man1
 366         sed -e "s|require('dtrace-provider')|require('/usr/node/node_modules/dtrace-provider')|" \
 367             < node-bunyan/lib/bunyan.js \
 368             > $(PREFIX_NODE)/node_modules/bunyan.js
 369         cp node-bunyan/docs/bunyan.1 $(DESTDIR)/usr/share/man/man1/bunyan.1
 370         mkdir -p $(DESTDIR)/usr/bin
 371         sed -e 's|^#!/usr/bin/env node.*$$|#!/usr/node/bin/node|' \
 372             < node-bunyan/bin/bunyan \
 373             > $(DESTDIR)/usr/bin/bunyan
 374         cp node-panic/lib/panic.js $(PREFIX_NODE)/node_modules/panic.js
 375         cp node-panic/lib/subr.js $(PREFIX_NODE)/node_modules/subr.js
 376         rm -rf $(DESTDIR)/usr/img
 377         mkdir -m 0755 -p $(DESTDIR)/usr/img
 378         cp img/README.md $(DESTDIR)/usr/img/README.md
 379         cp img/package.json $(DESTDIR)/usr/img/package.json
 380         cp -PR img/etc $(DESTDIR)/usr/img/
 381         cp -PR img/lib $(DESTDIR)/usr/img/
 382         cp -PR img/man $(DESTDIR)/usr/img/
 383         cp -PR img/node_modules $(DESTDIR)/usr/img/
 384         cp -PR img/sbin $(DESTDIR)/usr/img/
 385         cp -PR img/test $(DESTDIR)/usr/img/
 386         rm -rf $(DESTDIR)/usr/fw
 387         mkdir -m 0755 -p $(DESTDIR)/usr/fw
 388         cp -PR fw/etc $(DESTDIR)/usr/fw/
 389         cp -PR fw/lib $(DESTDIR)/usr/fw/
 390         cp -PR fw/node_modules $(DESTDIR)/usr/fw/
 391         cp -PR fw/sbin $(DESTDIR)/usr/fw/
 392 
 393 check: $(JSLINT)
 394         @echo "==> Running cstyle..."
 395         @# cstyle doesn't echo as it goes so we add an echo to each line below
 396         @(for file in $(C_CHECK_TARGETS); do \
 397                 echo $(PWD)/$$file; \
 398                 $(CSTYLE) $$file; \
 399         done)
 400         @printf "\nC files ok!\n"
 401         @printf "\n==> Running JavaScriptLint...\n"
 402         @$(JSLINT) --nologo --conf=$(ROOT)/tools/jsl.node.conf \
 403             $(JS_CHECK_TARGETS) $(JS_CHECK_OLDSKOOL_TARGETS)
 404         @printf "\n==> Running jsstyle...\n"
 405         @# jsstyle doesn't echo as it goes so we add an echo to each line below
 406         (for file in $(JS_CHECK_TARGETS); do \
 407                 echo $(PWD)/$$file; \
 408                 $(JSSTYLE) $(JSSTYLE_OPTS) $$file; \
 409                 [[ $$? == "0" ]] || exit 1; \
 410         done)
 411         (for file in $(JS_CHECK_OLDSKOOL_TARGETS); do \
 412                 echo $(PWD)/$$file; \
 413                 $(JSSTYLE) $(JSSTYLE_OLDSKOOL_OPTS) $$file; \
 414                 [[ $$? == "0" ]] || exit 1; \
 415         done)
 416         @printf "\nJS style ok!\n"
 417 
 418 .PHONY: manifest
 419 manifest:
 420         (cat manifest && cd vm && \
 421             echo "# list of tests is autogenerated by smartos-live/src/Makefile" && \
 422             find tests/ -type f -exec echo "{}" "0444 root bin" \;) \
 423             | sed -e "s|^tests/|f usr/vm/test/tests/|" \
 424             > $(DESTDIR)/$(DESTNAME) \
 425 
 426 $(JSLINT):
 427         (cd $(ROOT); $(MAKE) jsl)
 428 
 429 clean:
 430         -rm -f $(TARGETS) $(SMARTDC_TARGETS) $(SMARTDC_LIB_TARGETS) *.o \
 431             $(CLEANFILES)
 432         -rm -rf node-sqlite3/build
 433 
 434 include Makefile.targ
 435 
 436 #
 437 # Custom rules for building our various real targets follow.  Generic rules
 438 # belong in Makefile.targ.
 439 #
 440 disklayout: disklayout.js
 441         cp disklayout.js disklayout
 442         chmod 0755 disklayout
 443 
 444 disklist: disklist.sh
 445         cp disklist.sh disklist
 446         chmod 0755 disklist
 447 
 448 mkzpool: mkzpool.js
 449         cp mkzpool.js mkzpool
 450         chmod 0755 mkzpool
 451 
 452 sysinfo:
 453         touch sysinfo
 454 
 455 #
 456 # Node native add-on target patterns.  Follow these patterns when adding a new
 457 # add-on and see the comment and definitions for EXPAT.NODE above as well.
 458 #
 459 $(EXPAT.NODE): node-expat/node-expat.cc
 460         @mkdir -p $(EXPAT_OBJDIR)
 461         $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
 462 
 463 #
 464 # The next two are used to build libusdt files into
 465 # $(DTRACE_PROVIDER_OBJDIR)/libusdt/*.o, instead of building libusdt.a
 466 #
 467 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.c \
 468             $(DTRACE_PROVIDER_HDRS)
 469         @mkdir -p $(DTRACE_PROVIDER_OBJDIR)/libusdt
 470         $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 471 
 472 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.s
 473         @mkdir -p $(DTRACE_PROVIDER_OBJDIR)/libusdt
 474         $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 475 
 476 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.cc \
 477             $(DTRACE_PROVIDER_HDRS)
 478         @mkdir -p $(DTRACE_PROVIDER_OBJDIR)
 479         $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ -c $<
 480 
 481 $(DTRACE_PROVIDER.NODE): $(DTRACE_PROVIDER_OBJS)
 482         @mkdir -p $(DTRACE_PROVIDER_OBJDIR)
 483         $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $(DTRACE_PROVIDER_OBJS) $(LIBS)
 484 
 485 $(KSTAT.NODE): node-kstat/kstat.cc
 486         @mkdir -p $(KSTAT_OBJDIR)
 487         $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
 488 
 489 $(SQLITE3_OBJDIR)/%.o: $(SQLITE3_SRCDIR)/%.cc $(SQLITE3_HDRS)
 490         @mkdir -p $(SQLITE3_OBJDIR)
 491         $(GXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
 492 
 493 $(SQLITE3_OBJDIR)/%.o: $(SQLITE3_LIBSRCDIR)/%.c $(SQLITE3_HDRS)
 494         @mkdir -p $(SQLITE3_OBJDIR)
 495         $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 496 
 497 $(SQLITE3_BINDINGS.NODE): $(SQLITE3_OBJS)
 498         $(GXX) $(LDFLAGS) -o $@ $(SQLITE3_OBJS) $(LIBS)
 499 
 500 $(ZSOCK_BINDINGS.NODE): $(ZSOCK_SRCDIR)/zsock.cc
 501         @mkdir -p $(ZSOCK_OBJDIR)
 502         $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
 503 
 504 #
 505 # The zutil add-on requires a slightly more complex 2-phase build.
 506 #
 507 $(ZUTIL_OBJDIR)/%.o: $(ZUTIL_SRCDIR)/%.cc $(ZUTIL_BINDINGS_HDRS)
 508         @mkdir -p $(ZUTIL_OBJDIR)
 509         $(GXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
 510 
 511 $(ZUTIL_BINDINGS.NODE): $(ZUTIL_BINDINGS_OBJS)
 512         $(GXX) $(LDFLAGS) -o $@ $(ZUTIL_BINDINGS_OBJS) $(LIBS)