File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / smartmontools / Makefile.am
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 16:32:16 2012 UTC (12 years, 4 months ago) by misho
Branches: smartmontools, elwix, MAIN
CVS tags: v5_42, HEAD
smartmontools

    1: ## Process this file with automake to produce Makefile.in
    2: #
    3: # $Id: Makefile.am,v 1.1.1.1 2012/02/21 16:32:16 misho Exp $
    4: #
    5: 
    6: @SET_MAKE@
    7: 
    8: # Make sure .cpp takes precedence to avoid compiling old .c file
    9: SUFFIXES = .cpp .c .s .o
   10: 
   11: # BUILD_INFO can be provided by package maintainers (see INSTALL file)
   12: BUILD_INFO= "(local build)"
   13: 
   14: AM_CPPFLAGS = -DBUILD_INFO='$(BUILD_INFO)' -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"'
   15: if ENABLE_DRIVEDB
   16: AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"'
   17: endif
   18: if ENABLE_SAVESTATES
   19: AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"'
   20: endif
   21: if ENABLE_ATTRIBUTELOG
   22: AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
   23: endif
   24: 
   25: if OS_WIN32_MINGW
   26: AM_CPPFLAGS += -I$(srcdir)/os_win32
   27: endif
   28: if NEED_GETOPT_LONG
   29: AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
   30: endif
   31: if NEED_REGEX
   32: AM_CPPFLAGS += -I$(srcdir)/regex
   33: endif
   34: 
   35: sbin_PROGRAMS = smartd 	\
   36: 		smartctl
   37: 
   38: if ENABLE_DRIVEDB
   39: if OS_WIN32_MINGW
   40: else
   41: sbin_SCRIPTS = update-smart-drivedb
   42: endif
   43: endif
   44: 
   45: 
   46: smartd_SOURCES =  smartd.cpp      \
   47:                   atacmdnames.cpp \
   48:                   atacmdnames.h   \
   49:                   atacmds.cpp     \
   50:                   atacmds.h       \
   51:                   dev_ata_cmd_set.cpp \
   52:                   dev_ata_cmd_set.h   \
   53:                   dev_interface.cpp   \
   54:                   dev_interface.h     \
   55:                   dev_tunnelled.h     \
   56:                   drivedb.h           \
   57:                   int64.h         \
   58:                   knowndrives.cpp \
   59:                   knowndrives.h   \
   60:                   scsicmds.cpp    \
   61:                   scsicmds.h      \
   62:                   scsiata.cpp     \
   63:                   utility.cpp     \
   64:                   utility.h
   65: 
   66: smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@
   67: smartd_DEPENDENCIES = @os_deps@
   68: 
   69: EXTRA_smartd_SOURCES = os_darwin.cpp    \
   70:                        os_darwin.h      \
   71:                        os_linux.cpp     \
   72:                        os_linux.h       \
   73:                        os_freebsd.cpp   \
   74:                        os_freebsd.h     \
   75:                        os_netbsd.cpp    \
   76:                        os_netbsd.h      \
   77:                        os_openbsd.cpp   \
   78:                        os_openbsd.h     \
   79:                        os_qnxnto.cpp    \
   80:                        os_qnxnto.h      \
   81:                        os_solaris.cpp   \
   82:                        os_solaris.h     \
   83:                        os_solaris_ata.s \
   84:                        os_win32.cpp     \
   85:                        os_generic.cpp   \
   86:                        os_generic.h     \
   87:                        cciss.cpp        \
   88:                        cciss.h          \
   89:                        cissio_freebsd.h \
   90:                        dev_legacy.cpp   \
   91:                        megaraid.h
   92: 
   93: 
   94: if OS_WIN32_MINGW
   95: 
   96: smartd_SOURCES += \
   97:         os_win32/daemon_win32.cpp \
   98:         os_win32/daemon_win32.h \
   99:         os_win32/hostname_win32.cpp \
  100:         os_win32/hostname_win32.h \
  101:         os_win32/syslog_win32.cpp \
  102:         os_win32/syslog.h
  103: 
  104: endif
  105: 
  106: smartctl_SOURCES= smartctl.cpp    \
  107:                   smartctl.h      \
  108:                   atacmdnames.cpp \
  109:                   atacmdnames.h   \
  110:                   atacmds.cpp     \
  111:                   atacmds.h       \
  112:                   ataprint.cpp    \
  113:                   ataprint.h      \
  114:                   dev_ata_cmd_set.cpp \
  115:                   dev_ata_cmd_set.h   \
  116:                   dev_interface.cpp   \
  117:                   dev_interface.h     \
  118:                   dev_tunnelled.h     \
  119:                   drivedb.h           \
  120:                   int64.h         \
  121:                   knowndrives.cpp \
  122:                   knowndrives.h   \
  123:                   scsicmds.cpp    \
  124:                   scsicmds.h      \
  125:                   scsiata.cpp     \
  126:                   scsiprint.cpp   \
  127:                   scsiprint.h     \
  128:                   utility.cpp     \
  129:                   utility.h
  130: 
  131: 
  132: smartctl_LDADD = @os_deps@ @os_libs@
  133: smartctl_DEPENDENCIES = @os_deps@
  134: 
  135: EXTRA_smartctl_SOURCES = os_linux.cpp \
  136:                        os_linux.h     \
  137:                        os_freebsd.cpp \
  138:                        os_freebsd.h   \
  139:                        os_netbsd.cpp  \
  140:                        os_netbsd.h    \
  141:                        os_openbsd.cpp \
  142:                        os_openbsd.h   \
  143:                        os_qnxnto.cpp  \
  144:                        os_qnxnto.h    \
  145:                        os_solaris.cpp \
  146:                        os_solaris.h   \
  147:                        os_win32.cpp   \
  148:                        os_generic.cpp \
  149:                        os_generic.h   \
  150:                        cciss.cpp      \
  151:                        cciss.h        \
  152:                        cissio_freebsd.h \
  153:                        dev_legacy.cpp \
  154:                        megaraid.h
  155: 
  156: if NEED_GETOPT_LONG
  157: 
  158: smartctl_SOURCES += \
  159:         getopt/getopt.c \
  160:         getopt/getopt.h \
  161:         getopt/getopt1.c
  162: 
  163: smartd_SOURCES += \
  164:         getopt/getopt.c \
  165:         getopt/getopt.h \
  166:         getopt/getopt1.c
  167: 
  168: endif
  169: 
  170: if NEED_REGEX
  171: 
  172: smartctl_SOURCES += \
  173:         regex/regex.c \
  174:         regex/regex.h \
  175:         regex/regex_internal.h
  176: 
  177: smartd_SOURCES += \
  178:         regex/regex.c \
  179:         regex/regex.h \
  180:         regex/regex_internal.h
  181: 
  182: # Included by regex.c:
  183: EXTRA_smartctl_SOURCES += \
  184:         regex/regcomp.c \
  185:         regex/regexec.c \
  186:         regex/regex_internal.c
  187: 
  188: EXTRA_smartd_SOURCES += \
  189:         regex/regcomp.c \
  190:         regex/regexec.c \
  191:         regex/regex_internal.c
  192: 
  193: endif
  194: 
  195: if OS_WIN32
  196: 
  197: smartctl_SOURCES += \
  198:         csmisas.h \
  199:         os_win32/wmiquery.cpp \
  200:         os_win32/wmiquery.h
  201: 
  202: smartd_SOURCES += \
  203:         csmisas.h \
  204:         os_win32/wmiquery.cpp \
  205:         os_win32/wmiquery.h
  206: 
  207: smartctl_LDADD += -lole32 -loleaut32
  208: smartd_LDADD   += -lole32 -loleaut32
  209: 
  210: endif
  211: 
  212: if OS_SOLARIS
  213: # This block is required because Solaris uses manual page section 1m
  214: # for administrative command (linux/freebsd use section 8) and Solaris
  215: # uses manual page section 4 for file formats (linux/freebsd use
  216: # section 5).  Automake can deal cleanly with man page sections 1-8
  217: # and n, but NOT with sections of the form 1m.
  218: extra_MANS =      smartd.conf.4 \
  219:                   smartctl.1m   \
  220:                   smartd.1m
  221: install-man: $(extra_MANS)
  222: 	@$(NORMAL_INSTALL)
  223: 	$(mkinstalldirs) $(DESTDIR)$(mandir)/man4
  224: 	$(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
  225: 	for i in $(extra_MANS); do \
  226: 	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
  227: 	  else file=$$i; fi; \
  228: 	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
  229: 	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
  230: 	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
  231: 	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
  232: 	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
  233: 	  $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
  234: 	done
  235: uninstall-man:
  236: 	@$(NORMAL_UNINSTALL)
  237: 	for i in $(extra_MANS); do \
  238: 	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
  239: 	  else file=$$i; fi; \
  240: 	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
  241: 	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
  242: 	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
  243: 	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
  244: 	  echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
  245: 	  rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
  246: 	done
  247: %.1m: %.8
  248: 	awk '/^.TH/ {$$3="1m"} {print}' < $< | \
  249: 	sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
  250:             -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
  251: 	    -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
  252: 	    -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
  253:             -e 's|/var/log/messages|/var/adm/messages|g' \
  254: 	    -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
  255: %.4: %.5
  256: 	awk '/^.TH/ {$$3="4"}  {print}' < $< | \
  257: 	sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
  258:             -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
  259: 	    -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
  260: 	    -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
  261:             -e 's|/var/log/messages|/var/adm/messages|g' \
  262: 	    -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
  263: else
  264: # For systems that adopts traditional manner
  265: man_MANS =        smartd.conf.5 \
  266:                   smartctl.8    \
  267:                   smartd.8
  268: endif
  269: 
  270: docsdir=$(docdir)
  271: docs_DATA = AUTHORS     \
  272:             CHANGELOG   \
  273:             COPYING     \
  274:             INSTALL     \
  275:             NEWS        \
  276:             README      \
  277:             TODO        \
  278:             WARNINGS    \
  279:             smartd.conf
  280: 
  281: examplesdir=$(exampledir)
  282: examples_DATA = \
  283:         examplescripts/README
  284: examples_SCRIPTS = \
  285:         examplescripts/Example1 \
  286:         examplescripts/Example2 \
  287:         examplescripts/Example3 \
  288:         examplescripts/Example4
  289: 
  290: sysconf_DATA = smartd.conf
  291: 
  292: # If modified smartd.conf exists install smartd.conf.sample instead
  293: install-sysconfDATA: $(sysconf_DATA)
  294: 	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
  295: 	@s="$(srcdir)/smartd.conf"; \
  296: 	f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
  297: 	if test -z "$(smartd_suffix)" && test -f "$$f"; then \
  298: 	  if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \
  299: 	    echo "************************************************************"; \
  300: 	    echo "*** $$f preserved"; \
  301: 	    echo "*** installing smartd.conf.sample instead"; \
  302: 	    echo "************************************************************"; \
  303: 	    f="$$f".sample; \
  304: 	  fi; \
  305: 	fi; \
  306: 	echo " $(INSTALL_DATA) $$s $$f"; \
  307: 	$(INSTALL_DATA) "$$s" "$$f"
  308: 
  309: # If smartd.conf.sample exists preserve smartd.conf
  310: uninstall-sysconfDATA:
  311: 	@f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \
  312: 	if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \
  313: 	  echo "************************************************************"; \
  314: 	  echo "*** $$f preserved"; \
  315: 	  echo "*** removing smartd.conf.sample instead"; \
  316: 	  echo "************************************************************"; \
  317: 	  f="$$f".sample; \
  318: 	fi; \
  319: 	echo " rm -f $$f"; \
  320: 	rm -f "$$f"
  321: 
  322: EXTRA_DIST = \
  323:         autogen.sh \
  324:         smartd.initd.in \
  325:         smartd.freebsd.initd.in \
  326:         smartd.8.in \
  327:         smartctl.8.in \
  328:         smartd.conf.5.in \
  329:         smartd.conf \
  330:         smartd.service.in \
  331:         update-smart-drivedb.in \
  332:         os_darwin/SMART.in \
  333:         os_darwin/StartupParameters.plist \
  334:         os_darwin/English_Localizable.strings \
  335:         os_win32/installer.nsi \
  336:         os_win32/runcmd.c \
  337:         os_win32/runcmda.exe.manifest \
  338:         os_win32/runcmdu.exe.manifest \
  339:         os_win32/syslogevt.c \
  340:         os_win32/syslogevt.mc \
  341:         os_win32/update-smart-drivedb.nsi \
  342:         os_win32/wbemcli_small.h \
  343:         $(docs_DATA) \
  344:         $(examples_DATA) \
  345:         $(examples_SCRIPTS)
  346: 
  347: CLEANFILES = \
  348:         smartd.conf.5 \
  349:         smartd.conf.4 \
  350:         smartd.8 \
  351:         smartd.1m \
  352:         smartd.8.html \
  353:         smartd.8.txt \
  354:         smartctl.8 \
  355:         smartctl.1m \
  356:         smartctl.8.html \
  357:         smartctl.8.txt \
  358:         smartd.conf.5.html \
  359:         smartd.conf.5.txt \
  360:         smartd.initd \
  361:         smartd.freebsd.initd \
  362:         smartd.service \
  363:         svnversion.h \
  364:         update-smart-drivedb \
  365:         SMART
  366: 
  367: # 'make maintainer-clean' also removes files generated by './autogen.sh'
  368: MAINTAINERCLEANFILES = \
  369:         $(srcdir)/Makefile.in \
  370:         $(srcdir)/aclocal.m4 \
  371:         $(srcdir)/configure \
  372:         $(srcdir)/config.guess \
  373:         $(srcdir)/config.h.in \
  374:         $(srcdir)/config.h.in~ \
  375:         $(srcdir)/config.sub \
  376:         $(srcdir)/depcomp \
  377:         $(srcdir)/install-sh \
  378:         $(srcdir)/missing \
  379:         $(srcdir)/mkinstalldirs
  380: 
  381: utility.o: svnversion.h
  382: 
  383: if IS_SVN_BUILD
  384: # Get version info from SVN
  385: svnversion.h: CHANGELOG Makefile $(srcdir)/.svn/entries
  386: 	echo '/* svnversion.h.  Generated by Makefile from svn info.  */' > $@
  387: 	(cd $(srcdir) \
  388: 	 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV  "\1",p' \
  389: 	 && TZ= LC_ALL=C svn info 2>/dev/null \
  390: 	 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
  391: 	| sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
  392: else
  393: 
  394: # SVN not available, guess version info from Id strings
  395: svnversion.h: CHANGELOG Makefile
  396: 	echo '/* svnversion.h.  Generated by Makefile from Id strings.  */' > $@
  397: 	(cd $(srcdir) && cat CHANGELOG Makefile.am configure.in smart*.in *.cpp *.h *.s) \
  398: 	| sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
  399: 	| sort -n -r \
  400: 	| sed -n 'h;s,^\([^ ]*\) .*$$,REV  "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
  401: 	| sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
  402: endif
  403: 
  404: 
  405: if ENABLE_DRIVEDB
  406: drivedb_DATA = drivedb.h
  407: endif
  408: 
  409: if ENABLE_SAVESTATES
  410: # Create $(savestatesdir) only
  411: savestates_DATA =
  412: endif
  413: 
  414: if ENABLE_ATTRIBUTELOG
  415: # Create $(attributelogdir) only
  416: attributelog_DATA =
  417: endif
  418: 
  419: update-smart-drivedb: update-smart-drivedb.in config.status
  420: 	$(SHELL) ./config.status --file=$@
  421: 	chmod +x $@
  422: 
  423: 
  424: if INSTALL_INITSCRIPT
  425: if OS_DARWIN
  426: initd_DATA = SMART                            \
  427: 	os_darwin/StartupParameters.plist     \
  428: 	os_darwin/English_Localizable.strings
  429: 
  430: initd_install_name = SMART
  431: 
  432: initd_DATA_install = install-initdDATA-darwin
  433: initd_DATA_uninstall = uninstall-initdDATA-darwin
  434: 
  435: SMART : os_darwin/SMART.in
  436: 	sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
  437: 
  438: install-initdDATA-darwin: $(initd_DATA)
  439: 	$(mkinstalldirs) $(DESTDIR)$(initddir)
  440: 	$(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
  441: 	$(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
  442: 	$(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
  443: 	$(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
  444: 	    $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
  445: 	for i in English ; do \
  446: 	  RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
  447: 	  $(mkinstalldirs) $$RDIR ;\
  448: 	  $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
  449: 	    $$RDIR/Localizable.strings ; \
  450: 	done
  451: 
  452: uninstall-initdDATA-darwin:
  453: 	rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
  454: 
  455: else
  456: 
  457: initd_DATA = @initdfile@
  458: 
  459: @initdfile@: $(srcdir)/@initdfile@.in Makefile
  460: 	sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/@initdfile@.in > $@
  461: 
  462: initd_install_name = smartd$(smartd_suffix)
  463: 
  464: initd_DATA_install = install-initdDATA-generic
  465: initd_DATA_uninstall = uninstall-initdDATA-generic
  466: 
  467: install-initdDATA-generic: $(initd_DATA)
  468: 	$(mkinstalldirs) $(DESTDIR)$(initddir)
  469: 	$(INSTALL_SCRIPT) $(top_builddir)/@initdfile@ $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
  470: 
  471: 
  472: uninstall-initdDATA-generic:
  473: 	rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
  474: endif
  475: else
  476: 
  477: initd_DATA_install = install-initdDATA-null
  478: initd_DATA_uninstall = uninstall-initdDATA-null
  479: 
  480: install-initdDATA-null:
  481: uninstall-initdDATA-null:
  482: endif
  483: 
  484: install-initdDATA : $(initd_DATA_install)
  485: 
  486: uninstall-initdDATA: $(initd_DATA_uninstall)
  487: 
  488: if INSTALL_SYSTEMDUNIT
  489: systemdsystemunit_DATA = smartd.service
  490: endif
  491: 
  492: smartd.service: smartd.service.in Makefile
  493: 	sed "s|/usr/local/sbin/smartd|$(sbindir)/smartd|g; \
  494: 	     s|/usr/local/etc/sysconfig/smartmontools|$(sysconfdir)/sysconfig/smartmontools|g" \
  495: 	$(srcdir)/smartd.service.in > $@
  496: 
  497: if ENABLE_CAPABILITIES
  498: MAN_CAPABILITIES = cat
  499: else
  500: MAN_CAPABILITIES = sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,'
  501: endif
  502: 
  503: if ENABLE_DRIVEDB
  504: MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
  505: else
  506: MAN_DRIVEDB = sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,'
  507: endif
  508: 
  509: if ENABLE_SAVESTATES
  510: MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
  511: else
  512: MAN_SAVESTATES = sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,'
  513: endif
  514: 
  515: if ENABLE_ATTRIBUTELOG
  516: MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
  517: else
  518: MAN_ATTRIBUTELOG = sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,'
  519: endif
  520: 
  521: MAN_FILTER = \
  522:     sed "s|CURRENT_SVN_VERSION|$(releaseversion)|g; \
  523:          s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g; \
  524:          s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g; \
  525:          s|/usr/local/share/man/|$(mandir)/|g; \
  526:          s|/usr/local/sbin/|$(sbindir)/|g; \
  527:          s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g; \
  528:          s|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g; \
  529:          s|/usr/local/share/doc/smartmontools/|$(docsdir)/|g; \
  530:          s|!exampledir!|$(exampledir)/|g; \
  531:          s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g; \
  532:          s|/usr/local/etc/smart_drivedb\\.h|$(sysconfdir)/smart_drivedb\\.h|g" | \
  533:     $(MAN_ATTRIBUTELOG) | \
  534:     $(MAN_CAPABILITIES) | \
  535:     $(MAN_DRIVEDB) | \
  536:     $(MAN_SAVESTATES) | \
  537:     if test -n '$(os_man_filter)'; then \
  538:       sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \
  539:           -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \
  540:           -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \
  541:           -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \
  542:           -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \
  543:           -e '/^!!/{ s,^!!!*,,; s,^\.\\"! \(.*\)$$,\1 \\"\#, ;}' ; \
  544:     else \
  545:       cat; \
  546:     fi
  547: 
  548: # Implicit rule 'smart%: smart%.in ...' does not work with BSD make
  549: smartctl.8: smartctl.8.in Makefile svnversion.h
  550: 	cat $(srcdir)/smartctl.8.in | $(MAN_FILTER) > $@
  551: 
  552: smartd.8: smartd.8.in Makefile svnversion.h
  553: 	cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@
  554: 
  555: smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
  556: 	cat $(srcdir)/smartd.conf.5.in | $(MAN_FILTER) > $@
  557: 
  558: # Commands to convert man pages into .html and .txt
  559: # TODO: configure
  560: MAN2HTML = man2html
  561: #MAN2HTML = groff -man -Thtml
  562: MAN2TXT = groff -man -Tascii -P'-bcou'
  563: 
  564: # Remove HTTP header and fix links in man2html output
  565: FIXHTML = sed '1s,^Content-type.*,,' \
  566:         | sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
  567:         | sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
  568:         | sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
  569:         | sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
  570: 
  571: # Convert man pages into .html and .txt
  572: 
  573: htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
  574: 
  575: txtman:  smartctl.8.txt smartd.8.txt smartd.conf.5.txt
  576: 
  577: if OS_WIN32_MINGW
  578: 
  579: %.5.html: %.5
  580: 	$(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
  581: 
  582: %.8.html: %.8
  583: 	$(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
  584: else
  585: 
  586: %.5.html: %.5
  587: 	$(MAN2HTML) $< | $(FIXHTML) > $@
  588: 
  589: %.8.html: %.8
  590: 	$(MAN2HTML) $< | $(FIXHTML) > $@
  591: endif
  592: 
  593: %.5.txt: %.5
  594: 	$(MAN2TXT) $< > $@
  595: 
  596: %.8.txt: %.8
  597: 	$(MAN2TXT) $< > $@
  598: 
  599: 
  600: # Check drive database syntax
  601: check:
  602: 	@if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
  603: 	  echo "$(srcdir)/drivedb.h: OK"; \
  604: 	else \
  605: 	  echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
  606: 	fi
  607: 
  608: 
  609: if OS_WIN32_MINGW
  610: # Definitions for Windows distribution
  611: 
  612: if OS_WIN64
  613: win_bits = 64
  614: else
  615: win_bits = 32
  616: endif
  617: 
  618: distdir_win32  = $(PACKAGE)-$(VERSION).win$(win_bits)
  619: distzip_win32  = $(PACKAGE)-$(VERSION).win$(win_bits).zip
  620: distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
  621: 
  622: exedir_win32 = $(distdir_win32)/bin
  623: docdir_win32 = $(distdir_win32)/doc
  624: 
  625: EXEFILES_WIN32 = \
  626:         $(exedir_win32)/smartctl.exe \
  627:         $(exedir_win32)/smartctl-nc.exe \
  628:         $(exedir_win32)/smartd.exe \
  629:         $(exedir_win32)/runcmda.exe \
  630:         $(exedir_win32)/runcmdu.exe
  631: 
  632: if OS_WIN32_WINDMC
  633: EXEFILES_WIN32 += \
  634:         $(exedir_win32)/syslogevt.exe
  635: endif
  636: 
  637: if ENABLE_DRIVEDB
  638: if OS_WIN32_NSIS
  639: EXEFILES_WIN32 += \
  640:         $(exedir_win32)/update-smart-drivedb.exe
  641: endif
  642: endif
  643: 
  644: FILES_WIN32 = \
  645:         $(EXEFILES_WIN32) \
  646:         $(docdir_win32)/AUTHORS.txt \
  647:         $(docdir_win32)/CHANGELOG.txt \
  648:         $(docdir_win32)/COPYING.txt \
  649:         $(docdir_win32)/INSTALL.txt \
  650:         $(docdir_win32)/NEWS.txt \
  651:         $(docdir_win32)/README.txt \
  652:         $(docdir_win32)/TODO.txt \
  653:         $(docdir_win32)/WARNINGS.txt \
  654:         $(docdir_win32)/checksums.txt \
  655:         $(docdir_win32)/smartd.conf \
  656:         $(docdir_win32)/smartctl.8.html \
  657:         $(docdir_win32)/smartctl.8.txt \
  658:         $(docdir_win32)/smartd.8.html \
  659:         $(docdir_win32)/smartd.8.txt \
  660:         $(docdir_win32)/smartd.conf.5.html \
  661:         $(docdir_win32)/smartd.conf.5.txt \
  662:         $(exedir_win32)/runcmda.exe.manifest \
  663:         $(exedir_win32)/runcmdu.exe.manifest
  664: 
  665: if ENABLE_DRIVEDB
  666: FILES_WIN32 += \
  667:         $(exedir_win32)/drivedb.h
  668: endif
  669: 
  670: CLEANFILES += \
  671:         $(FILES_WIN32) \
  672:         runcmdu.exe \
  673:         smartctl-nc.exe smartctl-nc.exe.tmp \
  674:         syslogevt.exe syslogevt.h syslogevt.o \
  675:         syslogevt.res.o syslogevt.rc syslogevt_*.bin \
  676:         update-smart-drivedb.exe \
  677:         distdir.mkdir
  678: 
  679: # Textfile converter from package cygutils or tofrodos
  680: # Note: Only use without options to be compatible with both packages
  681: UNIX2DOS = unix2dos
  682: DOS2UNIX = dos2unix
  683: 
  684: # Build Windows distribution
  685: 
  686: dist-win32: $(distzip_win32)
  687: 
  688: install-win32: $(distinst_win32)
  689: 	./$(distinst_win32)
  690: 
  691: installer-win32: $(distinst_win32)
  692: 
  693: distdir-win32: distdir.mkdir $(FILES_WIN32)
  694: 
  695: $(distzip_win32): distdir.mkdir $(FILES_WIN32)
  696: 	@rm -fv $(distzip_win32)
  697: 	cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
  698: 	md5sum $@ > $@.md5
  699: 	sha1sum $@ > $@.sha1
  700: 	sha256sum $@ > $@.sha256
  701: 
  702: if OS_WIN32_NSIS
  703: # Build NSIS installer
  704: # Note: Only option character '-' is also compatible with Linux version of makensis
  705: $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
  706: 	@date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`; \
  707: 	rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`; \
  708: 	verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO); \
  709: 	echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) -DOUTFILE=$@ -DVERSTR='$$verstr' $<"; \
  710: 	'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) -DOUTFILE=$@ -DVERSTR="$$verstr" $<
  711: 	md5sum $@ > $@.md5
  712: 	sha1sum $@ > $@.sha1
  713: 	sha256sum $@ > $@.sha256
  714: 
  715: # Build drivedb.h update tool
  716: update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
  717: 	"$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
  718: 
  719: else
  720: $(distinst_win32):
  721: 	@echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
  722: 	@exit 1
  723: endif
  724: 
  725: cleandist-win32:
  726: 	rm -rf $(distdir_win32) distdir.mkdir
  727: 
  728: distdir.mkdir:
  729: 	@test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
  730: 	@test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
  731: 	touch $@
  732: 
  733: $(exedir_win32)/%.exe: %.exe
  734: 	cp -p $< $@
  735: 	if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
  736: 	touch -r $< $@
  737: 
  738: # strip would break NSIS integrity check
  739: $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
  740: 	cp -p $< $@
  741: 
  742: # runcmd?.exe only differ by .exe.manifest files
  743: $(exedir_win32)/runcmda.exe: $(exedir_win32)/runcmdu.exe
  744: 	cp -p $< $@
  745: 
  746: $(exedir_win32)/%.h: $(srcdir)/%.h
  747: 	$(UNIX2DOS) < $< > $@
  748: 	touch -r $< $@
  749: 
  750: $(exedir_win32)/%.exe.manifest: $(srcdir)/os_win32/%.exe.manifest
  751: 	$(UNIX2DOS) < $< > $@
  752: 	touch -r $< $@
  753: 
  754: $(docdir_win32)/%.html: %.html
  755: 	$(UNIX2DOS) < $< > $@
  756: 	touch -r $< $@
  757: 
  758: $(docdir_win32)/%.txt: %.txt
  759: 	$(UNIX2DOS) < $< > $@
  760: 	touch -r $< $@
  761: 
  762: $(docdir_win32)/%.txt: $(srcdir)/%
  763: 	$(UNIX2DOS) < $< > $@
  764: 	touch -r $< $@
  765: 
  766: $(docdir_win32)/%.conf: $(srcdir)/%.conf
  767: 	$(UNIX2DOS) < $< > $@
  768: 	touch -r $< $@
  769: 
  770: $(docdir_win32)/checksums.txt: $(EXEFILES_WIN32)
  771: 	(cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
  772: 	| $(UNIX2DOS) > $@
  773: 
  774: # Build non-console version of smartctl for GSmartControl.
  775: # The script below changes the word at offset 220 (Subsystem) from 3
  776: # (Console) to 2 (GUI) in a copy of smartctl.exe.
  777: # This will be changed when a tool (like 'editbin') is available in
  778: # the Cygwin distribution
  779: smartctl-nc.exe: smartctl.exe
  780: 	@rm -f $@
  781: 	cp -p smartctl.exe $@.tmp
  782: 	@if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
  783: 	  else echo "invalid EXE header"; exit 1; fi
  784: 	@echo "editbin /subsystem:windows $@.tmp"
  785: 	@echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
  786: 	@if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
  787: 	  else echo "EXE patch failed"; exit 1; fi
  788: 	mv -f $@.tmp $@
  789: 
  790: # Build runcmd?.exe
  791: runcmdu.exe: os_win32/runcmd.c
  792: 	$(CC) -Os -o $@ $<
  793: 
  794: if OS_WIN32_WINDMC
  795: # Build syslogevt.exe event message file tool
  796: 
  797: syslogevt.exe: syslogevt.o syslogevt.res.o
  798: 	$(LINK) $^
  799: 
  800: syslogevt.o: os_win32/syslogevt.c syslogevt.rc
  801: 	$(CC) -c -I. -Os -o $@ $<
  802: 
  803: syslogevt.res.o: syslogevt.rc
  804: 	$(WINDRES) $< $@
  805: 
  806: syslogevt.rc: os_win32/syslogevt.mc
  807: 	$(WINDMC) -b $<
  808: endif
  809: 
  810: # Build {config,svnversion}_vc10.h for MSVC10 from MinGW {config,svnversion}.h
  811: 
  812: config-vc10: $(srcdir)/os_win32/config_vc10.h  $(srcdir)/os_win32/svnversion_vc10.h
  813: 
  814: $(srcdir)/os_win32/config_vc10.h: config.h Makefile
  815: 	sed -e '1i/* config_vc10.h.  Generated from config.h by Makefile.  */' \
  816: 	    -e 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
  817: 	    -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
  818: 
  819: $(srcdir)/os_win32/svnversion_vc10.h: svnversion.h
  820: 	cp $< $@
  821: 
  822: endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>