1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 3759 2013-01-26 21:11:02Z 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)"
16 AM_CPPFLAGS = -DBUILD_INFO='$(BUILD_INFO)' -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"'
18 AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"'
21 AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"'
23 if ENABLE_ATTRIBUTELOG
24 AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
28 AM_CPPFLAGS += -I$(srcdir)/os_win32
31 AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
34 AM_CPPFLAGS += -I$(srcdir)/regex
44 sbin_SCRIPTS = update-smart-drivedb
77 smartctl_LDADD = @os_deps@ @os_libs@
78 smartctl_DEPENDENCIES = @os_deps@
80 EXTRA_smartctl_SOURCES = \
109 smartctl_LDADD += smartctl_res.o
110 smartctl_DEPENDENCIES += smartctl_res.o
121 dev_ata_cmd_set.cpp \
136 smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@
137 smartd_DEPENDENCIES = @os_deps@
139 EXTRA_smartd_SOURCES = \
169 os_win32/daemon_win32.cpp \
170 os_win32/daemon_win32.h \
171 os_win32/syslog_win32.cpp \
174 smartd_LDADD += smartd_res.o
175 smartd_DEPENDENCIES += smartd_res.o
182 smartctl_SOURCES += \
196 smartctl_SOURCES += \
199 regex/regex_internal.h
204 regex/regex_internal.h
206 # Included by regex.c:
207 EXTRA_smartctl_SOURCES += \
210 regex/regex_internal.c
212 EXTRA_smartd_SOURCES += \
215 regex/regex_internal.c
221 smartctl_SOURCES += \
223 os_win32/wmiquery.cpp \
228 os_win32/wmiquery.cpp \
231 smartctl_LDADD += -lole32 -loleaut32
232 smartd_LDADD += -lole32 -loleaut32
237 # This block is required because Solaris uses manual page section 1m
238 # for administrative command (linux/freebsd use section 8) and Solaris
239 # uses manual page section 4 for file formats (linux/freebsd use
240 # section 5). Automake can deal cleanly with man page sections 1-8
241 # and n, but NOT with sections of the form 1m.
242 extra_MANS = smartd.conf.4 \
245 install-man: $(extra_MANS)
247 $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
248 $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
249 for i in $(extra_MANS); do \
250 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
252 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
253 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
254 inst=`echo $$inst | sed -e 's/^.*\///'`; \
255 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
256 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
257 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
261 for i in $(extra_MANS); do \
262 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
264 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
265 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
266 inst=`echo $$inst | sed -e 's/^.*\///'`; \
267 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
268 echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
269 rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
272 awk '/^.TH/ {$$3="1m"} {print}' < $< | \
273 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
274 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
275 -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
276 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
277 -e 's|/var/log/messages|/var/adm/messages|g' \
278 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
280 awk '/^.TH/ {$$3="4"} {print}' < $< | \
281 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
282 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
283 -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
284 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
285 -e 's|/var/log/messages|/var/adm/messages|g' \
286 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
288 # For systems that adopts traditional manner
289 man_MANS = smartd.conf.5 \
307 examplesdir=$(exampledir)
309 examplescripts/README
311 examplescripts/Example1 \
312 examplescripts/Example2 \
313 examplescripts/Example3 \
314 examplescripts/Example4
316 sysconf_DATA = smartd.conf
318 # If modified smartd.conf exists install smartd.conf.sample instead
319 install-sysconfDATA: $(sysconf_DATA)
320 $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
321 @s="$(srcdir)/smartd.conf"; \
322 f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
323 if test -z "$(smartd_suffix)" && test -f "$$f"; then \
324 if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
325 echo "************************************************************"; \
326 echo "*** $$f preserved"; \
327 echo "*** installing smartd.conf.sample instead"; \
328 echo "************************************************************"; \
332 echo " $(INSTALL_DATA) $$s $$f"; \
333 $(INSTALL_DATA) "$$s" "$$f"
335 # If smartd.conf.sample exists preserve smartd.conf
336 uninstall-sysconfDATA:
337 @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
338 if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
339 echo "************************************************************"; \
340 echo "*** $$f preserved"; \
341 echo "*** removing smartd.conf.sample instead"; \
342 echo "************************************************************"; \
348 # automake does not allow 'sysconf_SCRIPTS'
349 sysscriptdir = $(sysconfdir)
350 sysscript_SCRIPTS = smartd_warning.sh
355 smartd.freebsd.initd.in \
361 smartd_warning.sh.in \
362 update-smart-drivedb.in \
365 os_darwin/StartupParameters.plist \
366 os_darwin/English_Localizable.strings \
367 os_win32/installer.nsi \
369 os_win32/runcmda.exe.manifest \
370 os_win32/runcmdu.exe.manifest \
371 os_win32/smartctl_res.rc.in \
372 os_win32/smartd_res.rc.in \
373 os_win32/smartd_warning.cmd \
374 os_win32/syslogevt.mc \
375 os_win32/update-smart-drivedb.nsi \
376 os_win32/wbemcli_small.h \
377 os_win32/wtssendmsg.c \
396 smartd.freebsd.initd \
400 update-smart-drivedb \
403 # 'make maintainer-clean' also removes files generated by './autogen.sh'
404 MAINTAINERCLEANFILES = \
405 $(srcdir)/Makefile.in \
406 $(srcdir)/aclocal.m4 \
407 $(srcdir)/configure \
408 $(srcdir)/config.guess \
409 $(srcdir)/config.h.in \
410 $(srcdir)/config.h.in~ \
411 $(srcdir)/config.sub \
413 $(srcdir)/install-sh \
415 $(srcdir)/mkinstalldirs \
418 utility.o: svnversion.h
421 # Get version info from SVN
422 svnversion.h: ChangeLog Makefile $(svn_deps)
423 echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
425 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
426 && TZ= LC_ALL=C svn info 2>/dev/null \
427 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
428 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
431 # SVN not available, guess version info from Id strings
432 svnversion.h: ChangeLog Makefile
433 echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
434 (cd $(srcdir) && cat ChangeLog Makefile.am configure.ac smart*.in *.cpp *.h *.s) \
435 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
437 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
438 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
443 drivedb_DATA = drivedb.h
447 # Create $(savestatesdir) only
451 if ENABLE_ATTRIBUTELOG
452 # Create $(attributelogdir) only
456 update-smart-drivedb: update-smart-drivedb.in config.status
457 $(SHELL) ./config.status --file=$@
460 smartd_warning.sh: smartd_warning.sh.in config.status
461 $(SHELL) ./config.status --file=$@
464 if INSTALL_INITSCRIPT
467 os_darwin/StartupParameters.plist \
468 os_darwin/English_Localizable.strings
470 initd_install_name = SMART
472 initd_DATA_install = install-initdDATA-darwin
473 initd_DATA_uninstall = uninstall-initdDATA-darwin
475 SMART : os_darwin/SMART.in
476 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
478 install-initdDATA-darwin: $(initd_DATA)
479 $(mkinstalldirs) $(DESTDIR)$(initddir)
480 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
481 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
482 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
483 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
484 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
485 for i in English ; do \
486 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
487 $(mkinstalldirs) $$RDIR ;\
488 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
489 $$RDIR/Localizable.strings ; \
492 uninstall-initdDATA-darwin:
493 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
497 initd_DATA = @initdfile@
499 @initdfile@: $(srcdir)/@initdfile@.in Makefile
500 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/@initdfile@.in > $@
502 initd_install_name = smartd$(smartd_suffix)
504 initd_DATA_install = install-initdDATA-generic
505 initd_DATA_uninstall = uninstall-initdDATA-generic
507 install-initdDATA-generic: $(initd_DATA)
508 $(mkinstalldirs) $(DESTDIR)$(initddir)
509 $(INSTALL_SCRIPT) $(top_builddir)/@initdfile@ $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
512 uninstall-initdDATA-generic:
513 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
517 initd_DATA_install = install-initdDATA-null
518 initd_DATA_uninstall = uninstall-initdDATA-null
520 install-initdDATA-null:
521 uninstall-initdDATA-null:
524 install-initdDATA : $(initd_DATA_install)
526 uninstall-initdDATA: $(initd_DATA_uninstall)
528 if INSTALL_SYSTEMDUNIT
529 systemdsystemunit_DATA = smartd.service
532 smartd.service: smartd.service.in Makefile
533 sed -e 's|/usr/local/sbin/smartd|$(sbindir)/smartd|g' \
534 -e 's|/usr/local/etc/sysconfig/smartmontools|$(sysconfdir)/sysconfig/smartmontools|g' \
535 $(srcdir)/smartd.service.in > $@
537 if ENABLE_CAPABILITIES
538 MAN_CAPABILITIES = cat
540 MAN_CAPABILITIES = sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,'
544 MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
546 MAN_DRIVEDB = sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,'
550 MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
552 MAN_SAVESTATES = sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,'
555 if ENABLE_ATTRIBUTELOG
556 MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
558 MAN_ATTRIBUTELOG = sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,'
562 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
563 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
564 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
565 -e 's|/usr/local/share/man/|$(mandir)/|g' \
566 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
567 -e 's|/usr/local/etc/rc\.d/init.d/|$(initddir)/|g' \
568 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
569 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
570 -e 's|!exampledir!|$(exampledir)/|g' \
571 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
572 -e 's|/usr/local/etc/smartd_warning\.|$(sysconfdir)/smartd_warning.|g' \
573 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' | \
574 $(MAN_ATTRIBUTELOG) | \
575 $(MAN_CAPABILITIES) | \
577 $(MAN_SAVESTATES) | \
578 if test -n '$(os_man_filter)'; then \
579 sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
580 -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
581 -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
582 -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
583 -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
584 -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
590 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
591 smartctl.8: smartctl.8.in Makefile svnversion.h
592 cat $(srcdir)/smartctl.8.in | $(MAN_FILTER) > $@
594 smartd.8: smartd.8.in Makefile svnversion.h
595 cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@
597 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
598 cat $(srcdir)/smartd.conf.5.in | $(MAN_FILTER) > $@
600 # Commands to convert man pages into .html and .txt
603 #MAN2HTML = groff -man -Thtml
604 MAN2TXT = groff -man -Tascii -P'-bcou'
606 # Remove HTTP header and fix links in man2html output
607 FIXHTML = sed -e '1s,^Content-type.*,,' \
608 -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
609 -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \
610 -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
611 -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
613 # Convert man pages into .html and .txt
615 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
617 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
622 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
625 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
629 $(MAN2HTML) $< | $(FIXHTML) > $@
632 $(MAN2HTML) $< | $(FIXHTML) > $@
642 # Check drive database syntax
644 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
645 echo "$(srcdir)/drivedb.h: OK"; \
647 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
654 smartctl_res.o: smartctl_res.rc
657 smartd_res.o: smartd_res.rc syslogevt.rc
660 # Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754
662 ( ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'`; \
663 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h`; \
664 txtver="$${ver:-0.0.0}.$${rev:-0}"; binver=`echo "$$txtver" | sed 's|\.|,|g'`; \
665 sed -e "s|@BINARY_VERSION@|$$binver|g" -e "s|@TEXT_VERSION@|$$txtver|g"; )
667 smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
668 cat $< | $(WIN_RC_FILTER) > $@
670 smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
671 cat $< | $(WIN_RC_FILTER) > $@
673 syslogevt.rc: os_win32/syslogevt.mc
676 # Definitions for Windows distribution
684 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
685 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
686 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
688 exedir_win32 = $(distdir_win32)/bin
689 docdir_win32 = $(distdir_win32)/doc
692 $(exedir_win32)/smartctl.exe \
693 $(exedir_win32)/smartctl-nc.exe \
694 $(exedir_win32)/smartd.exe \
695 $(exedir_win32)/smartd_warning.cmd \
696 $(exedir_win32)/runcmda.exe \
697 $(exedir_win32)/runcmdu.exe \
698 $(exedir_win32)/wtssendmsg.exe
703 $(exedir_win32)/update-smart-drivedb.exe
709 $(docdir_win32)/AUTHORS.txt \
710 $(docdir_win32)/ChangeLog.txt \
711 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
712 $(docdir_win32)/COPYING.txt \
713 $(docdir_win32)/INSTALL.txt \
714 $(docdir_win32)/NEWS.txt \
715 $(docdir_win32)/README.txt \
716 $(docdir_win32)/TODO.txt \
717 $(docdir_win32)/WARNINGS.txt \
718 $(docdir_win32)/checksums$(win_bits).txt \
719 $(docdir_win32)/smartd.conf \
720 $(docdir_win32)/smartctl.8.html \
721 $(docdir_win32)/smartctl.8.txt \
722 $(docdir_win32)/smartd.8.html \
723 $(docdir_win32)/smartd.8.txt \
724 $(docdir_win32)/smartd.conf.5.html \
725 $(docdir_win32)/smartd.conf.5.txt \
726 $(exedir_win32)/runcmda.exe.manifest \
727 $(exedir_win32)/runcmdu.exe.manifest
731 $(exedir_win32)/drivedb.h
737 smartctl-nc.exe smartctl-nc.exe.tmp \
738 smartctl_res.rc smartctl_res.o \
739 smartd_res.rc smartd_res.o \
740 syslogevt.h syslogevt.o \
741 syslogevt.rc syslogevt_*.bin \
743 update-smart-drivedb.exe \
746 # Textfile converter from package cygutils or tofrodos
747 # Note: Only use without options to be compatible with both packages
751 # Build Windows distribution
753 dist-win32: $(distzip_win32)
755 install-win32: $(distinst_win32)
758 installer-win32: $(distinst_win32)
760 distdir-win32: distdir.mkdir $(FILES_WIN32)
762 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
763 @rm -fv $(distzip_win32)
764 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
767 sha256sum $@ > $@.sha256
770 # Build NSIS installer
771 # Note: Only option character '-' is also compatible with Linux version of makensis
772 $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
773 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
774 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`; \
775 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`; \
776 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO); \
777 d64=; test -z '$(builddir_win64)' || d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; \
778 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<"; \
779 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
782 sha256sum $@ > $@.sha256
784 # Build drivedb.h update tool
785 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
786 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
790 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
795 rm -rf $(distdir_win32) distdir.mkdir
798 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
799 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
802 $(exedir_win32)/%.exe: %.exe
804 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
807 # strip would break NSIS integrity check
808 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
811 # runcmd?.exe only differ by .exe.manifest files
812 $(exedir_win32)/runcmda.exe: $(exedir_win32)/runcmdu.exe
815 $(exedir_win32)/%.h: $(srcdir)/%.h
816 $(UNIX2DOS) < $< > $@
819 $(exedir_win32)/%.exe.manifest: $(srcdir)/os_win32/%.exe.manifest
820 $(UNIX2DOS) < $< > $@
823 $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
824 $(UNIX2DOS) < $< > $@
827 $(docdir_win32)/%.html: %.html
828 $(UNIX2DOS) < $< > $@
831 $(docdir_win32)/%.txt: %.txt
832 $(UNIX2DOS) < $< > $@
835 $(docdir_win32)/%.txt: $(srcdir)/%
836 $(UNIX2DOS) < $< > $@
839 $(docdir_win32)/%.conf: $(srcdir)/%.conf
840 $(UNIX2DOS) < $< > $@
843 $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
844 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
847 # Build non-console version of smartctl for GSmartControl.
848 # The script below changes the word at offset 220 (Subsystem) from 3
849 # (Console) to 2 (GUI) in a copy of smartctl.exe.
850 # This will be changed when a tool (like 'editbin') is available in
851 # the Cygwin distribution
852 smartctl-nc.exe: smartctl.exe
854 cp -p smartctl.exe $@.tmp
855 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
856 else echo "invalid EXE header"; exit 1; fi
857 @echo "editbin /subsystem:windows $@.tmp"
858 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
859 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
860 else echo "EXE patch failed"; exit 1; fi
863 # Build runcmd?.exe and wtssendmsg.exe
864 runcmdu.exe: os_win32/runcmd.c
867 wtssendmsg.exe: os_win32/wtssendmsg.c
868 $(CC) -Os -o $@ $< -lwtsapi32
870 # Build os_win32/vc10/{config.h,smart*.rc,svnversion.h} for MSVC10 from MinGW files
872 config-vc10: $(srcdir)/os_win32/vc10/config.h \
873 $(srcdir)/os_win32/vc10/smartctl_res.rc \
874 $(srcdir)/os_win32/vc10/smartd_res.rc \
875 $(srcdir)/os_win32/vc10/svnversion.h
877 $(srcdir)/os_win32/vc10/config.h: config.h Makefile
878 sed -e '1i/* os_win32/vc10/config.h. Generated from config.h by Makefile. */' \
879 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
880 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
882 $(srcdir)/os_win32/vc10/svnversion.h: svnversion.h
885 $(srcdir)/os_win32/vc10/smartctl_res.rc: smartctl_res.rc
888 $(srcdir)/os_win32/vc10/smartd_res.rc: smartd_res.rc