1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am 4299 2016-04-16 19:45:57Z 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
45 if ENABLE_UPDATE_SMART_DRIVEDB
48 sbin_SCRIPTS = update-smart-drivedb
85 smartctl_LDADD = $(os_deps) $(os_libs)
86 smartctl_DEPENDENCIES = $(os_deps)
88 EXTRA_smartctl_SOURCES = \
118 smartctl_LDADD += smartctl_res.o $(os_win32_manifest)
119 smartctl_DEPENDENCIES += smartctl_res.o $(os_win32_manifest)
130 dev_ata_cmd_set.cpp \
147 smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD)
148 smartd_DEPENDENCIES = $(os_deps)
150 EXTRA_smartd_SOURCES = \
176 freebsd_nvme_ioctl.h \
182 os_win32/daemon_win32.cpp \
183 os_win32/daemon_win32.h \
184 os_win32/syslog_win32.cpp \
187 smartd_LDADD += smartd_res.o $(os_win32_manifest)
188 smartd_DEPENDENCIES += smartd_res.o $(os_win32_manifest)
192 # Exclude from source tarball
193 nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s
194 nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s
198 smartctl_SOURCES += \
212 smartctl_SOURCES += \
215 regex/regex_internal.h
220 regex/regex_internal.h
222 # Included by regex.c:
223 EXTRA_smartctl_SOURCES += \
226 regex/regex_internal.c
228 EXTRA_smartd_SOURCES += \
231 regex/regex_internal.c
237 smartctl_SOURCES += \
239 os_win32/wmiquery.cpp \
244 os_win32/wmiquery.cpp \
247 smartctl_LDADD += -lole32 -loleaut32
248 smartd_LDADD += -lole32 -loleaut32
253 # This block is required because Solaris uses manual page section 1m
254 # for administrative command (linux/freebsd use section 8) and Solaris
255 # uses manual page section 4 for file formats (linux/freebsd use
256 # section 5). Automake can deal cleanly with man page sections 1-8
257 # and n, but NOT with sections of the form 1m.
258 extra_MANS = smartd.conf.4 \
261 if ENABLE_UPDATE_SMART_DRIVEDB
262 extra_MANS += update-smart-drivedb.1m
265 all-local: $(extra_MANS)
266 install-man: $(extra_MANS)
268 $(MKDIR_P) '$(DESTDIR)$(mandir)/man4'
269 $(MKDIR_P) '$(DESTDIR)$(mandir)/man1m'
270 for i in $(extra_MANS); do \
271 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
273 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
274 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
275 inst=`echo $$inst | sed -e 's/^.*\///'`; \
276 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
277 echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
278 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
282 for i in $(extra_MANS); do \
283 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
285 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
286 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
287 inst=`echo $$inst | sed -e 's/^.*\///'`; \
288 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
289 echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
290 rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
293 # For systems that adopts traditional manner
295 man_MANS = smartd.conf.5 \
299 if ENABLE_UPDATE_SMART_DRIVEDB
300 man_MANS += update-smart-drivedb.8
317 examplesdir=$(exampledir)
319 examplescripts/README
321 examplescripts/Example1 \
322 examplescripts/Example2 \
323 examplescripts/Example3 \
324 examplescripts/Example4 \
325 examplescripts/Example5 \
326 examplescripts/Example6
328 sysconf_DATA = smartd.conf
330 # If modified smartd.conf exists install smartd.conf.sample instead
331 install-sysconfDATA: $(sysconf_DATA)
332 $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'
333 @s="$(srcdir)/smartd.conf"; \
334 f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
335 if test -z "$(smartd_suffix)" && test -f "$$f"; then \
336 if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
337 echo "************************************************************"; \
338 echo "*** $$f preserved"; \
339 echo "*** installing smartd.conf.sample instead"; \
340 echo "************************************************************"; \
344 echo " $(INSTALL_DATA) '$$s' '$$f'"; \
345 $(INSTALL_DATA) "$$s" "$$f"
347 # If smartd.conf.sample exists preserve smartd.conf
348 uninstall-sysconfDATA:
349 @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
350 if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
351 echo "************************************************************"; \
352 echo "*** $$f preserved"; \
353 echo "*** removing smartd.conf.sample instead"; \
354 echo "************************************************************"; \
357 echo " rm -f '$$f'"; \
360 smartdscript_SCRIPTS = smartd_warning.sh
365 smartd.freebsd.initd.in \
371 smartd_warning.sh.in \
372 update-smart-drivedb.in \
373 update-smart-drivedb.8.in \
375 os_darwin/com.smartmontools.smartd.plist.in \
376 os_darwin/pkg/PackageInfo.in \
377 os_darwin/pkg/Distribution.in \
378 os_darwin/pkg/installer/README.html \
379 os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall \
380 os_win32/default.manifest \
381 os_win32/installer.nsi \
383 os_win32/smartctl_res.rc.in \
384 os_win32/smartd_res.rc.in \
385 os_win32/smartd_warning.cmd \
386 os_win32/syslogevt.mc \
387 os_win32/update-smart-drivedb.nsi \
388 os_win32/wbemcli_small.h \
389 os_win32/wtssendmsg.c \
405 smartctl.8.html.tmp \
408 smartd.conf.5.html.tmp \
411 smartd.freebsd.initd \
415 update-smart-drivedb \
416 update-smart-drivedb.8 \
417 update-smart-drivedb.1m \
420 # 'make maintainer-clean' also removes files generated by './autogen.sh'
421 MAINTAINERCLEANFILES = \
422 $(srcdir)/Makefile.in \
423 $(srcdir)/aclocal.m4 \
425 $(srcdir)/configure \
426 $(srcdir)/config.guess \
427 $(srcdir)/config.h.in \
428 $(srcdir)/config.h.in~ \
429 $(srcdir)/config.sub \
431 $(srcdir)/install-sh \
435 utility.o: svnversion.h
438 # Get version info from SVN
439 svnversion.h: ChangeLog Makefile $(svn_deps)
440 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
441 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
443 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
444 && TZ= LC_ALL=C svn info 2>/dev/null \
445 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
446 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
449 # SVN not available, guess version info from Id strings
450 svnversion.h: ChangeLog Makefile NEWS
451 @echo ' cat ChangeLog NEWS $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
452 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
453 @(cd $(srcdir) && cat ChangeLog NEWS Makefile.am configure.ac smart*.in *.cpp *.h) \
454 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
456 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
457 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
462 drivedb_DATA = drivedb.h
465 update-smart-drivedb: update-smart-drivedb.in config.status
466 $(SHELL) ./config.status --file=$@
469 smartd_warning.sh: smartd_warning.sh.in config.status
470 $(SHELL) ./config.status --file=$@
473 if INSTALL_INITSCRIPT
475 initd_DATA = com.smartmontools.smartd.plist
477 initd_DATA_install = install-initdDATA-darwin
478 initd_DATA_uninstall = uninstall-initdDATA-darwin
480 com.smartmontools.smartd.plist : os_darwin/com.smartmontools.smartd.plist.in
481 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
483 install-initdDATA-darwin: $(initd_DATA)
484 $(MKDIR_P) '$(DESTDIR)$(initddir)'
485 $(INSTALL_DATA) $(top_builddir)/$(initd_DATA) $(DESTDIR)$(initddir)/$(initd_DATA)
487 uninstall-initdDATA-darwin:
488 rm -f $(DESTDIR)$(initddir)/$(initd_DATA)
492 initd_DATA = $(initdfile)
494 $(initdfile): $(srcdir)/$(initdfile).in Makefile
495 sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
497 initd_install_name = smartd$(smartd_suffix)
499 initd_DATA_install = install-initdDATA-generic
500 initd_DATA_uninstall = uninstall-initdDATA-generic
502 install-initdDATA-generic: $(initd_DATA)
503 $(MKDIR_P) '$(DESTDIR)$(initddir)'
504 $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
506 uninstall-initdDATA-generic:
507 rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
511 initd_DATA_install = install-initdDATA-null
512 initd_DATA_uninstall = uninstall-initdDATA-null
514 install-initdDATA-null:
515 uninstall-initdDATA-null:
518 install-initdDATA : $(initd_DATA_install)
520 uninstall-initdDATA: $(initd_DATA_uninstall)
522 if INSTALL_SYSTEMDUNIT
523 systemdsystemunit_DATA = smartd.service
526 smartd.service: smartd.service.in Makefile
527 @echo ' $$(SMARTD_SERVICE_FILTER) < $(srcdir)/smartd.service.in > $@'
529 sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \
530 if test -n '$(systemdenvfile)'; then \
531 sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \
533 sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \
534 fi; } < $(srcdir)/smartd.service.in > $@
537 # Create empty directories if configured.
538 # Default install rules no longer create empty directories since automake 1.11.
540 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
541 test -n "$$d" || continue; \
542 echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
543 $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
546 install-data-local: installdirs-local
552 sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \
553 -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \
554 -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \
555 -e 's|/usr/local/share/man/|$(mandir)/|g' \
556 -e 's|/usr/local/sbin/|$(sbindir)/|g' \
557 -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \
558 -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \
559 -e 's|!exampledir!|$(exampledir)/|g' \
560 -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \
561 -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \
562 -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \
563 -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \
564 -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \
565 -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
566 -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
567 if test -n '$(drivedbdir)'; then \
568 sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
570 sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
572 if test '$(with_update_smart_drivedb)' = 'yes'; then \
575 sed '/^\.\\" %IF ENABLE_UPDATE_SMART_DRIVEDB/,/^\.\\" %ENDIF ENABLE_UPDATE_SMART_DRIVEDB/ s,^,.\\"\# ,' ; \
577 if test -n '$(initddir)'; then \
578 sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \
580 sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \
582 if test -n '$(savestates)'; then \
583 sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \
585 sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \
587 if test -n '$(attributelog)'; then \
588 sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \
590 sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \
592 if test -n '$(smartdplugindir)'; then \
593 sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \
595 sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \
597 if test -n '$(CAPNG_LDADD)'; then \
600 sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
602 if test '$(with_nvme_devicescan)' = 'yes'; then \
605 sed '/^\.\\" %IF ENABLE_NVME_DEVICESCAN/,/^\.\\" %ENDIF ENABLE_NVME_DEVICESCAN/ s,^,.\\"\# ,' ; \
607 if test -n '$(os_man_filter)'; then \
608 sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
609 -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
610 -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
611 -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
612 -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
613 -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
619 # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
620 smartctl.8: smartctl.8.in Makefile svnversion.h
621 @echo ' $$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@'
622 @$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@
624 smartd.8: smartd.8.in Makefile svnversion.h
625 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@'
626 @$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@
628 smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
629 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@'
630 @$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@
632 update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
633 @echo ' $$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@'
634 @$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@
636 # Build Solaris specific man pages
637 SOLARIS_MAN_FILTER = \
638 sed -e '/^\.TH/s, \([58]\) , !!\1!! ,' \
639 -e '/^\.BR/s, (\([578]\)), (!!\1!!),' \
640 -e 's,\\fP(\([578]\)),\\fP(!!\1!!),g' \
641 -e 's,!!5!!,4,g' -e 's,!!7!!,5,g' -e 's,!!8!!,1m,g' \
642 -e 's,/var/log/messages,/var/adm/messages,g'
644 smartctl.1m: smartctl.8
645 @echo ' $$(SOLARIS_MAN_FILTER) < smartctl.8 > $@'
646 @$(SOLARIS_MAN_FILTER) < smartctl.8 > $@
649 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.8 > $@'
650 @$(SOLARIS_MAN_FILTER) < smartd.8 > $@
652 smartd.conf.4: smartd.conf.5
653 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@'
654 @$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@
656 update-smart-drivedb.1m: update-smart-drivedb.8
657 @echo ' $$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@'
658 @$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@
661 # Commands to convert man pages into .html and .txt
664 #MAN2HTML = groff -man -Thtml
665 MAN2TXT = groff -man -Tascii -P'-bcou'
667 # Remove HTTP header and fix links in man2html output
668 FIXHTML = sed -e '1s,^Content-type.*,,' \
669 -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
670 -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \
671 -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
672 -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
674 # Convert man pages into .html and .txt
676 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
678 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
681 $(MAN2HTML) $< > $@.tmp
682 @echo ' $$(FIXHTML) < $@.tmp > $@'
683 @$(FIXHTML) < $@.tmp > $@
686 $(MAN2HTML) $< > $@.tmp
687 @echo ' $$(FIXHTML) < $@.tmp > $@'
688 @$(FIXHTML) < $@.tmp > $@
697 # Check drive database syntax
699 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
700 echo "$(srcdir)/drivedb.h: OK"; \
702 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
709 smartctl_res.o: smartctl_res.rc
712 smartd_res.o: smartd_res.rc syslogevt.rc
715 # Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754, set Copyright year
717 ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'` && \
718 rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h` && \
719 txtver="$${ver:-0.0.0}.$${rev:-0}" && binver=`echo "$$txtver" | sed 's|\.|,|g'` && \
720 yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h` && yy="$${yy:-XX}" && \
721 sed -e "s|@BINARY_VERSION@|$$binver|g" -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; }
723 smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
724 @echo ' $$(WIN_RC_FILTER) < $< > $@'
725 @$(WIN_RC_FILTER) < $< > $@
727 smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
728 @echo ' $$(WIN_RC_FILTER) < $< > $@'
729 @$(WIN_RC_FILTER) < $< > $@
731 syslogevt.rc: os_win32/syslogevt.mc
734 # Application manifests
736 default.manifest.o: os_win32/default.manifest
737 echo '1 24 "$<"' | $(WINDRES) -J rc -o $@
739 defadmin.manifest.o: defadmin.manifest
740 echo '1 24 "$<"' | $(WINDRES) -J rc -o $@
742 defadmin.manifest: os_win32/default.manifest
743 sed 's,"asInvoker","requireAdministrator",' $< > $@
745 # Definitions for Windows distribution
753 distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
754 distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
755 distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
757 exedir_win32 = $(distdir_win32)/bin
758 docdir_win32 = $(distdir_win32)/doc
761 $(exedir_win32)/smartctl.exe \
762 $(exedir_win32)/smartctl-nc.exe \
763 $(exedir_win32)/smartd.exe \
764 $(exedir_win32)/smartd_warning.cmd \
765 $(exedir_win32)/runcmda.exe \
766 $(exedir_win32)/runcmdu.exe \
767 $(exedir_win32)/wtssendmsg.exe
772 $(exedir_win32)/update-smart-drivedb.exe
778 $(docdir_win32)/AUTHORS.txt \
779 $(docdir_win32)/ChangeLog.txt \
780 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
781 $(docdir_win32)/COPYING.txt \
782 $(docdir_win32)/INSTALL.txt \
783 $(docdir_win32)/NEWS.txt \
784 $(docdir_win32)/README.txt \
785 $(docdir_win32)/TODO.txt \
786 $(docdir_win32)/checksums$(win_bits).txt \
787 $(docdir_win32)/smartd.conf \
788 $(docdir_win32)/smartctl.8.html \
789 $(docdir_win32)/smartctl.8.txt \
790 $(docdir_win32)/smartd.8.html \
791 $(docdir_win32)/smartd.8.txt \
792 $(docdir_win32)/smartd.conf.5.html \
793 $(docdir_win32)/smartd.conf.5.txt
797 $(exedir_win32)/drivedb.h
804 runcmda.exe runcmdu.exe \
805 smartctl-nc.exe smartctl-nc.exe.tmp \
806 smartctl_res.rc smartd_res.rc \
808 syslogevt.rc syslogevt_*.bin \
809 update-smart-drivedb.exe \
812 # Note: Only use without options to be compatible with all variants
815 # Build Windows distribution
817 dist-win32: $(distzip_win32)
819 install-win32: $(distinst_win32)
822 installer-win32: $(distinst_win32)
824 distdir-win32: distdir.mkdir $(FILES_WIN32)
826 $(distzip_win32): distdir.mkdir $(FILES_WIN32)
827 @rm -fv $(distzip_win32)
828 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
831 sha256sum $@ > $@.sha256
834 # Build NSIS installer
835 # Note: Only option character '-' is also compatible with Linux version of makensis
836 $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
837 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
838 @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h` && \
839 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h` && \
840 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO) && \
841 d64= && if [ -n '$(builddir_win64)' ]; then d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; fi && \
842 echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<" && \
843 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
846 sha256sum $@ > $@.sha256
848 # Build drivedb.h update tool
849 update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
850 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
854 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
859 rm -rf $(distdir_win32) distdir.mkdir
862 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
863 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
866 $(exedir_win32)/%.exe: %.exe
868 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
871 # strip would break NSIS integrity check
872 $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
875 $(exedir_win32)/%.h: $(srcdir)/%.h
876 $(UNIX2DOS) < $< > $@
879 $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
880 $(UNIX2DOS) < $< > $@
883 $(docdir_win32)/%.html: %.html
884 $(UNIX2DOS) < $< > $@
887 $(docdir_win32)/%.txt: %.txt
888 $(UNIX2DOS) < $< > $@
891 $(docdir_win32)/%.txt: $(srcdir)/%
892 $(UNIX2DOS) < $< > $@
895 $(docdir_win32)/%.conf: $(srcdir)/%.conf
896 $(UNIX2DOS) < $< > $@
899 $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
900 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
903 # Build non-console version of smartctl for GSmartControl.
904 # The script below changes the word at offset 220 (Subsystem) from 3
905 # (Console) to 2 (GUI) in a copy of smartctl.exe.
906 # This will be changed when a tool (like 'editbin') is available in
907 # the Cygwin distribution
908 smartctl-nc.exe: smartctl.exe
910 cp -p smartctl.exe $@.tmp
911 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
912 else echo "invalid EXE header"; exit 1; fi
913 @echo "editbin /subsystem:windows $@.tmp"
914 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
915 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
916 else echo "EXE patch failed"; exit 1; fi
919 # Build runcmd?.exe and wtssendmsg.exe
920 runcmd.o: os_win32/runcmd.c
923 runcmdu.exe: runcmd.o $(os_win32_manifest)
926 runcmda.exe: runcmd.o defadmin.manifest.o
929 wtssendmsg.exe: os_win32/wtssendmsg.c $(os_win32_manifest)
930 $(CC) -Os -o $@ $< $(os_win32_manifest) -lwtsapi32
932 # Build os_win32/vc10/{config.h,smart*.rc,svnversion.h} for MSVC10 from MinGW files
934 config-vc10: $(srcdir)/os_win32/vc10/config.h \
935 $(srcdir)/os_win32/vc10/smartctl_res.rc \
936 $(srcdir)/os_win32/vc10/smartd_res.rc \
937 $(srcdir)/os_win32/vc10/svnversion.h
939 $(srcdir)/os_win32/vc10/config.h: config.h Makefile
940 sed -e '1i/* os_win32/vc10/config.h. Generated from config.h by Makefile. */' \
941 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
942 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
944 $(srcdir)/os_win32/vc10/svnversion.h: svnversion.h
947 $(srcdir)/os_win32/vc10/smartctl_res.rc: smartctl_res.rc
950 $(srcdir)/os_win32/vc10/smartd_res.rc: smartd_res.rc
955 # Definitions for OSX distribution
956 distdir_darwin = $(PACKAGE)-$(VERSION).darwin
957 dmg_darwin = $(PACKAGE)-$(VERSION).dmg
958 pkg_darwin = $(PACKAGE)-$(VERSION).pkg
960 # build darwin installer
962 ${MAKE} install DESTDIR=$(distdir_darwin)/root
963 @cp $(srcdir)/os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall $(distdir_darwin)/root$(sbindir)
964 @mkdir -p $(distdir_darwin)/pkg
965 @( cd $(distdir_darwin)/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > $(distdir_darwin)/pkg/Payload
966 PAYLOAD_FILES=`find $(distdir_darwin)/root | wc -l` &&\
967 PAYLOAD_SIZEKB=`du -BK -s $(distdir_darwin)/root|${AWK} '{print $$1}'|tr -d 'K'` &&\
968 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" \
969 -e "s|@size@|$${PAYLOAD_SIZEKB}|" $(srcdir)/os_darwin/pkg/PackageInfo.in \
970 > $(distdir_darwin)/pkg/PackageInfo &&\
971 sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" -e "s|@size@|$${PAYLOAD_SIZEKB}|" \
972 -e "s|@pkgname@|$(pkg_darwin)|" \
973 $(srcdir)/os_darwin/pkg/Distribution.in > $(distdir_darwin)/pkg/Distribution
974 @mkdir -p $(distdir_darwin)/pkg/Resources/English.lproj
975 @cp $(srcdir)/COPYING $(distdir_darwin)/pkg/Resources/English.lproj/license.txt
976 @mkbom -u 0 -g 80 $(distdir_darwin)/root $(distdir_darwin)/pkg/Bom
977 @mkdir -p $(distdir_darwin)/dmg
978 @( cd $(distdir_darwin)/pkg && xar --compression none -cf "../dmg/$(pkg_darwin)" * )
980 # build darwon dmg image
982 @cp $(srcdir)/os_darwin/pkg/installer/README.html $(distdir_darwin)/dmg
983 @mkisofs -V 'smartmontools' -no-pad -r -apple -o $(distdir_darwin)/smartmontools-$(VERSION).iso \
984 -hfs-bless "$(distdir_darwin)/dmg/" "$(distdir_darwin)/dmg/"
985 @dmg dmg $(distdir_darwin)/smartmontools-$(VERSION).iso $(dmg_darwin)
988 sha256sum $@ > $@.sha256
990 install-darwin: install-darwin-cleanup $(pkg_darwin) $(dmg_darwin)
992 install-darwin-cleanup:
993 @rm -rf $(distdir_darwin)