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