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
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 \
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)
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)
|
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 lockfd Node add-on is based on v8plus, which has its own system of
120 # Makefiles.
121 #
122 LOCKFD_BINDING.NODE = node-lockfd/lib/lockfd_binding.node
123
124 LOCKFD_SRC_DIR = $(PWD)/node-lockfd/src
125 LOCKFD_V8PLUS_DIR = $(PWD)/node-lockfd/node_modules/v8plus
126
127 #
128 # The dtrace-provider add-on uses a combination of C, assembly and C++ files in
129 # multiple directories.
130 #
131 DTRACE_PROVIDER_OBJDIR = node-dtrace-provider/build/Release
132 DTRACE_PROVIDER_SRCDIR = node-dtrace-provider
133 DTRACE_PROVIDER.NODE = $(DTRACE_PROVIDER_OBJDIR)/dtrace-provider.node
134
135 DTRACE_PROVIDER_SRCS += \
136 dtrace_probe.cc \
137 dtrace_provider.cc
138
139 DTRACE_PROVIDER_LIBUSDT_SRCS += \
140 libusdt/usdt.c \
141 libusdt/usdt_dof_file.c \
142 libusdt/usdt_probe.c \
143 libusdt/usdt_dof.c \
144 libusdt/usdt_dof_sections.c
145
146 DTRACE_PROVIDER_LIBUSDT_ASM_SRCS += \
147 libusdt/usdt_tracepoints_i386.s
306 #
307 # List of targets. TARGETS, SMARTDC_TARGETS, and SMARTDC_LIB_TARGETS must
308 # include only those files that are safe to remove when the clean target is
309 # built.
310 #
311 TARGETS = \
312 bootparams \
313 diskinfo \
314 disklayout \
315 disklist \
316 disk_size \
317 mkzpool \
318 removable_disk \
319 vmunbundle \
320 zfs_recv \
321 zfs_send \
322 zoneevent \
323 $(EXPAT.NODE) \
324 $(DTRACE_PROVIDER.NODE) \
325 $(KSTAT.NODE) \
326 $(LOCKFD_BINDING.NODE) \
327 $(MICROTIME.NODE) \
328 $(SYSLOG.NODE) \
329 $(SQLITE3_BINDINGS.NODE) \
330 $(UUID.NODE) \
331 $(ZSOCK_BINDINGS.NODE) \
332 $(ZUTIL_BINDINGS.NODE)
333
334 USR_LIB_TARGETS = \
335 measure_terminal
336
337 SMARTDC_TARGETS = \
338 qemu-exec
339
340 SMARTDC_LIB_TARGETS = \
341 sdc-on-tty
342
343 all: $(TARGETS) $(USR_LIB_TARGETS) sysinfo nictagadm $(SMARTDC_TARGETS) \
344 $(SMARTDC_LIB_TARGETS)
345
346 install: all
347 mkdir -p $(DESTDIR)/usr/bin
348 cp -p $(TARGETS) sysinfo nictagadm $(DESTDIR)/usr/bin
349 cp -p $(USR_LIB_TARGETS) $(DESTDIR)/usr/lib
350 mkdir -p $(DESTDIR)/smartdc/bin
351 cp -p $(SMARTDC_TARGETS) $(DESTDIR)/smartdc/bin
352 mkdir -p $(DESTDIR)/smartdc/lib
353 cp -p $(SMARTDC_LIB_TARGETS) $(DESTDIR)/smartdc/lib
354 mkdir -m 0755 -p $(PREFIX_NODE)/node_modules
355 cp -Pr node_modules/* $(PREFIX_NODE)/node_modules
356 cp $(KSTAT.NODE) $(PREFIX_NODE)/node_modules/
357 cp node-lockfd/lib/index.js $(PREFIX_NODE)/node_modules/lockfd.js
358 cp $(LOCKFD_BINDING.NODE) $(PREFIX_NODE)/node_modules/lockfd_binding.node
359 cp $(MICROTIME.NODE) $(PREFIX_NODE)/node_modules/
360 rm -rf $(DESTDIR)/usr/vm
361 cp -PR vm $(DESTDIR)/usr/
362 mkdir -m 0755 -p $(DESTDIR)/usr/vm/node_modules
363 mkdir -p $(PREFIX_NODE)/node_modules/{zsock,zutil}/build/Release
364 mkdir -p $(DESTDIR)/usr/vm/test/tests
365 cp -Pr vm/common $(DESTDIR)/usr/vm/test/
366 cp -Pr vm/node-tap $(DESTDIR)/usr/vm/test/
367 cp -Pr vm/tests $(DESTDIR)/usr/vm/test/
368 cp vm/runtest $(DESTDIR)/usr/vm/test/
369 cp vm/runtests $(DESTDIR)/usr/vm/test/
370 cp -Pr node-zsock/{package.json,lib} \
371 $(PREFIX_NODE)/node_modules/zsock
372 cp -Pr node-zutil/{package.json,lib} \
373 $(PREFIX_NODE)/node_modules/zutil
374 cp $(SQLITE3_BINDINGS.NODE) \
375 $(PREFIX_NODE)/node_modules
376 (sed -e "s|var sqlite3.*;|var sqlite3 = module.exports = exports = require('./node_sqlite3');|" | \
377 sed -e "s|var trace = require.*;|var trace = require('./sqlite3_trace')|") \
378 < node-sqlite3/lib/sqlite3.js \
457 $(JSSTYLE) $(JSSTYLE_OLDSKOOL_OPTS) $$file; \
458 [[ $$? == "0" ]] || exit 1; \
459 done)
460 @printf "\nJS style ok!\n"
461
462 .PHONY: manifest
463 manifest:
464 (cat manifest && cd vm && \
465 echo "# list of tests is autogenerated by smartos-live/src/Makefile" && \
466 find tests/ -type f -exec echo "{}" "0444 root bin" \;) \
467 | sed -e "s|^tests/|f usr/vm/test/tests/|" \
468 > $(DESTDIR)/$(DESTNAME) \
469
470 $(JSLINT):
471 (cd $(ROOT); $(MAKE) jsl)
472
473 clean:
474 -rm -f $(TARGETS) $(SMARTDC_TARGETS) $(SMARTDC_LIB_TARGETS) *.o \
475 $(CLEANFILES)
476 -rm -rf node-sqlite3/build
477 cd $(LOCKFD_SRC_DIR) && $(MAKE) clean
478
479 include Makefile.targ
480
481 #
482 # Custom rules for building our various real targets follow. Generic rules
483 # belong in Makefile.targ.
484 #
485 disklayout: disklayout.js
486 cp disklayout.js disklayout
487 chmod 0755 disklayout
488
489 disklist: disklist.sh
490 cp disklist.sh disklist
491 chmod 0755 disklist
492
493 mkzpool: mkzpool.js
494 cp mkzpool.js mkzpool
495 chmod 0755 mkzpool
496
497 sysinfo:
498 touch sysinfo
499
500 nictagadm:
501 touch nictagadm
502
503 #
504 # Node native add-on target patterns. Follow these patterns when adding a new
505 # add-on and see the comment and definitions for EXPAT.NODE above as well.
506 #
507 $(EXPAT.NODE): node-expat/node-expat.cc
508 @mkdir -p $(EXPAT_OBJDIR)
509 $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
510
511 #
512 # node-lockfd is built using the v8plus-based Makefile contained within the
513 # project. We use LD_OPTIONS, here, to induce the linker to include libc,
514 # which gcc as configured in proto.strap does not, but which other C compilers
515 # generally do.
516 #
517 $(LOCKFD_BINDING.NODE): FRC
518 cd $(LOCKFD_SRC_DIR) && \
519 LD_OPTIONS=-lc \
520 $(MAKE) \
521 CC=$(GCC) CXX=$(GXX) \
522 PREFIX_NODE=$(PREFIX_NODE) \
523 NODE_EXEC=$(NODE_EXEC) \
524 V8PLUS=$(LOCKFD_V8PLUS_DIR) \
525 CTFCONVERT=$(CTFCONVERT) \
526 CTFMERGE=$(CTFMERGE)
527
528 #
529 # The next two are used to build libusdt files into
530 # $(DTRACE_PROVIDER_OBJDIR)/libusdt/*.o, instead of building libusdt.a
531 #
532 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.c \
533 $(DTRACE_PROVIDER_HDRS)
534 @mkdir -p $(DTRACE_PROVIDER_OBJDIR)/libusdt
535 $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
536
537 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.s
538 @mkdir -p $(DTRACE_PROVIDER_OBJDIR)/libusdt
539 $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
540
541 $(DTRACE_PROVIDER_OBJDIR)/%.o: $(DTRACE_PROVIDER_SRCDIR)/%.cc \
542 $(DTRACE_PROVIDER_HDRS)
543 @mkdir -p $(DTRACE_PROVIDER_OBJDIR)
544 $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ -c $<
545
546 $(DTRACE_PROVIDER.NODE): $(DTRACE_PROVIDER_OBJS)
547 @mkdir -p $(DTRACE_PROVIDER_OBJDIR)
548 $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $(DTRACE_PROVIDER_OBJS) $(LIBS)
566 $(SQLITE3_BINDINGS.NODE): $(SQLITE3_OBJS)
567 $(GXX) $(LDFLAGS) -o $@ $(SQLITE3_OBJS) $(LIBS)
568
569 $(UUID.NODE): $(UUID_SRCDIR)/uuid.cc
570 @mkdir -p $(UUID_OBJDIR)
571 $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
572
573 $(ZSOCK_BINDINGS.NODE): $(ZSOCK_SRCDIR)/zsock.cc
574 @mkdir -p $(ZSOCK_OBJDIR)
575 $(GXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
576
577 #
578 # The zutil add-on requires a slightly more complex 2-phase build.
579 #
580 $(ZUTIL_OBJDIR)/%.o: $(ZUTIL_SRCDIR)/%.cc $(ZUTIL_BINDINGS_HDRS)
581 @mkdir -p $(ZUTIL_OBJDIR)
582 $(GXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
583
584 $(ZUTIL_BINDINGS.NODE): $(ZUTIL_BINDINGS_OBJS)
585 $(GXX) $(LDFLAGS) -o $@ $(ZUTIL_BINDINGS_OBJS) $(LIBS)
586
587 FRC:
|