1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 4102 2015-06-01 19:25:47Z 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
307 examplesdir=$(exampledir)
309 examplescripts/README
311 examplescripts/Example1 \
312 examplescripts/Example2 \
313 examplescripts/Example3 \
314 examplescripts/Example4 \
315 examplescripts/Example5 \
316 examplescripts/Example6
318 sysconf_DATA = smartd.conf
320 # If modified smartd.conf exists install smartd.conf.sample instead
321 install-sysconfDATA: $(sysconf_DATA)
322 $(mkinstalldirs) '$(DESTDIR)$(sysconfdir)'
323 @s="$(srcdir)/smartd.conf"; \
324 f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
325 if test -z "$(smartd_suffix)" && test -f "$$f"; then \
326 if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
327 echo "************************************************************"; \
328 echo "*** $$f preserved"; \
329 echo "*** installing smartd.conf.sample instead"; \
330 echo "************************************************************"; \
334 echo " $(INSTALL_DATA) '$$s' '$$f'"; \
335 $(INSTALL_DATA) "$$s" "$$f"
337 # If smartd.conf.sample exists preserve smartd.conf
338 uninstall-sysconfDATA:
339 @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
340 if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
341 echo "************************************************************"; \
342 echo "*** $$f preserved"; \
343 echo "*** removing smartd.conf.sample instead"; \
344 echo "************************************************************"; \
347 echo " rm -f '$$f'"; \
350 smartdscript_SCRIPTS = smartd_warning.sh
355 smartd.freebsd.initd.in \
361 smartd_warning.sh.in \
362 update-smart-drivedb.in \
363 update-smart-drivedb.8.in \
366 os_darwin/StartupParameters.plist \
367 os_darwin/English_Localizable.strings \
368 os_win32/installer.nsi \
370 os_win32/runcmda.exe.manifest \
371 os_win32/runcmdu.exe.manifest \
372 os_win32/smartctl_res.rc.in \
373 os_win32/smartd_res.rc.in \
374 os_win32/smartd_warning.cmd \
375 os_win32/syslogevt.mc \
376 os_win32/update-smart-drivedb.nsi \
377 os_win32/wbemcli_small.h \
378 os_win32/wtssendmsg.c \
397 smartd.freebsd.initd \
401 update-smart-drivedb \
402 update-smart-drivedb.8 \
403 update-smart-drivedb.1m \
406 # 'make maintainer-clean' also removes files generated by './autogen.sh'
407 MAINTAINERCLEANFILES = \
408 $(srcdir)/Makefile.in \
409 $(srcdir)/aclocal.m4 \
411 $(srcdir)/configure \
412 $(srcdir)/config.guess \
413 $(srcdir)/config.h.in \
414 $(srcdir)/config.h.in~ \
415 $(srcdir)/config.sub \
417 $(srcdir)/install-sh \
419 $(srcdir)/mkinstalldirs \
422 utility.o: svnversion.h
425 # Get version info from SVN
426 svnversion.h: ChangeLog Makefile $(svn_deps)
427 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
428 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
430 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
431 && TZ= LC_ALL=C svn info 2>/dev/null \
432 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
433 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
436 # SVN not available, guess version info from Id strings
437 svnversion.h: ChangeLog Makefile
438 @echo ' cat ChangeLog $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
439 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
440 @(cd $(srcdir) && cat ChangeLog Makefile.am configure.ac smart*.in *.cpp *.h *.s) \
441 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
443 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
444 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
449 drivedb_DATA = drivedb.h
452 update-smart-drivedb: update-smart-drivedb.in config.status
453 $(SHELL) ./config.status --file=$@
456 smartd_warning.sh: smartd_warning.sh.in config.status
457 $(SHELL) ./config.status --file=$@
460 if INSTALL_INITSCRIPT
463 os_darwin/StartupParameters.plist \
464 os_darwin/English_Localizable.strings
466 initd_install_name = SMART
468 initd_DATA_install = install-initdDATA-darwin
469 initd_DATA_uninstall = uninstall-initdDATA-darwin
471 SMART : os_darwin/SMART.in
472 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
474 install-initdDATA-darwin: $(initd_DATA)
475 $(mkinstalldirs) $(DESTDIR)$(initddir)
476 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
477 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
478 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
479 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
480 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
481 for i in English ; do \
482 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
483 $(mkinstalldirs) $$RDIR ;\
484 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
485 $$RDIR/Localizable.strings ; \
488 uninstall-initdDATA-darwin:
489 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
493 initd_DATA = $(initdfile)
495 $(initdfile): $(srcdir)/$(initdfile).in Makefile
496 sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
498 initd_install_name = smartd$(smartd_suffix)
500 initd_DATA_install = install-initdDATA-generic
501 initd_DATA_uninstall = uninstall-initdDATA-generic
503 install-initdDATA-generic: $(initd_DATA)
504 $(mkinstalldirs) '$(DESTDIR)$(initddir)'
505 $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
507 uninstall-initdDATA-generic:
508 rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
512 initd_DATA_install = install-initdDATA-null
513 initd_DATA_uninstall = uninstall-initdDATA-null
515 install-initdDATA-null:
516 uninstall-initdDATA-null:
519 install-initdDATA : $(initd_DATA_install)
521 uninstall-initdDATA: $(initd_DATA_uninstall)
523 if INSTALL_SYSTEMDUNIT
524 systemdsystemunit_DATA = smartd.service
527 smartd.service: smartd.service.in Makefile
528 @echo ' cat $(srcdir)/smartd.service.in | $$(SMARTD_SERVICE_FILTER) > $@'
529 @cat $(srcdir)/smartd.service.in | \
530 sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
531 if test -n '$(systemdenvfile)'; then \
532 sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
534 sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \
538 # Create empty directories if configured.
539 # Default install rules no longer create empty directories since automake 1.11.
540 # Uses $(mkinstalldirs) instead of $(MKDIR_P) to preserve support for automake 1.7 - 1.9.
542 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
543 test -n "$$d" || continue; \
544 echo " $(mkinstalldirs) '$(DESTDIR)$$d'"; \
545 $(mkinstalldirs) "$(DESTDIR)$$d" || exit 1; \
548 install-data-local: installdirs-local
554 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
555 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
556 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
557 -e 's|/usr/local/share/man/|$(mandir)/|g' \
558 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
559 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
560 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
561 -e 's|!exampledir!|$(exampledir)/|g' \
562 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
563 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \
564 -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \
565 -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
566 -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
567 -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
568 -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
569 if test -n '$(drivedbdir)'; then \
570 sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
572 sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
574 if test -n '$(initddir)'; then \
575 sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \
577 sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \
579 if test -n '$(savestates)'; then \
580 sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \
582 sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \
584 if test -n '$(attributelog)'; then \
585 sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \
587 sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \
589 if test -n '$(smartdplugindir)'; then \
590 sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
592 sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
594 if test -n '$(CAPNG_LDADD)'; then \
597 sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
599 if test -n '$(os_man_filter)'; then \
600 sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
601 -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
602 -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
603 -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
604 -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
605 -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
611 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
612 smartctl.8: smartctl.8.in Makefile svnversion.h
613 @echo ' cat $(srcdir)/smartctl.8.in | $$(MAN_FILTER) > $@'
614 @cat $(srcdir)/smartctl.8.in | $(MAN_FILTER) > $@
616 smartd.8: smartd.8.in Makefile svnversion.h
617 @echo ' cat $(srcdir)/smartd.8.in | $$(MAN_FILTER) > $@'
618 @cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@
620 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
621 @echo ' cat $(srcdir)/smartd.conf.5.in | $$(MAN_FILTER) > $@'
622 @cat $(srcdir)/smartd.conf.5.in | $(MAN_FILTER) > $@
624 update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
625 @echo ' cat $(srcdir)/update-smart-drivedb.8.in | $$(MAN_FILTER) > $@'
626 @cat $(srcdir)/update-smart-drivedb.8.in | $(MAN_FILTER) > $@
628 # Build Solaris specific man pages
629 SOLARIS_MAN_FILTER = \
630 sed -e '/^\.TH/s, \([58]\) , !!\1!! ,' \
631 -e '/^\.BR/s, (\([578]\)), (!!\1!!),' \
632 -e 's,\\fP(\([578]\)),\\fP(!!\1!!),g' \
633 -e 's,!!5!!,4,g' -e 's,!!7!!,5,g' -e 's,!!8!!,1m,g' \
634 -e 's,/var/log/messages,/var/adm/messages,g'
636 smartctl.1m: smartctl.8
637 @echo ' cat smartctl.8 | $$(SOLARIS_MAN_FILTER) > $@'
638 @cat smartctl.8 | $(SOLARIS_MAN_FILTER) > $@
641 @echo ' cat smartd.8 | $$(SOLARIS_MAN_FILTER) > $@'
642 @cat smartd.8 | $(SOLARIS_MAN_FILTER) > $@
644 smartd.conf.4: smartd.conf.5
645 @echo ' cat smartd.conf.5 | $$(SOLARIS_MAN_FILTER) > $@'
646 @cat smartd.conf.5 | $(SOLARIS_MAN_FILTER) > $@
648 update-smart-drivedb.1m: update-smart-drivedb.8
649 @echo ' cat update-smart-drivedb.8 | $$(SOLARIS_MAN_FILTER) > $@'
650 @cat update-smart-drivedb.8 | $(SOLARIS_MAN_FILTER) > $@
653 # Commands to convert man pages into .html and .txt
656 #MAN2HTML = groff -man -Thtml
657 MAN2TXT = groff -man -Tascii -P'-bcou'
659 # Remove HTTP header and fix links in man2html output
660 FIXHTML = sed -e '1s,^Content-type.*,,' \
661 -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
662 -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \
663 -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
664 -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
666 # Convert man pages into .html and .txt
668 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
670 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
675 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
678 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
682 $(MAN2HTML) $< | $(FIXHTML) > $@
685 $(MAN2HTML) $< | $(FIXHTML) > $@
695 # Check drive database syntax
697 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
698 echo "$(srcdir)/drivedb.h: OK"; \
700 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
707 smartctl_res.o: smartctl_res.rc
710 smartd_res.o: smartd_res.rc syslogevt.rc
713 # Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754, set Copyright year
715 ( ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'`; \
716 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h`; \
717 txtver="$${ver:-0.0.0}.$${rev:-0}"; binver=`echo "$$txtver" | sed 's|\.|,|g'`; \
718 yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h`; yy="$${yy:-XX}"; \
719 sed -e "s|@BINARY_VERSION@|$$binver|g" -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; )
721 smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
722 cat $< | $(WIN_RC_FILTER) > $@
724 smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
725 cat $< | $(WIN_RC_FILTER) > $@
727 syslogevt.rc: os_win32/syslogevt.mc
730 # Definitions for Windows distribution
738 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
739 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
740 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
742 exedir_win32 = $(distdir_win32)/bin
743 docdir_win32 = $(distdir_win32)/doc
746 $(exedir_win32)/smartctl.exe \
747 $(exedir_win32)/smartctl-nc.exe \
748 $(exedir_win32)/smartd.exe \
749 $(exedir_win32)/smartd_warning.cmd \
750 $(exedir_win32)/runcmda.exe \
751 $(exedir_win32)/runcmdu.exe \
752 $(exedir_win32)/wtssendmsg.exe
757 $(exedir_win32)/update-smart-drivedb.exe
763 $(docdir_win32)/AUTHORS.txt \
764 $(docdir_win32)/ChangeLog.txt \
765 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
766 $(docdir_win32)/COPYING.txt \
767 $(docdir_win32)/INSTALL.txt \
768 $(docdir_win32)/NEWS.txt \
769 $(docdir_win32)/README.txt \
770 $(docdir_win32)/TODO.txt \
771 $(docdir_win32)/checksums$(win_bits).txt \
772 $(docdir_win32)/smartd.conf \
773 $(docdir_win32)/smartctl.8.html \
774 $(docdir_win32)/smartctl.8.txt \
775 $(docdir_win32)/smartd.8.html \
776 $(docdir_win32)/smartd.8.txt \
777 $(docdir_win32)/smartd.conf.5.html \
778 $(docdir_win32)/smartd.conf.5.txt \
779 $(exedir_win32)/runcmda.exe.manifest \
780 $(exedir_win32)/runcmdu.exe.manifest
784 $(exedir_win32)/drivedb.h
790 smartctl-nc.exe smartctl-nc.exe.tmp \
791 smartctl_res.rc smartctl_res.o \
792 smartd_res.rc smartd_res.o \
793 syslogevt.h syslogevt.o \
794 syslogevt.rc syslogevt_*.bin \
796 update-smart-drivedb.exe \
799 # Textfile converter from package cygutils or tofrodos
800 # Note: Only use without options to be compatible with both packages
804 # Build Windows distribution
806 dist-win32: $(distzip_win32)
808 install-win32: $(distinst_win32)
811 installer-win32: $(distinst_win32)
813 distdir-win32: distdir.mkdir $(FILES_WIN32)
815 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
816 @rm -fv $(distzip_win32)
817 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
820 sha256sum $@ > $@.sha256
823 # Build NSIS installer
824 # Note: Only option character '-' is also compatible with Linux version of makensis
825 $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
826 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
827 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`; \
828 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`; \
829 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO); \
830 d64=; test -z '$(builddir_win64)' || d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; \
831 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<"; \
832 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
835 sha256sum $@ > $@.sha256
837 # Build drivedb.h update tool
838 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
839 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
843 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
848 rm -rf $(distdir_win32) distdir.mkdir
851 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
852 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
855 $(exedir_win32)/%.exe: %.exe
857 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
860 # strip would break NSIS integrity check
861 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
864 # runcmd?.exe only differ by .exe.manifest files
865 $(exedir_win32)/runcmda.exe: $(exedir_win32)/runcmdu.exe
868 $(exedir_win32)/%.h: $(srcdir)/%.h
869 $(UNIX2DOS) < $< > $@
872 $(exedir_win32)/%.exe.manifest: $(srcdir)/os_win32/%.exe.manifest
873 $(UNIX2DOS) < $< > $@
876 $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
877 $(UNIX2DOS) < $< > $@
880 $(docdir_win32)/%.html: %.html
881 $(UNIX2DOS) < $< > $@
884 $(docdir_win32)/%.txt: %.txt
885 $(UNIX2DOS) < $< > $@
888 $(docdir_win32)/%.txt: $(srcdir)/%
889 $(UNIX2DOS) < $< > $@
892 $(docdir_win32)/%.conf: $(srcdir)/%.conf
893 $(UNIX2DOS) < $< > $@
896 $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
897 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
900 # Build non-console version of smartctl for GSmartControl.
901 # The script below changes the word at offset 220 (Subsystem) from 3
902 # (Console) to 2 (GUI) in a copy of smartctl.exe.
903 # This will be changed when a tool (like 'editbin') is available in
904 # the Cygwin distribution
905 smartctl-nc.exe: smartctl.exe
907 cp -p smartctl.exe $@.tmp
908 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
909 else echo "invalid EXE header"; exit 1; fi
910 @echo "editbin /subsystem:windows $@.tmp"
911 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
912 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
913 else echo "EXE patch failed"; exit 1; fi
916 # Build runcmd?.exe and wtssendmsg.exe
917 runcmdu.exe: os_win32/runcmd.c
920 wtssendmsg.exe: os_win32/wtssendmsg.c
921 $(CC) -Os -o $@ $< -lwtsapi32
923 # Build os_win32/vc10/{config.h,smart*.rc,svnversion.h} for MSVC10 from MinGW files
925 config-vc10: $(srcdir)/os_win32/vc10/config.h \
926 $(srcdir)/os_win32/vc10/smartctl_res.rc \
927 $(srcdir)/os_win32/vc10/smartd_res.rc \
928 $(srcdir)/os_win32/vc10/svnversion.h
930 $(srcdir)/os_win32/vc10/config.h: config.h Makefile
931 sed -e '1i/* os_win32/vc10/config.h. Generated from config.h by Makefile. */' \
932 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
933 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
935 $(srcdir)/os_win32/vc10/svnversion.h: svnversion.h
938 $(srcdir)/os_win32/vc10/smartctl_res.rc: smartctl_res.rc
941 $(srcdir)/os_win32/vc10/smartd_res.rc: smartd_res.rc