1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 4848 2018-12-05 18:30:46Z 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 -D_GETOPT_STANDALONE
38 AM_CPPFLAGS += -I$(srcdir)/regex -D_REGEX_STANDALONE
45 if ENABLE_UPDATE_SMART_DRIVEDB
48 sbin_SCRIPTS = update-smart-drivedb
90 smartctl_LDADD = $(os_deps) $(os_libs)
91 smartctl_DEPENDENCIES = $(os_deps)
93 EXTRA_smartctl_SOURCES = \
125 smartctl_SOURCES += \
126 os_win32/popen_win32.cpp \
129 smartctl_LDADD += smartctl_res.o
130 smartctl_DEPENDENCIES += smartctl_res.o
141 dev_ata_cmd_set.cpp \
143 dev_intelliprop.cpp \
161 smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD) $(SYSTEMD_LDADD)
162 smartd_DEPENDENCIES = $(os_deps)
164 EXTRA_smartd_SOURCES = \
192 freebsd_nvme_ioctl.h \
193 netbsd_nvme_ioctl.h \
199 os_win32/daemon_win32.cpp \
200 os_win32/daemon_win32.h \
201 os_win32/popen_win32.cpp \
203 os_win32/syslog_win32.cpp \
206 smartd_LDADD += smartd_res.o
207 smartd_DEPENDENCIES += smartd_res.o
211 # Exclude from source tarball
212 nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s
213 nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s
217 smartctl_SOURCES += \
221 getopt/getopt_int.h \
222 getopt/bits/getopt_core.h \
223 getopt/bits/getopt_ext.h
229 getopt/getopt_int.h \
230 getopt/bits/getopt_core.h \
231 getopt/bits/getopt_ext.h
237 smartctl_SOURCES += \
240 regex/regex_internal.h
245 regex/regex_internal.h
247 # Included by regex.c:
248 EXTRA_smartctl_SOURCES += \
251 regex/regex_internal.c
253 EXTRA_smartd_SOURCES += \
256 regex/regex_internal.c
262 smartctl_SOURCES += \
264 os_win32/wmiquery.cpp \
269 os_win32/wmiquery.cpp \
272 smartctl_LDADD += -lole32 -loleaut32
273 smartd_LDADD += -lole32 -loleaut32
278 # This block is required because Solaris uses manual page section 1m
279 # for administrative command (linux/freebsd use section 8) and Solaris
280 # uses manual page section 4 for file formats (linux/freebsd use
281 # section 5). Automake can deal cleanly with man page sections 1-8
282 # and n, but NOT with sections of the form 1m.
283 extra_MANS = smartd.conf.4 \
286 if ENABLE_UPDATE_SMART_DRIVEDB
287 extra_MANS += update-smart-drivedb.1m
290 all-local: $(extra_MANS)
291 install-man: $(extra_MANS)
293 $(MKDIR_P) '$(DESTDIR)$(mandir)/man4'
294 $(MKDIR_P) '$(DESTDIR)$(mandir)/man1m'
295 for i in $(extra_MANS); do \
296 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
298 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
299 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
300 inst=`echo $$inst | sed -e 's/^.*\///'`; \
301 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
302 echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
303 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
307 for i in $(extra_MANS); do \
308 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
310 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
311 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
312 inst=`echo $$inst | sed -e 's/^.*\///'`; \
313 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
314 echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
315 rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
318 # For systems that adopts traditional manner
320 man_MANS = smartd.conf.5 \
324 if ENABLE_UPDATE_SMART_DRIVEDB
325 man_MANS += update-smart-drivedb.8
342 examplesdir=$(exampledir)
344 examplescripts/README
346 examplescripts/Example1 \
347 examplescripts/Example2 \
348 examplescripts/Example3 \
349 examplescripts/Example4 \
350 examplescripts/Example5 \
351 examplescripts/Example6
353 sysconf_DATA = smartd.conf
355 # If modified smartd.conf exists install smartd.conf.sample instead
356 install-sysconfDATA: $(sysconf_DATA)
357 $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'
358 @s="$(srcdir)/smartd.conf"; \
359 f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
360 if test -z "$(smartd_suffix)" && test -f "$$f"; then \
361 if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
362 echo "************************************************************"; \
363 echo "*** $$f preserved"; \
364 echo "*** installing smartd.conf.sample instead"; \
365 echo "************************************************************"; \
369 echo " $(INSTALL_DATA) '$$s' '$$f'"; \
370 $(INSTALL_DATA) "$$s" "$$f"
372 # If smartd.conf.sample exists preserve smartd.conf
373 uninstall-sysconfDATA:
374 @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
375 if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
376 echo "************************************************************"; \
377 echo "*** $$f preserved"; \
378 echo "*** removing smartd.conf.sample instead"; \
379 echo "************************************************************"; \
382 echo " rm -f '$$f'"; \
385 smartdscript_SCRIPTS = smartd_warning.sh
391 smartd.cygwin.initd.in \
392 smartd.freebsd.initd.in \
398 smartd_warning.sh.in \
399 update-smart-drivedb.in \
400 update-smart-drivedb.8.in \
402 os_darwin/com.smartmontools.smartd.plist.in \
403 os_darwin/pkg/PackageInfo.in \
404 os_darwin/pkg/Distribution.in \
405 os_darwin/pkg/installer/README.html \
406 os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall \
407 os_win32/default.manifest \
408 os_win32/installer.nsi \
410 os_win32/smartd_mailer.ps1 \
411 os_win32/smartd_mailer.conf.sample.ps1 \
412 os_win32/smartd_warning.cmd \
413 os_win32/syslogevt.mc \
414 os_win32/update-smart-drivedb.nsi \
415 os_win32/versioninfo.rc.in \
416 os_win32/wtssendmsg.c \
431 smartctl.8.html.tmp \
437 smartd.conf.5.html.tmp \
441 smartd.cygwin.initd \
442 smartd.freebsd.initd \
446 update-smart-drivedb \
447 update-smart-drivedb.8 \
448 update-smart-drivedb.1m \
449 update-smart-drivedb.8.html \
450 update-smart-drivedb.8.html.tmp \
451 update-smart-drivedb.8.pdf \
452 update-smart-drivedb.8.txt \
455 # 'make maintainer-clean' also removes files generated by './autogen.sh'
456 MAINTAINERCLEANFILES = \
457 $(srcdir)/Makefile.in \
458 $(srcdir)/aclocal.m4 \
460 $(srcdir)/configure \
461 $(srcdir)/config.guess \
462 $(srcdir)/config.h.in \
463 $(srcdir)/config.h.in~ \
464 $(srcdir)/config.sub \
466 $(srcdir)/install-sh \
470 smartctl.o utility.o: svnversion.h
473 # Get version info from SVN
474 svnversion.h: ChangeLog Makefile $(svn_deps)
475 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
476 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
478 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
479 && TZ= LC_ALL=C svn info 2>/dev/null \
480 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
481 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
484 # SVN not available, guess version info from Id strings
485 svnversion.h: ChangeLog Makefile NEWS
486 @echo ' cat ChangeLog NEWS $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
487 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
488 @(cd $(srcdir) && cat ChangeLog NEWS Makefile.am configure.ac smart*.in *.cpp *.h) \
489 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
491 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
492 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
497 drivedb_DATA = drivedb.h
500 update-smart-drivedb: update-smart-drivedb.in config.status
501 $(SHELL) ./config.status --file=$@
504 smartd_warning.sh: smartd_warning.sh.in config.status
505 $(SHELL) ./config.status --file=$@
508 if INSTALL_INITSCRIPT
510 initd_DATA = com.smartmontools.smartd.plist
512 initd_DATA_install = install-initdDATA-darwin
513 initd_DATA_uninstall = uninstall-initdDATA-darwin
515 com.smartmontools.smartd.plist : os_darwin/com.smartmontools.smartd.plist.in
516 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
518 install-initdDATA-darwin: $(initd_DATA)
519 $(MKDIR_P) '$(DESTDIR)$(initddir)'
520 $(INSTALL_DATA) $(top_builddir)/$(initd_DATA) $(DESTDIR)$(initddir)/$(initd_DATA)
522 uninstall-initdDATA-darwin:
523 rm -f $(DESTDIR)$(initddir)/$(initd_DATA)
527 initd_DATA = $(initdfile)
529 $(initdfile): $(srcdir)/$(initdfile).in Makefile
530 sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
532 initd_install_name = smartd$(smartd_suffix)
534 initd_DATA_install = install-initdDATA-generic
535 initd_DATA_uninstall = uninstall-initdDATA-generic
537 install-initdDATA-generic: $(initd_DATA)
538 $(MKDIR_P) '$(DESTDIR)$(initddir)'
539 $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
541 uninstall-initdDATA-generic:
542 rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
546 initd_DATA_install = install-initdDATA-null
547 initd_DATA_uninstall = uninstall-initdDATA-null
549 install-initdDATA-null:
550 uninstall-initdDATA-null:
553 install-initdDATA : $(initd_DATA_install)
555 uninstall-initdDATA: $(initd_DATA_uninstall)
557 if INSTALL_SYSTEMDUNIT
558 systemdsystemunit_DATA = smartd.service
561 smartd.service: smartd.service.in Makefile
562 @echo ' $$(SMARTD_SERVICE_FILTER) < $(srcdir)/smartd.service.in > $@'
564 sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
565 if test -n '$(systemdenvfile)'; then \
566 sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
568 sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \
569 fi; } < $(srcdir)/smartd.service.in > $@
572 # Create empty directories if configured.
573 # Default install rules no longer create empty directories since automake 1.11.
575 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
576 test -n "$$d" || continue; \
577 echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
578 $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
581 install-data-local: installdirs-local
587 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
588 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
589 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
590 -e 's|/usr/local/share/man/|$(mandir)/|g' \
591 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
592 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
593 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
594 -e 's|!exampledir!|$(exampledir)/|g' \
595 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
596 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \
597 -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \
598 -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
599 -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
600 -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
601 -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
602 if test -n '$(drivedbdir)'; then \
603 sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
605 sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
607 if test '$(with_update_smart_drivedb)' = 'yes'; then \
610 sed '/^\.\\" %IF ENABLE_UPDATE_SMART_DRIVEDB/,/^\.\\" %ENDIF ENABLE_UPDATE_SMART_DRIVEDB/ s,^,.\\"\# ,' ; \
612 if test -n '$(initddir)'; then \
613 sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \
615 sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \
617 if test -n '$(savestates)'; then \
618 sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \
620 sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \
622 if test -n '$(attributelog)'; then \
623 sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \
625 sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \
627 if test -n '$(smartdplugindir)'; then \
628 sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
630 sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
632 if test -n '$(CAPNG_LDADD)'; then \
635 sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
637 if test -n '$(SYSTEMD_LDADD)'; then \
640 sed '/^\.\\" %IF ENABLE_SYSTEMD_NOTIFY/,/^\.\\" %ENDIF ENABLE_SYSTEMD_NOTIFY/ s,^,.\\"\# ,' ; \
642 if test '$(with_nvme_devicescan)' = 'yes'; then \
645 sed '/^\.\\" %IF ENABLE_NVME_DEVICESCAN/,/^\.\\" %ENDIF ENABLE_NVME_DEVICESCAN/ s,^,.\\"\# ,' ; \
647 if test -n '$(os_man_filter)'; then \
648 sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
649 -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
650 -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
651 -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
652 -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
653 -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
659 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
660 smartctl.8: smartctl.8.in Makefile svnversion.h
661 @echo ' $$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@'
662 @$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@
664 smartd.8: smartd.8.in Makefile svnversion.h
665 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@'
666 @$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@
668 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
669 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@'
670 @$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@
672 update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
673 @echo ' $$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@'
674 @$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@
676 # Build Solaris specific man pages
677 SOLARIS_MAN_FILTER = \
678 sed -e '/^\.TH/s, \([58]\) , !!\1!! ,' \
679 -e '/^\.BR/s, (\([578]\)), (!!\1!!),' \
680 -e 's,\\fP(\([578]\)),\\fP(!!\1!!),g' \
681 -e 's,!!5!!,4,g' -e 's,!!7!!,5,g' -e 's,!!8!!,1m,g' \
682 -e 's,/var/log/messages,/var/adm/messages,g'
684 smartctl.1m: smartctl.8
685 @echo ' $$(SOLARIS_MAN_FILTER) < smartctl.8 > $@'
686 @$(SOLARIS_MAN_FILTER) < smartctl.8 > $@
689 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.8 > $@'
690 @$(SOLARIS_MAN_FILTER) < smartd.8 > $@
692 smartd.conf.4: smartd.conf.5
693 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@'
694 @$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@
696 update-smart-drivedb.1m: update-smart-drivedb.8
697 @echo ' $$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@'
698 @$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@
701 # Convert man pages into .html, .pdf and .txt
704 #MAN2HTML = groff -man -Thtml
705 MAN2PDF = man -Tpdf -l
706 #MAN2PDF = groff -man -Tpdf
707 MAN2TXT = groff -man -Tascii -P'-bcou'
709 # Remove HTTP header and fix links in man2html output
710 FIXHTML = sed -e '1s,^Content-type.*,,' \
711 -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
712 -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \
713 -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
714 -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
716 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html update-smart-drivedb.8.html
718 pdfman: smartctl.8.pdf smartd.8.pdf smartd.conf.5.pdf update-smart-drivedb.8.pdf
720 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt update-smart-drivedb.8.txt
723 $(MAN2HTML) $< > $@.tmp
724 @echo ' $$(FIXHTML) < $@.tmp > $@'
725 @$(FIXHTML) < $@.tmp > $@
728 $(MAN2HTML) $< > $@.tmp
729 @echo ' $$(FIXHTML) < $@.tmp > $@'
730 @$(FIXHTML) < $@.tmp > $@
745 # Check drive database syntax
747 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
748 echo "$(srcdir)/drivedb.h: OK"; \
750 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
757 smartctl_res.o: smartctl_res.rc $(os_win32_manifest)
760 smartd_res.o: smartd_res.rc syslogevt.rc $(os_win32_manifest)
763 runcmda_res.o: runcmda_res.rc defadmin.manifest
766 runcmdu_res.o: runcmdu_res.rc $(os_win32_manifest)
769 wtssendmsg_res.o: wtssendmsg_res.rc $(os_win32_manifest)
772 # Convert version for VERSIONINFO resource: 6.6 r4519 -> 6.6.0.4519,
773 # set description, name, version and year
775 ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'` && \
776 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h` && \
777 txtver="$${ver:-0.0.0}.$${rev:-0}" && binver=`echo "$$txtver" | sed 's|\.|,|g'` && \
778 yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h` && yy="$${yy:-XX}" && \
779 sed -e "s|@DESC@|$$d|" -e "s|@NAME@|$$n|" -e "s|@BINARY_VERSION@|$$binver|g" \
780 -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; }
783 echo "n=$$n d=\"$$d"'"; $$(WIN_RC_FILTER) < $< > $@'; \
784 $(WIN_RC_FILTER) < $< > $@
787 if test -n '$(os_win32_manifest)'; then \
788 echo "echo '1 24 \"$(srcdir)/$(os_win32_manifest)\"' >> $@"; \
789 echo '1 24 "$(srcdir)/$(os_win32_manifest)"' >> $@; \
792 smartctl_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
793 @n=smartctl d="Control and Monitor Utility for SMART Disks"; $(WIN_MAKE_RES)
796 smartd_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
797 @n=smartd d="SMART Disk Monitoring Daemon"; $(WIN_MAKE_RES)
798 echo '#include "./syslogevt.rc"' >> $@
801 runcmdu_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
802 @n=runcmdu d="Run console command"; $(WIN_MAKE_RES)
805 runcmda_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
806 @n=runcmda d="Run console command as admin"; $(WIN_MAKE_RES)
807 echo '1 24 "./defadmin.manifest"' >> $@
809 wtssendmsg_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h
810 @n=wtssendmsg d="Send console messages"; $(WIN_MAKE_RES)
813 syslogevt.rc: os_win32/syslogevt.mc
816 defadmin.manifest: os_win32/default.manifest
817 sed 's,"asInvoker","requireAdministrator",' $< > $@
819 # Definitions for Windows distribution
827 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
828 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
829 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
831 exedir_win32 = $(distdir_win32)/bin
832 docdir_win32 = $(distdir_win32)/doc
835 $(exedir_win32)/smartctl.exe \
836 $(exedir_win32)/smartctl-nc.exe \
837 $(exedir_win32)/smartd.exe \
838 $(exedir_win32)/smartd_mailer.ps1 \
839 $(exedir_win32)/smartd_mailer.conf.sample.ps1 \
840 $(exedir_win32)/smartd_warning.cmd \
841 $(exedir_win32)/runcmda.exe \
842 $(exedir_win32)/runcmdu.exe \
843 $(exedir_win32)/wtssendmsg.exe
848 $(exedir_win32)/update-smart-drivedb.exe
854 $(docdir_win32)/AUTHORS.txt \
855 $(docdir_win32)/ChangeLog.txt \
856 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
857 $(docdir_win32)/COPYING.txt \
858 $(docdir_win32)/INSTALL.txt \
859 $(docdir_win32)/NEWS.txt \
860 $(docdir_win32)/README.txt \
861 $(docdir_win32)/TODO.txt \
862 $(docdir_win32)/checksums$(win_bits).txt \
863 $(docdir_win32)/smartd.conf \
864 $(docdir_win32)/smartctl.8.html \
865 $(docdir_win32)/smartctl.8.pdf \
866 $(docdir_win32)/smartd.8.html \
867 $(docdir_win32)/smartd.8.pdf \
868 $(docdir_win32)/smartd.conf.5.html \
869 $(docdir_win32)/smartd.conf.5.pdf
873 $(exedir_win32)/drivedb.h
880 runcmda.exe runcmda_res.rc \
881 runcmdu.exe runcmdu_res.rc \
882 smartctl-nc.exe smartctl-nc.exe.tmp \
883 smartctl_res.rc smartd_res.rc \
885 syslogevt.rc syslogevt_*.bin \
886 update-smart-drivedb.exe \
887 wtssendmsg.exe wtssendmsg_res.rc
889 # Note: Only use without options to be compatible with all variants
892 # Build Windows distribution
894 dist-win32: $(distzip_win32)
896 install-win32: $(distinst_win32)
899 installer-win32: $(distinst_win32)
901 distdir-win32: distdir.mkdir $(FILES_WIN32)
903 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
904 @rm -fv $(distzip_win32)
905 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
908 sha256sum $@ > $@.sha256
911 # Build NSIS installer
912 # Note: Only option character '-' is also compatible with Linux version of makensis
913 $(distinst_win32): os_win32/installer.nsi smartctl_res.rc distdir.mkdir $(FILES_WIN32)
914 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
915 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h` && \
916 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h` && \
917 version=`sed -n 's|^ *VALUE "FileVersion", "\([0-9.]*\)".*$$|\1|p' smartctl_res.rc` && \
918 yy=`echo "$$date" | sed -n 's,^20\([0-9][0-9]\).*$$,\1,p'`; yy="$${yy:-XX}" && \
919 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO) && \
920 d64= && if [ -n '$(builddir_win64)' ]; then d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; fi && \
921 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSION=$$version -DYY=$$yy -DVERSTR='$$verstr' $<" && \
922 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSION=$$version -DYY=$$yy -DVERSTR="$$verstr" $<
925 sha256sum $@ > $@.sha256
927 # Build drivedb.h update tool
928 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
929 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
933 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
938 rm -rf $(distdir_win32) distdir.mkdir
941 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
942 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
945 $(exedir_win32)/%.exe: %.exe
947 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
950 # strip would break NSIS integrity check
951 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
954 $(exedir_win32)/%.h: $(srcdir)/%.h
955 $(UNIX2DOS) < $< > $@
958 $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
959 $(UNIX2DOS) < $< > $@
962 $(exedir_win32)/%.ps1: $(srcdir)/os_win32/%.ps1
963 $(UNIX2DOS) < $< > $@
966 $(docdir_win32)/%.html: %.html
967 $(UNIX2DOS) < $< > $@
970 $(docdir_win32)/%.pdf: %.pdf
973 $(docdir_win32)/%.txt: $(srcdir)/%
974 $(UNIX2DOS) < $< > $@
977 $(docdir_win32)/%.conf: $(srcdir)/%.conf
978 $(UNIX2DOS) < $< > $@
981 $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
982 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
985 # Build non-console version of smartctl for GSmartControl.
986 # The script below changes the word at offset 220 (Subsystem) from 3
987 # (Console) to 2 (GUI) in a copy of smartctl.exe.
988 # This will be changed when a tool (like 'editbin') is available in
989 # the Cygwin distribution
990 smartctl-nc.exe: smartctl.exe
992 cp -p smartctl.exe $@.tmp
993 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
994 else echo "invalid EXE header"; exit 1; fi
995 @echo "editbin /subsystem:windows $@.tmp"
996 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
997 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
998 else echo "EXE patch failed"; exit 1; fi
1001 # Build runcmd?.exe and wtssendmsg.exe
1002 runcmd.o: os_win32/runcmd.c
1005 runcmdu.exe: runcmd.o runcmdu_res.o
1008 runcmda.exe: runcmd.o runcmda_res.o
1011 wtssendmsg.exe: os_win32/wtssendmsg.c wtssendmsg_res.o
1012 $(CC) -Os -o $@ $^ -lwtsapi32
1014 # Build os_win32/vc14/{config.h,smart*.rc,svnversion.h} for MSVC14 from MinGW files
1019 $(srcdir)/os_win32/vc$(vcver)/config.h \
1020 $(srcdir)/os_win32/vc$(vcver)/smartctl_res.rc \
1021 $(srcdir)/os_win32/vc$(vcver)/smartd_res.rc \
1022 $(srcdir)/os_win32/vc$(vcver)/svnversion.h
1024 config-vc$(vcver): $(CONFIG_VC_FILES)
1026 $(srcdir)/os_win32/vc$(vcver)/config.h: config.h Makefile
1027 sed -e '1i/* os_win32/vc$(vcver)/config.h. Generated from config.h by Makefile. */' \
1028 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|[DK_]*NTDDDISK_H\|LONG_DOUBLE_WIDER\|STRINGS_H\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */ /* VC$(vcver) */,' \
1029 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc$(vcver),' $< > $@
1031 $(srcdir)/os_win32/vc$(vcver)/svnversion.h: svnversion.h
1034 $(srcdir)/os_win32/vc$(vcver)/smartctl_res.rc: smartctl_res.rc
1035 sed '/^1 24 /d' $< > $@
1037 $(srcdir)/os_win32/vc$(vcver)/smartd_res.rc: smartd_res.rc
1038 sed '/^1 24 /d' $< > $@
1041 rm -f $(srcdir)/os_win32/vc$(vcver)/smartmontools.VC.VC.opendb
1042 rm -f $(srcdir)/os_win32/vc$(vcver)/smartmontools.VC.db
1043 rm -f $(srcdir)/os_win32/vc$(vcver)/syslogevt.h
1044 rm -rf $(srcdir)/os_win32/vc$(vcver)/Debug
1045 rm -rf $(srcdir)/os_win32/vc$(vcver)/Release
1046 rm -rf $(srcdir)/os_win32/vc$(vcver)/x64
1048 distclean-vc$(vcver): clean-vc$(vcver)
1049 rm -f $(CONFIG_VC_FILES)
1051 maintainer-clean-vc$(vcver): distclean-vc$(vcver)
1052 rm -rf $(srcdir)/os_win32/vc$(vcver)/.vs
1058 # Definitions for OSX distribution
1059 distdir_darwin = $(PACKAGE)-$(VERSION).darwin
1060 dmg_darwin = $(PACKAGE)-$(VERSION).dmg
1061 pkg_darwin = $(PACKAGE)-$(VERSION).pkg
1063 # build darwin installer
1065 ${MAKE} install DESTDIR=$(distdir_darwin)/root
1066 @cp $(srcdir)/os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall $(distdir_darwin)/root$(sbindir)
1067 @mkdir -p $(distdir_darwin)/pkg
1068 @( cd $(distdir_darwin)/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > $(distdir_darwin)/pkg/Payload
1069 PAYLOAD_FILES=`find $(distdir_darwin)/root | wc -l` &&\
1070 PAYLOAD_SIZEKB=`du -BK -s $(distdir_darwin)/root|${AWK} '{print $$1}'|tr -d 'K'` &&\
1071 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" \
1072 -e "s|@size@|$${PAYLOAD_SIZEKB}|" $(srcdir)/os_darwin/pkg/PackageInfo.in \
1073 > $(distdir_darwin)/pkg/PackageInfo &&\
1074 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" -e "s|@size@|$${PAYLOAD_SIZEKB}|" \
1075 -e "s|@pkgname@|$(pkg_darwin)|" \
1076 $(srcdir)/os_darwin/pkg/Distribution.in > $(distdir_darwin)/pkg/Distribution
1077 @mkdir -p $(distdir_darwin)/pkg/Resources/English.lproj
1078 @cp $(srcdir)/COPYING $(distdir_darwin)/pkg/Resources/English.lproj/license.txt
1079 @mkbom -u 0 -g 80 $(distdir_darwin)/root $(distdir_darwin)/pkg/Bom
1080 @mkdir -p $(distdir_darwin)/dmg
1081 @( cd $(distdir_darwin)/pkg && xar --compression none -cf "../dmg/$(pkg_darwin)" * )
1083 # build darwon dmg image
1085 @cp $(srcdir)/os_darwin/pkg/installer/README.html $(distdir_darwin)/dmg
1086 @mkisofs -V 'smartmontools' -no-pad -r -apple -o $(distdir_darwin)/smartmontools-$(VERSION).iso \
1087 -hfs-bless "$(distdir_darwin)/dmg/" "$(distdir_darwin)/dmg/"
1088 @dmg dmg $(distdir_darwin)/smartmontools-$(VERSION).iso $(dmg_darwin)
1090 sha1sum $@ > $@.sha1
1091 sha256sum $@ > $@.sha256
1093 install-darwin: install-darwin-cleanup $(pkg_darwin) $(dmg_darwin)
1095 install-darwin-cleanup:
1096 @rm -rf $(distdir_darwin)