1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 4519 2017-10-08 15:41:54Z chrfranke $
8 ACLOCAL_AMFLAGS = -I m4
10 # Make sure .cpp takes precedence to avoid compiling old .c file
11 SUFFIXES = .cpp .c .s .o
13 # BUILD_INFO can be provided by package maintainers (see INSTALL file)
14 BUILD_INFO= "(local build)"
17 -DBUILD_INFO='$(BUILD_INFO)' \
18 -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"' \
19 -DSMARTMONTOOLS_SMARTDSCRIPTDIR='"$(smartdscriptdir)"'
22 AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"'
25 AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"'
27 if ENABLE_ATTRIBUTELOG
28 AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
32 AM_CPPFLAGS += -I$(srcdir)/os_win32
35 AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
38 AM_CPPFLAGS += -I$(srcdir)/regex
45 if ENABLE_UPDATE_SMART_DRIVEDB
48 sbin_SCRIPTS = update-smart-drivedb
87 smartctl_LDADD = $(os_deps) $(os_libs)
88 smartctl_DEPENDENCIES = $(os_deps)
90 EXTRA_smartctl_SOURCES = \
122 smartctl_LDADD += smartctl_res.o
123 smartctl_DEPENDENCIES += smartctl_res.o
134 dev_ata_cmd_set.cpp \
136 dev_intelliprop.cpp \
153 smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD)
154 smartd_DEPENDENCIES = $(os_deps)
156 EXTRA_smartd_SOURCES = \
184 freebsd_nvme_ioctl.h \
185 netbsd_nvme_ioctl.h \
191 os_win32/daemon_win32.cpp \
192 os_win32/daemon_win32.h \
193 os_win32/syslog_win32.cpp \
196 smartd_LDADD += smartd_res.o
197 smartd_DEPENDENCIES += smartd_res.o
201 # Exclude from source tarball
202 nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s
203 nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s
207 smartctl_SOURCES += \
221 smartctl_SOURCES += \
224 regex/regex_internal.h
229 regex/regex_internal.h
231 # Included by regex.c:
232 EXTRA_smartctl_SOURCES += \
235 regex/regex_internal.c
237 EXTRA_smartd_SOURCES += \
240 regex/regex_internal.c
246 smartctl_SOURCES += \
248 os_win32/wmiquery.cpp \
253 os_win32/wmiquery.cpp \
256 smartctl_LDADD += -lole32 -loleaut32
257 smartd_LDADD += -lole32 -loleaut32
262 # This block is required because Solaris uses manual page section 1m
263 # for administrative command (linux/freebsd use section 8) and Solaris
264 # uses manual page section 4 for file formats (linux/freebsd use
265 # section 5). Automake can deal cleanly with man page sections 1-8
266 # and n, but NOT with sections of the form 1m.
267 extra_MANS = smartd.conf.4 \
270 if ENABLE_UPDATE_SMART_DRIVEDB
271 extra_MANS += update-smart-drivedb.1m
274 all-local: $(extra_MANS)
275 install-man: $(extra_MANS)
277 $(MKDIR_P) '$(DESTDIR)$(mandir)/man4'
278 $(MKDIR_P) '$(DESTDIR)$(mandir)/man1m'
279 for i in $(extra_MANS); do \
280 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
282 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
283 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
284 inst=`echo $$inst | sed -e 's/^.*\///'`; \
285 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
286 echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
287 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
291 for i in $(extra_MANS); do \
292 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
294 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
295 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
296 inst=`echo $$inst | sed -e 's/^.*\///'`; \
297 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
298 echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
299 rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
302 # For systems that adopts traditional manner
304 man_MANS = smartd.conf.5 \
308 if ENABLE_UPDATE_SMART_DRIVEDB
309 man_MANS += update-smart-drivedb.8
326 examplesdir=$(exampledir)
328 examplescripts/README
330 examplescripts/Example1 \
331 examplescripts/Example2 \
332 examplescripts/Example3 \
333 examplescripts/Example4 \
334 examplescripts/Example5 \
335 examplescripts/Example6
337 sysconf_DATA = smartd.conf
339 # If modified smartd.conf exists install smartd.conf.sample instead
340 install-sysconfDATA: $(sysconf_DATA)
341 $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'
342 @s="$(srcdir)/smartd.conf"; \
343 f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
344 if test -z "$(smartd_suffix)" && test -f "$$f"; then \
345 if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
346 echo "************************************************************"; \
347 echo "*** $$f preserved"; \
348 echo "*** installing smartd.conf.sample instead"; \
349 echo "************************************************************"; \
353 echo " $(INSTALL_DATA) '$$s' '$$f'"; \
354 $(INSTALL_DATA) "$$s" "$$f"
356 # If smartd.conf.sample exists preserve smartd.conf
357 uninstall-sysconfDATA:
358 @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
359 if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
360 echo "************************************************************"; \
361 echo "*** $$f preserved"; \
362 echo "*** removing smartd.conf.sample instead"; \
363 echo "************************************************************"; \
366 echo " rm -f '$$f'"; \
369 smartdscript_SCRIPTS = smartd_warning.sh
375 smartd.freebsd.initd.in \
381 smartd_warning.sh.in \
382 update-smart-drivedb.in \
383 update-smart-drivedb.8.in \
385 os_darwin/com.smartmontools.smartd.plist.in \
386 os_darwin/pkg/PackageInfo.in \
387 os_darwin/pkg/Distribution.in \
388 os_darwin/pkg/installer/README.html \
389 os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall \
390 os_win32/default.manifest \
391 os_win32/installer.nsi \
393 os_win32/smartd_mailer.ps1 \
394 os_win32/smartd_mailer.conf.sample.ps1 \
395 os_win32/smartd_warning.cmd \
396 os_win32/syslogevt.mc \
397 os_win32/update-smart-drivedb.nsi \
398 os_win32/wbemcli_small.h \
399 os_win32/versioninfo.rc.in \
400 os_win32/wtssendmsg.c \
415 smartctl.8.html.tmp \
421 smartd.conf.5.html.tmp \
425 smartd.freebsd.initd \
429 update-smart-drivedb \
430 update-smart-drivedb.8 \
431 update-smart-drivedb.1m \
432 update-smart-drivedb.8.html \
433 update-smart-drivedb.8.html.tmp \
434 update-smart-drivedb.8.pdf \
435 update-smart-drivedb.8.txt \
438 # 'make maintainer-clean' also removes files generated by './autogen.sh'
439 MAINTAINERCLEANFILES = \
440 $(srcdir)/Makefile.in \
441 $(srcdir)/aclocal.m4 \
443 $(srcdir)/configure \
444 $(srcdir)/config.guess \
445 $(srcdir)/config.h.in \
446 $(srcdir)/config.h.in~ \
447 $(srcdir)/config.sub \
449 $(srcdir)/install-sh \
453 utility.o: svnversion.h
456 # Get version info from SVN
457 svnversion.h: ChangeLog Makefile $(svn_deps)
458 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
459 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
461 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
462 && TZ= LC_ALL=C svn info 2>/dev/null \
463 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
464 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
467 # SVN not available, guess version info from Id strings
468 svnversion.h: ChangeLog Makefile NEWS
469 @echo ' cat ChangeLog NEWS $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
470 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
471 @(cd $(srcdir) && cat ChangeLog NEWS Makefile.am configure.ac smart*.in *.cpp *.h) \
472 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
474 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
475 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
480 drivedb_DATA = drivedb.h
483 update-smart-drivedb: update-smart-drivedb.in config.status
484 $(SHELL) ./config.status --file=$@
487 smartd_warning.sh: smartd_warning.sh.in config.status
488 $(SHELL) ./config.status --file=$@
491 if INSTALL_INITSCRIPT
493 initd_DATA = com.smartmontools.smartd.plist
495 initd_DATA_install = install-initdDATA-darwin
496 initd_DATA_uninstall = uninstall-initdDATA-darwin
498 com.smartmontools.smartd.plist : os_darwin/com.smartmontools.smartd.plist.in
499 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
501 install-initdDATA-darwin: $(initd_DATA)
502 $(MKDIR_P) '$(DESTDIR)$(initddir)'
503 $(INSTALL_DATA) $(top_builddir)/$(initd_DATA) $(DESTDIR)$(initddir)/$(initd_DATA)
505 uninstall-initdDATA-darwin:
506 rm -f $(DESTDIR)$(initddir)/$(initd_DATA)
510 initd_DATA = $(initdfile)
512 $(initdfile): $(srcdir)/$(initdfile).in Makefile
513 sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
515 initd_install_name = smartd$(smartd_suffix)
517 initd_DATA_install = install-initdDATA-generic
518 initd_DATA_uninstall = uninstall-initdDATA-generic
520 install-initdDATA-generic: $(initd_DATA)
521 $(MKDIR_P) '$(DESTDIR)$(initddir)'
522 $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
524 uninstall-initdDATA-generic:
525 rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
529 initd_DATA_install = install-initdDATA-null
530 initd_DATA_uninstall = uninstall-initdDATA-null
532 install-initdDATA-null:
533 uninstall-initdDATA-null:
536 install-initdDATA : $(initd_DATA_install)
538 uninstall-initdDATA: $(initd_DATA_uninstall)
540 if INSTALL_SYSTEMDUNIT
541 systemdsystemunit_DATA = smartd.service
544 smartd.service: smartd.service.in Makefile
545 @echo ' $$(SMARTD_SERVICE_FILTER) < $(srcdir)/smartd.service.in > $@'
547 sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
548 if test -n '$(systemdenvfile)'; then \
549 sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
551 sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \
552 fi; } < $(srcdir)/smartd.service.in > $@
555 # Create empty directories if configured.
556 # Default install rules no longer create empty directories since automake 1.11.
558 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
559 test -n "$$d" || continue; \
560 echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
561 $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
564 install-data-local: installdirs-local
570 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
571 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
572 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
573 -e 's|/usr/local/share/man/|$(mandir)/|g' \
574 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
575 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
576 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
577 -e 's|!exampledir!|$(exampledir)/|g' \
578 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
579 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \
580 -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \
581 -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
582 -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
583 -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
584 -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
585 if test -n '$(drivedbdir)'; then \
586 sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
588 sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
590 if test '$(with_update_smart_drivedb)' = 'yes'; then \
593 sed '/^\.\\" %IF ENABLE_UPDATE_SMART_DRIVEDB/,/^\.\\" %ENDIF ENABLE_UPDATE_SMART_DRIVEDB/ s,^,.\\"\# ,' ; \
595 if test -n '$(initddir)'; then \
596 sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \
598 sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \
600 if test -n '$(savestates)'; then \
601 sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \
603 sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \
605 if test -n '$(attributelog)'; then \
606 sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \
608 sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \
610 if test -n '$(smartdplugindir)'; then \
611 sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
613 sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
615 if test -n '$(CAPNG_LDADD)'; then \
618 sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
620 if test '$(with_nvme_devicescan)' = 'yes'; then \
623 sed '/^\.\\" %IF ENABLE_NVME_DEVICESCAN/,/^\.\\" %ENDIF ENABLE_NVME_DEVICESCAN/ s,^,.\\"\# ,' ; \
625 if test -n '$(os_man_filter)'; then \
626 sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
627 -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
628 -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
629 -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
630 -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
631 -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
637 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
638 smartctl.8: smartctl.8.in Makefile svnversion.h
639 @echo ' $$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@'
640 @$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@
642 smartd.8: smartd.8.in Makefile svnversion.h
643 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@'
644 @$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@
646 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
647 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@'
648 @$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@
650 update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
651 @echo ' $$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@'
652 @$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@
654 # Build Solaris specific man pages
655 SOLARIS_MAN_FILTER = \
656 sed -e '/^\.TH/s, \([58]\) , !!\1!! ,' \
657 -e '/^\.BR/s, (\([578]\)), (!!\1!!),' \
658 -e 's,\\fP(\([578]\)),\\fP(!!\1!!),g' \
659 -e 's,!!5!!,4,g' -e 's,!!7!!,5,g' -e 's,!!8!!,1m,g' \
660 -e 's,/var/log/messages,/var/adm/messages,g'
662 smartctl.1m: smartctl.8
663 @echo ' $$(SOLARIS_MAN_FILTER) < smartctl.8 > $@'
664 @$(SOLARIS_MAN_FILTER) < smartctl.8 > $@
667 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.8 > $@'
668 @$(SOLARIS_MAN_FILTER) < smartd.8 > $@
670 smartd.conf.4: smartd.conf.5
671 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@'
672 @$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@
674 update-smart-drivedb.1m: update-smart-drivedb.8
675 @echo ' $$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@'
676 @$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@
679 # Convert man pages into .html, .pdf and .txt
682 #MAN2HTML = groff -man -Thtml
683 MAN2PDF = man -Tpdf -l
684 #MAN2PDF = groff -man -Tpdf
685 MAN2TXT = groff -man -Tascii -P'-bcou'
687 # Remove HTTP header and fix links in man2html output
688 FIXHTML = sed -e '1s,^Content-type.*,,' \
689 -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
690 -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \
691 -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
692 -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
694 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html update-smart-drivedb.8.html
696 pdfman: smartctl.8.pdf smartd.8.pdf smartd.conf.5.pdf update-smart-drivedb.8.pdf
698 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt update-smart-drivedb.8.txt
701 $(MAN2HTML) $< > $@.tmp
702 @echo ' $$(FIXHTML) < $@.tmp > $@'
703 @$(FIXHTML) < $@.tmp > $@
706 $(MAN2HTML) $< > $@.tmp
707 @echo ' $$(FIXHTML) < $@.tmp > $@'
708 @$(FIXHTML) < $@.tmp > $@
723 # Check drive database syntax
725 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
726 echo "$(srcdir)/drivedb.h: OK"; \
728 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
735 smartctl_res.o: smartctl_res.rc $(os_win32_manifest)
738 smartd_res.o: smartd_res.rc syslogevt.rc $(os_win32_manifest)
741 runcmda_res.o: runcmda_res.rc defadmin.manifest
744 runcmdu_res.o: runcmdu_res.rc $(os_win32_manifest)
747 wtssendmsg_res.o: wtssendmsg_res.rc $(os_win32_manifest)
750 # Convert version for VERSIONINFO resource: 6.6 r4519 -> 6.6.0.4519,
751 # set description, name, version and year
753 ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'` && \
754 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h` && \
755 txtver="$${ver:-0.0.0}.$${rev:-0}" && binver=`echo "$$txtver" | sed 's|\.|,|g'` && \
756 yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h` && yy="$${yy:-XX}" && \
757 sed -e "s|@DESC@|$$d|" -e "s|@NAME@|$$n|" -e "s|@BINARY_VERSION@|$$binver|g" \
758 -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; }
761 echo "n=$$n d=\"$$d"'"; $$(WIN_RC_FILTER) < $< > $@'; \
762 $(WIN_RC_FILTER) < $< > $@
765 if test -n '$(os_win32_manifest)'; then \
766 echo "echo '1 24 \"$(srcdir)/$(os_win32_manifest)\"' >> $@"; \
767 echo '1 24 "$(srcdir)/$(os_win32_manifest)"' >> $@; \
770 smartctl_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
771 @n=smartctl d="Control and Monitor Utility for SMART Disks"; $(WIN_MAKE_RES)
774 smartd_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
775 @n=smartd d="SMART Disk Monitoring Daemon"; $(WIN_MAKE_RES)
776 echo '#include "./syslogevt.rc"' >> $@
779 runcmdu_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
780 @n=runcmdu d="Run console command"; $(WIN_MAKE_RES)
783 runcmda_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
784 @n=runcmda d="Run console command as admin"; $(WIN_MAKE_RES)
785 echo '1 24 "./defadmin.manifest"' >> $@
787 wtssendmsg_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
788 @n=wtssendmsg d="Send console messages"; $(WIN_MAKE_RES)
791 syslogevt.rc: os_win32/syslogevt.mc
794 defadmin.manifest: os_win32/default.manifest
795 sed 's,"asInvoker","requireAdministrator",' $< > $@
797 # Definitions for Windows distribution
805 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
806 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
807 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
809 exedir_win32 = $(distdir_win32)/bin
810 docdir_win32 = $(distdir_win32)/doc
813 $(exedir_win32)/smartctl.exe \
814 $(exedir_win32)/smartctl-nc.exe \
815 $(exedir_win32)/smartd.exe \
816 $(exedir_win32)/smartd_mailer.ps1 \
817 $(exedir_win32)/smartd_mailer.conf.sample.ps1 \
818 $(exedir_win32)/smartd_warning.cmd \
819 $(exedir_win32)/runcmda.exe \
820 $(exedir_win32)/runcmdu.exe \
821 $(exedir_win32)/wtssendmsg.exe
826 $(exedir_win32)/update-smart-drivedb.exe
832 $(docdir_win32)/AUTHORS.txt \
833 $(docdir_win32)/ChangeLog.txt \
834 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
835 $(docdir_win32)/COPYING.txt \
836 $(docdir_win32)/INSTALL.txt \
837 $(docdir_win32)/NEWS.txt \
838 $(docdir_win32)/README.txt \
839 $(docdir_win32)/TODO.txt \
840 $(docdir_win32)/checksums$(win_bits).txt \
841 $(docdir_win32)/smartd.conf \
842 $(docdir_win32)/smartctl.8.html \
843 $(docdir_win32)/smartctl.8.pdf \
844 $(docdir_win32)/smartd.8.html \
845 $(docdir_win32)/smartd.8.pdf \
846 $(docdir_win32)/smartd.conf.5.html \
847 $(docdir_win32)/smartd.conf.5.pdf
851 $(exedir_win32)/drivedb.h
858 runcmda.exe runcmda_res.rc \
859 runcmdu.exe runcmdu_res.rc \
860 smartctl-nc.exe smartctl-nc.exe.tmp \
861 smartctl_res.rc smartd_res.rc \
863 syslogevt.rc syslogevt_*.bin \
864 update-smart-drivedb.exe \
865 wtssendmsg.exe wtssendmsg_res.rc
867 # Note: Only use without options to be compatible with all variants
870 # Build Windows distribution
872 dist-win32: $(distzip_win32)
874 install-win32: $(distinst_win32)
877 installer-win32: $(distinst_win32)
879 distdir-win32: distdir.mkdir $(FILES_WIN32)
881 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
882 @rm -fv $(distzip_win32)
883 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
886 sha256sum $@ > $@.sha256
889 # Build NSIS installer
890 # Note: Only option character '-' is also compatible with Linux version of makensis
891 $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
892 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
893 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h` && \
894 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h` && \
895 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO) && \
896 d64= && if [ -n '$(builddir_win64)' ]; then d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; fi && \
897 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<" && \
898 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
901 sha256sum $@ > $@.sha256
903 # Build drivedb.h update tool
904 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
905 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
909 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
914 rm -rf $(distdir_win32) distdir.mkdir
917 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
918 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
921 $(exedir_win32)/%.exe: %.exe
923 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
926 # strip would break NSIS integrity check
927 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
930 $(exedir_win32)/%.h: $(srcdir)/%.h
931 $(UNIX2DOS) < $< > $@
934 $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
935 $(UNIX2DOS) < $< > $@
938 $(exedir_win32)/%.ps1: $(srcdir)/os_win32/%.ps1
939 $(UNIX2DOS) < $< > $@
942 $(docdir_win32)/%.html: %.html
943 $(UNIX2DOS) < $< > $@
946 $(docdir_win32)/%.pdf: %.pdf
949 $(docdir_win32)/%.txt: $(srcdir)/%
950 $(UNIX2DOS) < $< > $@
953 $(docdir_win32)/%.conf: $(srcdir)/%.conf
954 $(UNIX2DOS) < $< > $@
957 $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
958 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
961 # Build non-console version of smartctl for GSmartControl.
962 # The script below changes the word at offset 220 (Subsystem) from 3
963 # (Console) to 2 (GUI) in a copy of smartctl.exe.
964 # This will be changed when a tool (like 'editbin') is available in
965 # the Cygwin distribution
966 smartctl-nc.exe: smartctl.exe
968 cp -p smartctl.exe $@.tmp
969 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
970 else echo "invalid EXE header"; exit 1; fi
971 @echo "editbin /subsystem:windows $@.tmp"
972 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
973 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
974 else echo "EXE patch failed"; exit 1; fi
977 # Build runcmd?.exe and wtssendmsg.exe
978 runcmd.o: os_win32/runcmd.c
981 runcmdu.exe: runcmd.o runcmdu_res.o
984 runcmda.exe: runcmd.o runcmda_res.o
987 wtssendmsg.exe: os_win32/wtssendmsg.c wtssendmsg_res.o
988 $(CC) -Os -o $@ $^ -lwtsapi32
990 # Build os_win32/vc14/{config.h,smart*.rc,svnversion.h} for MSVC14 from MinGW files
995 $(srcdir)/os_win32/vc$(vcver)/config.h \
996 $(srcdir)/os_win32/vc$(vcver)/smartctl_res.rc \
997 $(srcdir)/os_win32/vc$(vcver)/smartd_res.rc \
998 $(srcdir)/os_win32/vc$(vcver)/svnversion.h
1000 config-vc$(vcver): $(CONFIG_VC_FILES)
1002 $(srcdir)/os_win32/vc$(vcver)/config.h: config.h Makefile
1003 sed -e '1i/* os_win32/vc$(vcver)/config.h. Generated from config.h by Makefile. */' \
1004 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|[DK_]*NTDDDISK_H\|STRINGS_H\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */ /* VC$(vcver) */,' \
1005 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc$(vcver),' $< > $@
1007 $(srcdir)/os_win32/vc$(vcver)/svnversion.h: svnversion.h
1010 $(srcdir)/os_win32/vc$(vcver)/smartctl_res.rc: smartctl_res.rc
1011 sed '/^1 24 /d' $< > $@
1013 $(srcdir)/os_win32/vc$(vcver)/smartd_res.rc: smartd_res.rc
1014 sed '/^1 24 /d' $< > $@
1017 rm -f $(srcdir)/os_win32/vc$(vcver)/smartmontools.VC.VC.opendb
1018 rm -f $(srcdir)/os_win32/vc$(vcver)/smartmontools.VC.db
1019 rm -f $(srcdir)/os_win32/vc$(vcver)/syslogevt.h
1020 rm -rf $(srcdir)/os_win32/vc$(vcver)/Debug
1021 rm -rf $(srcdir)/os_win32/vc$(vcver)/Release
1022 rm -rf $(srcdir)/os_win32/vc$(vcver)/x64
1024 distclean-vc$(vcver): clean-vc$(vcver)
1025 rm -f $(CONFIG_VC_FILES)
1027 maintainer-clean-vc$(vcver): distclean-vc$(vcver)
1028 rm -rf $(srcdir)/os_win32/vc$(vcver)/.vs
1034 # Definitions for OSX distribution
1035 distdir_darwin = $(PACKAGE)-$(VERSION).darwin
1036 dmg_darwin = $(PACKAGE)-$(VERSION).dmg
1037 pkg_darwin = $(PACKAGE)-$(VERSION).pkg
1039 # build darwin installer
1041 ${MAKE} install DESTDIR=$(distdir_darwin)/root
1042 @cp $(srcdir)/os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall $(distdir_darwin)/root$(sbindir)
1043 @mkdir -p $(distdir_darwin)/pkg
1044 @( cd $(distdir_darwin)/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > $(distdir_darwin)/pkg/Payload
1045 PAYLOAD_FILES=`find $(distdir_darwin)/root | wc -l` &&\
1046 PAYLOAD_SIZEKB=`du -BK -s $(distdir_darwin)/root|${AWK} '{print $$1}'|tr -d 'K'` &&\
1047 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" \
1048 -e "s|@size@|$${PAYLOAD_SIZEKB}|" $(srcdir)/os_darwin/pkg/PackageInfo.in \
1049 > $(distdir_darwin)/pkg/PackageInfo &&\
1050 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" -e "s|@size@|$${PAYLOAD_SIZEKB}|" \
1051 -e "s|@pkgname@|$(pkg_darwin)|" \
1052 $(srcdir)/os_darwin/pkg/Distribution.in > $(distdir_darwin)/pkg/Distribution
1053 @mkdir -p $(distdir_darwin)/pkg/Resources/English.lproj
1054 @cp $(srcdir)/COPYING $(distdir_darwin)/pkg/Resources/English.lproj/license.txt
1055 @mkbom -u 0 -g 80 $(distdir_darwin)/root $(distdir_darwin)/pkg/Bom
1056 @mkdir -p $(distdir_darwin)/dmg
1057 @( cd $(distdir_darwin)/pkg && xar --compression none -cf "../dmg/$(pkg_darwin)" * )
1059 # build darwon dmg image
1061 @cp $(srcdir)/os_darwin/pkg/installer/README.html $(distdir_darwin)/dmg
1062 @mkisofs -V 'smartmontools' -no-pad -r -apple -o $(distdir_darwin)/smartmontools-$(VERSION).iso \
1063 -hfs-bless "$(distdir_darwin)/dmg/" "$(distdir_darwin)/dmg/"
1064 @dmg dmg $(distdir_darwin)/smartmontools-$(VERSION).iso $(dmg_darwin)
1066 sha1sum $@ > $@.sha1
1067 sha256sum $@ > $@.sha256
1069 install-darwin: install-darwin-cleanup $(pkg_darwin) $(dmg_darwin)
1071 install-darwin-cleanup:
1072 @rm -rf $(distdir_darwin)