1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 4192 2015-12-19 13:59:40Z 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 = \
113 smartctl_LDADD += smartctl_res.o $(os_win32_manifest)
114 smartctl_DEPENDENCIES += smartctl_res.o $(os_win32_manifest)
125 dev_ata_cmd_set.cpp \
140 smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD)
141 smartd_DEPENDENCIES = $(os_deps)
143 EXTRA_smartd_SOURCES = \
173 os_win32/daemon_win32.cpp \
174 os_win32/daemon_win32.h \
175 os_win32/syslog_win32.cpp \
178 smartd_LDADD += smartd_res.o $(os_win32_manifest)
179 smartd_DEPENDENCIES += smartd_res.o $(os_win32_manifest)
183 # Exclude from source tarball
184 nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s
185 nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s
189 smartctl_SOURCES += \
203 smartctl_SOURCES += \
206 regex/regex_internal.h
211 regex/regex_internal.h
213 # Included by regex.c:
214 EXTRA_smartctl_SOURCES += \
217 regex/regex_internal.c
219 EXTRA_smartd_SOURCES += \
222 regex/regex_internal.c
228 smartctl_SOURCES += \
230 os_win32/wmiquery.cpp \
235 os_win32/wmiquery.cpp \
238 smartctl_LDADD += -lole32 -loleaut32
239 smartd_LDADD += -lole32 -loleaut32
244 # This block is required because Solaris uses manual page section 1m
245 # for administrative command (linux/freebsd use section 8) and Solaris
246 # uses manual page section 4 for file formats (linux/freebsd use
247 # section 5). Automake can deal cleanly with man page sections 1-8
248 # and n, but NOT with sections of the form 1m.
249 extra_MANS = smartd.conf.4 \
253 extra_MANS += update-smart-drivedb.1m
256 all-local: $(extra_MANS)
257 install-man: $(extra_MANS)
259 $(MKDIR_P) '$(DESTDIR)$(mandir)/man4'
260 $(MKDIR_P) '$(DESTDIR)$(mandir)/man1m'
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 " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
269 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
273 for i in $(extra_MANS); do \
274 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
276 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
277 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
278 inst=`echo $$inst | sed -e 's/^.*\///'`; \
279 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
280 echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
281 rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
284 # For systems that adopts traditional manner
286 man_MANS = smartd.conf.5 \
291 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 $(MKDIR_P) '$(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 "************************************************************"; \
348 echo " rm -f '$$f'"; \
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_darwin/pkg/PackageInfo.in \
370 os_darwin/pkg/Distribution.in \
371 os_darwin/pkg/installer/README.html \
372 os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall \
373 os_win32/default.manifest \
374 os_win32/installer.nsi \
376 os_win32/smartctl_res.rc.in \
377 os_win32/smartd_res.rc.in \
378 os_win32/smartd_warning.cmd \
379 os_win32/syslogevt.mc \
380 os_win32/update-smart-drivedb.nsi \
381 os_win32/wbemcli_small.h \
382 os_win32/wtssendmsg.c \
398 smartctl.8.html.tmp \
401 smartd.conf.5.html.tmp \
404 smartd.freebsd.initd \
408 update-smart-drivedb \
409 update-smart-drivedb.8 \
410 update-smart-drivedb.1m \
413 # 'make maintainer-clean' also removes files generated by './autogen.sh'
414 MAINTAINERCLEANFILES = \
415 $(srcdir)/Makefile.in \
416 $(srcdir)/aclocal.m4 \
418 $(srcdir)/configure \
419 $(srcdir)/config.guess \
420 $(srcdir)/config.h.in \
421 $(srcdir)/config.h.in~ \
422 $(srcdir)/config.sub \
424 $(srcdir)/install-sh \
428 utility.o: svnversion.h
431 # Get version info from SVN
432 svnversion.h: ChangeLog Makefile $(svn_deps)
433 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
434 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
436 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
437 && TZ= LC_ALL=C svn info 2>/dev/null \
438 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
439 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
442 # SVN not available, guess version info from Id strings
443 svnversion.h: ChangeLog Makefile NEWS
444 @echo ' cat ChangeLog NEWS $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
445 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
446 @(cd $(srcdir) && cat ChangeLog NEWS Makefile.am configure.ac smart*.in *.cpp *.h) \
447 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
449 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
450 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
455 drivedb_DATA = drivedb.h
458 update-smart-drivedb: update-smart-drivedb.in config.status
459 $(SHELL) ./config.status --file=$@
462 smartd_warning.sh: smartd_warning.sh.in config.status
463 $(SHELL) ./config.status --file=$@
466 if INSTALL_INITSCRIPT
469 os_darwin/StartupParameters.plist \
470 os_darwin/English_Localizable.strings
472 initd_install_name = SMART
474 initd_DATA_install = install-initdDATA-darwin
475 initd_DATA_uninstall = uninstall-initdDATA-darwin
477 SMART : os_darwin/SMART.in
478 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
480 install-initdDATA-darwin: $(initd_DATA)
481 $(MKDIR_P) $(DESTDIR)$(initddir)
482 $(MKDIR_P) $(DESTDIR)$(initddir)/SMART
483 $(MKDIR_P) $(DESTDIR)$(initddir)/SMART/Resources
484 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
485 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
486 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
487 for i in English ; do \
488 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
490 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
491 $$RDIR/Localizable.strings ; \
494 uninstall-initdDATA-darwin:
495 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
499 initd_DATA = $(initdfile)
501 $(initdfile): $(srcdir)/$(initdfile).in Makefile
502 sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
504 initd_install_name = smartd$(smartd_suffix)
506 initd_DATA_install = install-initdDATA-generic
507 initd_DATA_uninstall = uninstall-initdDATA-generic
509 install-initdDATA-generic: $(initd_DATA)
510 $(MKDIR_P) '$(DESTDIR)$(initddir)'
511 $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
513 uninstall-initdDATA-generic:
514 rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
518 initd_DATA_install = install-initdDATA-null
519 initd_DATA_uninstall = uninstall-initdDATA-null
521 install-initdDATA-null:
522 uninstall-initdDATA-null:
525 install-initdDATA : $(initd_DATA_install)
527 uninstall-initdDATA: $(initd_DATA_uninstall)
529 if INSTALL_SYSTEMDUNIT
530 systemdsystemunit_DATA = smartd.service
533 smartd.service: smartd.service.in Makefile
534 @echo ' $$(SMARTD_SERVICE_FILTER) < $(srcdir)/smartd.service.in > $@'
536 sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
537 if test -n '$(systemdenvfile)'; then \
538 sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
540 sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \
541 fi; } < $(srcdir)/smartd.service.in > $@
544 # Create empty directories if configured.
545 # Default install rules no longer create empty directories since automake 1.11.
547 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
548 test -n "$$d" || continue; \
549 echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
550 $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
553 install-data-local: installdirs-local
559 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
560 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
561 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
562 -e 's|/usr/local/share/man/|$(mandir)/|g' \
563 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
564 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
565 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
566 -e 's|!exampledir!|$(exampledir)/|g' \
567 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
568 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \
569 -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \
570 -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
571 -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
572 -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
573 -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
574 if test -n '$(drivedbdir)'; then \
575 sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
577 sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
579 if test -n '$(initddir)'; then \
580 sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \
582 sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \
584 if test -n '$(savestates)'; then \
585 sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \
587 sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \
589 if test -n '$(attributelog)'; then \
590 sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \
592 sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \
594 if test -n '$(smartdplugindir)'; then \
595 sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
597 sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
599 if test -n '$(CAPNG_LDADD)'; then \
602 sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
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 ' $$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@'
619 @$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@
621 smartd.8: smartd.8.in Makefile svnversion.h
622 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@'
623 @$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@
625 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
626 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@'
627 @$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@
629 update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
630 @echo ' $$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@'
631 @$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@
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 ' $$(SOLARIS_MAN_FILTER) < smartctl.8 > $@'
643 @$(SOLARIS_MAN_FILTER) < smartctl.8 > $@
646 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.8 > $@'
647 @$(SOLARIS_MAN_FILTER) < smartd.8 > $@
649 smartd.conf.4: smartd.conf.5
650 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@'
651 @$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@
653 update-smart-drivedb.1m: update-smart-drivedb.8
654 @echo ' $$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@'
655 @$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@
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
678 $(MAN2HTML) $< > $@.tmp
679 @echo ' $$(FIXHTML) < $@.tmp > $@'
680 @$(FIXHTML) < $@.tmp > $@
683 $(MAN2HTML) $< > $@.tmp
684 @echo ' $$(FIXHTML) < $@.tmp > $@'
685 @$(FIXHTML) < $@.tmp > $@
694 # Check drive database syntax
696 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
697 echo "$(srcdir)/drivedb.h: OK"; \
699 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
706 smartctl_res.o: smartctl_res.rc
709 smartd_res.o: smartd_res.rc syslogevt.rc
712 # Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754, set Copyright year
714 ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'` && \
715 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h` && \
716 txtver="$${ver:-0.0.0}.$${rev:-0}" && binver=`echo "$$txtver" | sed 's|\.|,|g'` && \
717 yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h` && yy="$${yy:-XX}" && \
718 sed -e "s|@BINARY_VERSION@|$$binver|g" -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; }
720 smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
721 @echo ' $$(WIN_RC_FILTER) < $< > $@'
722 @$(WIN_RC_FILTER) < $< > $@
724 smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
725 @echo ' $$(WIN_RC_FILTER) < $< > $@'
726 @$(WIN_RC_FILTER) < $< > $@
728 syslogevt.rc: os_win32/syslogevt.mc
731 # Application manifests
733 default.manifest.o: os_win32/default.manifest
734 echo '1 24 "$<"' | $(WINDRES) -J rc -o $@
736 defadmin.manifest.o: defadmin.manifest
737 echo '1 24 "$<"' | $(WINDRES) -J rc -o $@
739 defadmin.manifest: os_win32/default.manifest
740 sed 's,"asInvoker","requireAdministrator",' $< > $@
742 # Definitions for Windows distribution
750 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
751 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
752 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
754 exedir_win32 = $(distdir_win32)/bin
755 docdir_win32 = $(distdir_win32)/doc
758 $(exedir_win32)/smartctl.exe \
759 $(exedir_win32)/smartctl-nc.exe \
760 $(exedir_win32)/smartd.exe \
761 $(exedir_win32)/smartd_warning.cmd \
762 $(exedir_win32)/runcmda.exe \
763 $(exedir_win32)/runcmdu.exe \
764 $(exedir_win32)/wtssendmsg.exe
769 $(exedir_win32)/update-smart-drivedb.exe
775 $(docdir_win32)/AUTHORS.txt \
776 $(docdir_win32)/ChangeLog.txt \
777 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
778 $(docdir_win32)/COPYING.txt \
779 $(docdir_win32)/INSTALL.txt \
780 $(docdir_win32)/NEWS.txt \
781 $(docdir_win32)/README.txt \
782 $(docdir_win32)/TODO.txt \
783 $(docdir_win32)/checksums$(win_bits).txt \
784 $(docdir_win32)/smartd.conf \
785 $(docdir_win32)/smartctl.8.html \
786 $(docdir_win32)/smartctl.8.txt \
787 $(docdir_win32)/smartd.8.html \
788 $(docdir_win32)/smartd.8.txt \
789 $(docdir_win32)/smartd.conf.5.html \
790 $(docdir_win32)/smartd.conf.5.txt
794 $(exedir_win32)/drivedb.h
801 runcmda.exe runcmdu.exe \
802 smartctl-nc.exe smartctl-nc.exe.tmp \
803 smartctl_res.rc smartd_res.rc \
805 syslogevt.rc syslogevt_*.bin \
806 update-smart-drivedb.exe \
809 # Note: Only use without options to be compatible with all variants
812 # Build Windows distribution
814 dist-win32: $(distzip_win32)
816 install-win32: $(distinst_win32)
819 installer-win32: $(distinst_win32)
821 distdir-win32: distdir.mkdir $(FILES_WIN32)
823 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
824 @rm -fv $(distzip_win32)
825 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
828 sha256sum $@ > $@.sha256
831 # Build NSIS installer
832 # Note: Only option character '-' is also compatible with Linux version of makensis
833 $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
834 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
835 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h` && \
836 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h` && \
837 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO) && \
838 d64= && if [ -n '$(builddir_win64)' ]; then d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; fi && \
839 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<" && \
840 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
843 sha256sum $@ > $@.sha256
845 # Build drivedb.h update tool
846 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
847 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
851 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
856 rm -rf $(distdir_win32) distdir.mkdir
859 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
860 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
863 $(exedir_win32)/%.exe: %.exe
865 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
868 # strip would break NSIS integrity check
869 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
872 $(exedir_win32)/%.h: $(srcdir)/%.h
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 runcmd.o: os_win32/runcmd.c
920 runcmdu.exe: runcmd.o $(os_win32_manifest)
923 runcmda.exe: runcmd.o defadmin.manifest.o
926 wtssendmsg.exe: os_win32/wtssendmsg.c $(os_win32_manifest)
927 $(CC) -Os -o $@ $< $(os_win32_manifest) -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
952 # Definitions for OSX distribution
953 distdir_darwin = $(PACKAGE)-$(VERSION).darwin
954 dmg_darwin = $(PACKAGE)-$(VERSION).dmg
955 pkg_darwin = $(PACKAGE)-$(VERSION).pkg
957 # build darwin installer
959 ${MAKE} install DESTDIR=$(distdir_darwin)/root
960 @cp $(srcdir)/os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall $(distdir_darwin)/root$(sbindir)
961 @mkdir -p $(distdir_darwin)/pkg
962 @( cd $(distdir_darwin)/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > $(distdir_darwin)/pkg/Payload
963 PAYLOAD_FILES=`find $(distdir_darwin)/root | wc -l` &&\
964 PAYLOAD_SIZEKB=`du -BK -s $(distdir_darwin)/root|${AWK} '{print $$1}'|tr -d 'K'` &&\
965 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" \
966 -e "s|@size@|$${PAYLOAD_SIZEKB}|" $(srcdir)/os_darwin/pkg/PackageInfo.in \
967 > $(distdir_darwin)/pkg/PackageInfo &&\
968 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" -e "s|@size@|$${PAYLOAD_SIZEKB}|" \
969 -e "s|@pkgname@|$(pkg_darwin)|" \
970 $(srcdir)/os_darwin/pkg/Distribution.in > $(distdir_darwin)/pkg/Distribution
971 @mkdir -p $(distdir_darwin)/pkg/Resources/English.lproj
972 @cp $(srcdir)/COPYING $(distdir_darwin)/pkg/Resources/English.lproj/license.txt
973 @mkbom -u 0 -g 80 $(distdir_darwin)/root $(distdir_darwin)/pkg/Bom
974 @mkdir -p $(distdir_darwin)/dmg
975 @( cd $(distdir_darwin)/pkg && xar --compression none -cf "../dmg/$(pkg_darwin)" * )
977 # build darwon dmg image
979 @cp $(srcdir)/os_darwin/pkg/installer/README.html $(distdir_darwin)/dmg
980 @mkisofs -V 'smartmontools' -no-pad -r -apple -o $(distdir_darwin)/smartmontools-$(VERSION).iso \
981 -hfs-bless "$(distdir_darwin)/dmg/" "$(distdir_darwin)/dmg/"
982 @dmg dmg $(distdir_darwin)/smartmontools-$(VERSION).iso $(dmg_darwin)
985 sha256sum $@ > $@.sha256
987 install-darwin: install-darwin-cleanup $(pkg_darwin) $(dmg_darwin)
989 install-darwin-cleanup:
990 @rm -rf $(distdir_darwin)