1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 3957 2014-07-18 18:39:06Z 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
48 sbin_SCRIPTS = update-smart-drivedb
81 smartctl_LDADD = @os_deps@ @os_libs@
82 smartctl_DEPENDENCIES = @os_deps@
84 EXTRA_smartctl_SOURCES = \
114 smartctl_LDADD += smartctl_res.o
115 smartctl_DEPENDENCIES += smartctl_res.o
126 dev_ata_cmd_set.cpp \
141 smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@
142 smartd_DEPENDENCIES = @os_deps@
144 EXTRA_smartd_SOURCES = \
175 os_win32/daemon_win32.cpp \
176 os_win32/daemon_win32.h \
177 os_win32/syslog_win32.cpp \
180 smartd_LDADD += smartd_res.o
181 smartd_DEPENDENCIES += smartd_res.o
188 smartctl_SOURCES += \
202 smartctl_SOURCES += \
205 regex/regex_internal.h
210 regex/regex_internal.h
212 # Included by regex.c:
213 EXTRA_smartctl_SOURCES += \
216 regex/regex_internal.c
218 EXTRA_smartd_SOURCES += \
221 regex/regex_internal.c
227 smartctl_SOURCES += \
229 os_win32/wmiquery.cpp \
234 os_win32/wmiquery.cpp \
237 smartctl_LDADD += -lole32 -loleaut32
238 smartd_LDADD += -lole32 -loleaut32
243 # This block is required because Solaris uses manual page section 1m
244 # for administrative command (linux/freebsd use section 8) and Solaris
245 # uses manual page section 4 for file formats (linux/freebsd use
246 # section 5). Automake can deal cleanly with man page sections 1-8
247 # and n, but NOT with sections of the form 1m.
248 extra_MANS = smartd.conf.4 \
252 extra_MANS += update-smart-drivedb.1m
255 all-local: $(extra_MANS)
256 install-man: $(extra_MANS)
258 $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
259 $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
260 for i in $(extra_MANS); do \
261 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
263 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
264 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
265 inst=`echo $$inst | sed -e 's/^.*\///'`; \
266 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
267 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
268 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
272 for i in $(extra_MANS); do \
273 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
275 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
276 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
277 inst=`echo $$inst | sed -e 's/^.*\///'`; \
278 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
279 echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
280 rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
283 # For systems that adopts traditional manner
285 man_MANS = smartd.conf.5 \
290 man_MANS += update-smart-drivedb.8
308 examplesdir=$(exampledir)
310 examplescripts/README
312 examplescripts/Example1 \
313 examplescripts/Example2 \
314 examplescripts/Example3 \
315 examplescripts/Example4 \
316 examplescripts/Example5 \
317 examplescripts/Example6
319 sysconf_DATA = smartd.conf
321 # If modified smartd.conf exists install smartd.conf.sample instead
322 install-sysconfDATA: $(sysconf_DATA)
323 $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
324 @s="$(srcdir)/smartd.conf"; \
325 f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
326 if test -z "$(smartd_suffix)" && test -f "$$f"; then \
327 if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
328 echo "************************************************************"; \
329 echo "*** $$f preserved"; \
330 echo "*** installing smartd.conf.sample instead"; \
331 echo "************************************************************"; \
335 echo " $(INSTALL_DATA) $$s $$f"; \
336 $(INSTALL_DATA) "$$s" "$$f"
338 # If smartd.conf.sample exists preserve smartd.conf
339 uninstall-sysconfDATA:
340 @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
341 if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
342 echo "************************************************************"; \
343 echo "*** $$f preserved"; \
344 echo "*** removing smartd.conf.sample instead"; \
345 echo "************************************************************"; \
351 smartdscript_SCRIPTS = smartd_warning.sh
356 smartd.freebsd.initd.in \
362 smartd_warning.sh.in \
363 update-smart-drivedb.in \
364 update-smart-drivedb.8.in \
367 os_darwin/StartupParameters.plist \
368 os_darwin/English_Localizable.strings \
369 os_win32/installer.nsi \
371 os_win32/runcmda.exe.manifest \
372 os_win32/runcmdu.exe.manifest \
373 os_win32/smartctl_res.rc.in \
374 os_win32/smartd_res.rc.in \
375 os_win32/smartd_warning.cmd \
376 os_win32/syslogevt.mc \
377 os_win32/update-smart-drivedb.nsi \
378 os_win32/wbemcli_small.h \
379 os_win32/wtssendmsg.c \
398 smartd.freebsd.initd \
402 update-smart-drivedb \
403 update-smart-drivedb.8 \
404 update-smart-drivedb.1m \
407 # 'make maintainer-clean' also removes files generated by './autogen.sh'
408 MAINTAINERCLEANFILES = \
409 $(srcdir)/Makefile.in \
410 $(srcdir)/aclocal.m4 \
412 $(srcdir)/configure \
413 $(srcdir)/config.guess \
414 $(srcdir)/config.h.in \
415 $(srcdir)/config.h.in~ \
416 $(srcdir)/config.sub \
418 $(srcdir)/install-sh \
420 $(srcdir)/mkinstalldirs \
423 utility.o: svnversion.h
426 # Get version info from SVN
427 svnversion.h: ChangeLog Makefile $(svn_deps)
428 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
429 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
431 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
432 && TZ= LC_ALL=C svn info 2>/dev/null \
433 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
434 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
437 # SVN not available, guess version info from Id strings
438 svnversion.h: ChangeLog Makefile
439 @echo ' cat ChangeLog $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
440 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
441 @(cd $(srcdir) && cat ChangeLog Makefile.am configure.ac smart*.in *.cpp *.h *.s) \
442 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
444 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
445 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
450 drivedb_DATA = drivedb.h
453 update-smart-drivedb: update-smart-drivedb.in config.status
454 $(SHELL) ./config.status --file=$@
457 smartd_warning.sh: smartd_warning.sh.in config.status
458 $(SHELL) ./config.status --file=$@
461 if INSTALL_INITSCRIPT
464 os_darwin/StartupParameters.plist \
465 os_darwin/English_Localizable.strings
467 initd_install_name = SMART
469 initd_DATA_install = install-initdDATA-darwin
470 initd_DATA_uninstall = uninstall-initdDATA-darwin
472 SMART : os_darwin/SMART.in
473 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
475 install-initdDATA-darwin: $(initd_DATA)
476 $(mkinstalldirs) $(DESTDIR)$(initddir)
477 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
478 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
479 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
480 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
481 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
482 for i in English ; do \
483 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
484 $(mkinstalldirs) $$RDIR ;\
485 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
486 $$RDIR/Localizable.strings ; \
489 uninstall-initdDATA-darwin:
490 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
494 initd_DATA = @initdfile@
496 @initdfile@: $(srcdir)/@initdfile@.in Makefile
497 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/@initdfile@.in > $@
499 initd_install_name = smartd$(smartd_suffix)
501 initd_DATA_install = install-initdDATA-generic
502 initd_DATA_uninstall = uninstall-initdDATA-generic
504 install-initdDATA-generic: $(initd_DATA)
505 $(mkinstalldirs) $(DESTDIR)$(initddir)
506 $(INSTALL_SCRIPT) $(top_builddir)/@initdfile@ $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
509 uninstall-initdDATA-generic:
510 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
514 initd_DATA_install = install-initdDATA-null
515 initd_DATA_uninstall = uninstall-initdDATA-null
517 install-initdDATA-null:
518 uninstall-initdDATA-null:
521 install-initdDATA : $(initd_DATA_install)
523 uninstall-initdDATA: $(initd_DATA_uninstall)
525 if INSTALL_SYSTEMDUNIT
526 systemdsystemunit_DATA = smartd.service
529 smartd.service: smartd.service.in Makefile
530 cat $(srcdir)/smartd.service.in | \
531 sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
532 if test -n '$(systemdenvfile)'; then \
533 sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
535 sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \
539 # Create empty directories if configured.
540 # Default install rules no longer create empty directories since automake 1.11.
541 # Uses $(mkinstalldirs) instead of $(MKDIR_P) to preserve support for automake 1.7 - 1.9.
543 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
544 test -n "$$d" || continue; \
545 echo "$(mkinstalldirs) $(DESTDIR)$$d"; \
546 $(mkinstalldirs) "$(DESTDIR)$$d" || exit 1; \
549 install-data-local: installdirs-local
554 if ENABLE_CAPABILITIES
555 MAN_CAPABILITIES = cat
557 MAN_CAPABILITIES = sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,'
561 MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
563 MAN_DRIVEDB = sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,'
567 MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
569 MAN_SAVESTATES = sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,'
572 if ENABLE_ATTRIBUTELOG
573 MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
575 MAN_ATTRIBUTELOG = sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,'
579 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
580 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
581 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
582 -e 's|/usr/local/share/man/|$(mandir)/|g' \
583 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
584 -e 's|/usr/local/etc/rc\.d/init.d/|$(initddir)/|g' \
585 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
586 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
587 -e 's|!exampledir!|$(exampledir)/|g' \
588 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
589 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \
590 -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \
591 -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
592 -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
593 -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
594 -e 's|RELEASE_6_0_DRIVEDB|@DRIVEDB_BRANCH@|g' | \
595 if test -n '$(smartdplugindir)'; then \
596 sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
598 sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
600 $(MAN_ATTRIBUTELOG) | \
601 $(MAN_CAPABILITIES) | \
603 $(MAN_SAVESTATES) | \
604 if test -n '$(os_man_filter)'; then \
605 sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
606 -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
607 -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
608 -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
609 -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
610 -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
616 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
617 smartctl.8: smartctl.8.in Makefile svnversion.h
618 @echo ' cat $(srcdir)/smartctl.8.in | $$(MAN_FILTER) > $@'
619 @cat $(srcdir)/smartctl.8.in | $(MAN_FILTER) > $@
621 smartd.8: smartd.8.in Makefile svnversion.h
622 @echo ' cat $(srcdir)/smartd.8.in | $$(MAN_FILTER) > $@'
623 @cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@
625 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
626 @echo ' cat $(srcdir)/smartd.conf.5.in | $$(MAN_FILTER) > $@'
627 @cat $(srcdir)/smartd.conf.5.in | $(MAN_FILTER) > $@
629 update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
630 @echo ' cat $(srcdir)/update-smart-drivedb.8.in | $$(MAN_FILTER) > $@'
631 @cat $(srcdir)/update-smart-drivedb.8.in | $(MAN_FILTER) > $@
633 # Build Solaris specific man pages
634 SOLARIS_MAN_FILTER = \
635 sed -e '/^\.TH/s, \([58]\) , !!\1!! ,' \
636 -e '/^\.BR/s, (\([578]\)), (!!\1!!),' \
637 -e 's,\\fP(\([578]\)),\\fP(!!\1!!),g' \
638 -e 's,!!5!!,4,g' -e 's,!!7!!,5,g' -e 's,!!8!!,1m,g' \
639 -e 's,/var/log/messages,/var/adm/messages,g'
641 smartctl.1m: smartctl.8
642 @echo ' cat smartctl.8 | $$(SOLARIS_MAN_FILTER) > $@'
643 @cat smartctl.8 | $(SOLARIS_MAN_FILTER) > $@
646 @echo ' cat smartd.8 | $$(SOLARIS_MAN_FILTER) > $@'
647 @cat smartd.8 | $(SOLARIS_MAN_FILTER) > $@
649 smartd.conf.4: smartd.conf.5
650 @echo ' cat smartd.conf.5 | $$(SOLARIS_MAN_FILTER) > $@'
651 @cat smartd.conf.5 | $(SOLARIS_MAN_FILTER) > $@
653 update-smart-drivedb.1m: update-smart-drivedb.8
654 @echo ' cat update-smart-drivedb.8 | $$(SOLARIS_MAN_FILTER) > $@'
655 @cat update-smart-drivedb.8 | $(SOLARIS_MAN_FILTER) > $@
658 # Commands to convert man pages into .html and .txt
661 #MAN2HTML = groff -man -Thtml
662 MAN2TXT = groff -man -Tascii -P'-bcou'
664 # Remove HTTP header and fix links in man2html output
665 FIXHTML = sed -e '1s,^Content-type.*,,' \
666 -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
667 -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \
668 -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
669 -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
671 # Convert man pages into .html and .txt
673 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
675 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
680 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
683 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
687 $(MAN2HTML) $< | $(FIXHTML) > $@
690 $(MAN2HTML) $< | $(FIXHTML) > $@
700 # Check drive database syntax
702 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
703 echo "$(srcdir)/drivedb.h: OK"; \
705 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
712 smartctl_res.o: smartctl_res.rc
715 smartd_res.o: smartd_res.rc syslogevt.rc
718 # Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754, set Copyright year
720 ( ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'`; \
721 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h`; \
722 txtver="$${ver:-0.0.0}.$${rev:-0}"; binver=`echo "$$txtver" | sed 's|\.|,|g'`; \
723 yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h`; yy="$${yy:-XX}"; \
724 sed -e "s|@BINARY_VERSION@|$$binver|g" -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; )
726 smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
727 cat $< | $(WIN_RC_FILTER) > $@
729 smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
730 cat $< | $(WIN_RC_FILTER) > $@
732 syslogevt.rc: os_win32/syslogevt.mc
735 # Definitions for Windows distribution
743 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
744 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
745 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
747 exedir_win32 = $(distdir_win32)/bin
748 docdir_win32 = $(distdir_win32)/doc
751 $(exedir_win32)/smartctl.exe \
752 $(exedir_win32)/smartctl-nc.exe \
753 $(exedir_win32)/smartd.exe \
754 $(exedir_win32)/smartd_warning.cmd \
755 $(exedir_win32)/runcmda.exe \
756 $(exedir_win32)/runcmdu.exe \
757 $(exedir_win32)/wtssendmsg.exe
762 $(exedir_win32)/update-smart-drivedb.exe
768 $(docdir_win32)/AUTHORS.txt \
769 $(docdir_win32)/ChangeLog.txt \
770 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
771 $(docdir_win32)/COPYING.txt \
772 $(docdir_win32)/INSTALL.txt \
773 $(docdir_win32)/NEWS.txt \
774 $(docdir_win32)/README.txt \
775 $(docdir_win32)/TODO.txt \
776 $(docdir_win32)/WARNINGS.txt \
777 $(docdir_win32)/checksums$(win_bits).txt \
778 $(docdir_win32)/smartd.conf \
779 $(docdir_win32)/smartctl.8.html \
780 $(docdir_win32)/smartctl.8.txt \
781 $(docdir_win32)/smartd.8.html \
782 $(docdir_win32)/smartd.8.txt \
783 $(docdir_win32)/smartd.conf.5.html \
784 $(docdir_win32)/smartd.conf.5.txt \
785 $(exedir_win32)/runcmda.exe.manifest \
786 $(exedir_win32)/runcmdu.exe.manifest
790 $(exedir_win32)/drivedb.h
796 smartctl-nc.exe smartctl-nc.exe.tmp \
797 smartctl_res.rc smartctl_res.o \
798 smartd_res.rc smartd_res.o \
799 syslogevt.h syslogevt.o \
800 syslogevt.rc syslogevt_*.bin \
802 update-smart-drivedb.exe \
805 # Textfile converter from package cygutils or tofrodos
806 # Note: Only use without options to be compatible with both packages
810 # Build Windows distribution
812 dist-win32: $(distzip_win32)
814 install-win32: $(distinst_win32)
817 installer-win32: $(distinst_win32)
819 distdir-win32: distdir.mkdir $(FILES_WIN32)
821 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
822 @rm -fv $(distzip_win32)
823 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
826 sha256sum $@ > $@.sha256
829 # Build NSIS installer
830 # Note: Only option character '-' is also compatible with Linux version of makensis
831 $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
832 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
833 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`; \
834 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`; \
835 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO); \
836 d64=; test -z '$(builddir_win64)' || d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; \
837 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<"; \
838 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
841 sha256sum $@ > $@.sha256
843 # Build drivedb.h update tool
844 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
845 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
849 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
854 rm -rf $(distdir_win32) distdir.mkdir
857 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
858 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
861 $(exedir_win32)/%.exe: %.exe
863 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
866 # strip would break NSIS integrity check
867 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
870 # runcmd?.exe only differ by .exe.manifest files
871 $(exedir_win32)/runcmda.exe: $(exedir_win32)/runcmdu.exe
874 $(exedir_win32)/%.h: $(srcdir)/%.h
875 $(UNIX2DOS) < $< > $@
878 $(exedir_win32)/%.exe.manifest: $(srcdir)/os_win32/%.exe.manifest
879 $(UNIX2DOS) < $< > $@
882 $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
883 $(UNIX2DOS) < $< > $@
886 $(docdir_win32)/%.html: %.html
887 $(UNIX2DOS) < $< > $@
890 $(docdir_win32)/%.txt: %.txt
891 $(UNIX2DOS) < $< > $@
894 $(docdir_win32)/%.txt: $(srcdir)/%
895 $(UNIX2DOS) < $< > $@
898 $(docdir_win32)/%.conf: $(srcdir)/%.conf
899 $(UNIX2DOS) < $< > $@
902 $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
903 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
906 # Build non-console version of smartctl for GSmartControl.
907 # The script below changes the word at offset 220 (Subsystem) from 3
908 # (Console) to 2 (GUI) in a copy of smartctl.exe.
909 # This will be changed when a tool (like 'editbin') is available in
910 # the Cygwin distribution
911 smartctl-nc.exe: smartctl.exe
913 cp -p smartctl.exe $@.tmp
914 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
915 else echo "invalid EXE header"; exit 1; fi
916 @echo "editbin /subsystem:windows $@.tmp"
917 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
918 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
919 else echo "EXE patch failed"; exit 1; fi
922 # Build runcmd?.exe and wtssendmsg.exe
923 runcmdu.exe: os_win32/runcmd.c
926 wtssendmsg.exe: os_win32/wtssendmsg.c
927 $(CC) -Os -o $@ $< -lwtsapi32
929 # Build os_win32/vc10/{config.h,smart*.rc,svnversion.h} for MSVC10 from MinGW files
931 config-vc10: $(srcdir)/os_win32/vc10/config.h \
932 $(srcdir)/os_win32/vc10/smartctl_res.rc \
933 $(srcdir)/os_win32/vc10/smartd_res.rc \
934 $(srcdir)/os_win32/vc10/svnversion.h
936 $(srcdir)/os_win32/vc10/config.h: config.h Makefile
937 sed -e '1i/* os_win32/vc10/config.h. Generated from config.h by Makefile. */' \
938 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
939 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
941 $(srcdir)/os_win32/vc10/svnversion.h: svnversion.h
944 $(srcdir)/os_win32/vc10/smartctl_res.rc: smartctl_res.rc
947 $(srcdir)/os_win32/vc10/smartd_res.rc: smartd_res.rc