Annotation of embedaddon/smartmontools/Makefile.am, revision 1.1.1.3
1.1 misho 1: ## Process this file with automake to produce Makefile.in
2: #
1.1.1.3 ! misho 3: # $Id: Makefile.am 3759 2013-01-26 21:11:02Z chrfranke $
1.1 misho 4: #
5:
6: @SET_MAKE@
7:
1.1.1.3 ! misho 8: ACLOCAL_AMFLAGS = -I m4
1.1.1.2 misho 9:
1.1 misho 10: # Make sure .cpp takes precedence to avoid compiling old .c file
11: SUFFIXES = .cpp .c .s .o
12:
13: # BUILD_INFO can be provided by package maintainers (see INSTALL file)
14: BUILD_INFO= "(local build)"
15:
16: AM_CPPFLAGS = -DBUILD_INFO='$(BUILD_INFO)' -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"'
17: if ENABLE_DRIVEDB
18: AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"'
19: endif
20: if ENABLE_SAVESTATES
21: AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"'
22: endif
23: if ENABLE_ATTRIBUTELOG
24: AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
25: endif
26:
27: if OS_WIN32_MINGW
28: AM_CPPFLAGS += -I$(srcdir)/os_win32
29: endif
30: if NEED_GETOPT_LONG
31: AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
32: endif
33: if NEED_REGEX
34: AM_CPPFLAGS += -I$(srcdir)/regex
35: endif
36:
1.1.1.3 ! misho 37: sbin_PROGRAMS = \
! 38: smartctl \
! 39: smartd
1.1 misho 40:
41: if ENABLE_DRIVEDB
42: if OS_WIN32_MINGW
43: else
44: sbin_SCRIPTS = update-smart-drivedb
45: endif
46: endif
47:
48:
1.1.1.3 ! misho 49: smartctl_SOURCES = \
! 50: smartctl.cpp \
! 51: smartctl.h \
! 52: atacmdnames.cpp \
! 53: atacmdnames.h \
! 54: atacmds.cpp \
! 55: atacmds.h \
! 56: ataidentify.cpp \
! 57: ataidentify.h \
! 58: ataprint.cpp \
! 59: ataprint.h \
! 60: dev_ata_cmd_set.cpp \
! 61: dev_ata_cmd_set.h \
! 62: dev_interface.cpp \
! 63: dev_interface.h \
! 64: dev_tunnelled.h \
! 65: drivedb.h \
! 66: int64.h \
! 67: knowndrives.cpp \
! 68: knowndrives.h \
! 69: scsicmds.cpp \
! 70: scsicmds.h \
! 71: scsiata.cpp \
! 72: scsiprint.cpp \
! 73: scsiprint.h \
! 74: utility.cpp \
! 75: utility.h
! 76:
! 77: smartctl_LDADD = @os_deps@ @os_libs@
! 78: smartctl_DEPENDENCIES = @os_deps@
! 79:
! 80: EXTRA_smartctl_SOURCES = \
! 81: os_darwin.cpp \
! 82: os_darwin.h \
! 83: os_linux.cpp \
! 84: os_linux.h \
! 85: os_freebsd.cpp \
! 86: os_freebsd.h \
! 87: os_netbsd.cpp \
! 88: os_netbsd.h \
! 89: os_openbsd.cpp \
! 90: os_openbsd.h \
! 91: os_qnxnto.cpp \
! 92: os_qnxnto.h \
! 93: os_solaris.cpp \
! 94: os_solaris.h \
! 95: os_solaris_ata.s \
! 96: os_win32.cpp \
! 97: os_generic.cpp \
! 98: os_generic.h \
! 99: cciss.cpp \
! 100: cciss.h \
! 101: cissio_freebsd.h \
! 102: dev_areca.cpp \
! 103: dev_areca.h \
! 104: dev_legacy.cpp \
! 105: megaraid.h
! 106:
! 107: if OS_WIN32_MINGW
! 108:
! 109: smartctl_LDADD += smartctl_res.o
! 110: smartctl_DEPENDENCIES += smartctl_res.o
! 111:
! 112: endif
! 113:
! 114:
! 115: smartd_SOURCES = \
! 116: smartd.cpp \
! 117: atacmdnames.cpp \
! 118: atacmdnames.h \
! 119: atacmds.cpp \
! 120: atacmds.h \
! 121: dev_ata_cmd_set.cpp \
! 122: dev_ata_cmd_set.h \
! 123: dev_interface.cpp \
! 124: dev_interface.h \
! 125: dev_tunnelled.h \
! 126: drivedb.h \
! 127: int64.h \
! 128: knowndrives.cpp \
! 129: knowndrives.h \
! 130: scsicmds.cpp \
! 131: scsicmds.h \
! 132: scsiata.cpp \
! 133: utility.cpp \
! 134: utility.h
1.1 misho 135:
136: smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@
137: smartd_DEPENDENCIES = @os_deps@
138:
1.1.1.3 ! misho 139: EXTRA_smartd_SOURCES = \
! 140: os_darwin.cpp \
! 141: os_darwin.h \
! 142: os_linux.cpp \
! 143: os_linux.h \
! 144: os_freebsd.cpp \
! 145: os_freebsd.h \
! 146: os_netbsd.cpp \
! 147: os_netbsd.h \
! 148: os_openbsd.cpp \
! 149: os_openbsd.h \
! 150: os_qnxnto.cpp \
! 151: os_qnxnto.h \
! 152: os_solaris.cpp \
! 153: os_solaris.h \
! 154: os_solaris_ata.s \
! 155: os_win32.cpp \
! 156: os_generic.cpp \
! 157: os_generic.h \
! 158: cciss.cpp \
! 159: cciss.h \
! 160: cissio_freebsd.h \
! 161: dev_areca.cpp \
! 162: dev_areca.h \
! 163: dev_legacy.cpp \
! 164: megaraid.h
1.1 misho 165:
166: if OS_WIN32_MINGW
167:
168: smartd_SOURCES += \
169: os_win32/daemon_win32.cpp \
170: os_win32/daemon_win32.h \
171: os_win32/syslog_win32.cpp \
172: os_win32/syslog.h
173:
1.1.1.3 ! misho 174: smartd_LDADD += smartd_res.o
! 175: smartd_DEPENDENCIES += smartd_res.o
1.1 misho 176:
1.1.1.3 ! misho 177: endif
1.1 misho 178:
179:
180: if NEED_GETOPT_LONG
181:
182: smartctl_SOURCES += \
183: getopt/getopt.c \
184: getopt/getopt.h \
185: getopt/getopt1.c
186:
187: smartd_SOURCES += \
188: getopt/getopt.c \
189: getopt/getopt.h \
190: getopt/getopt1.c
191:
192: endif
193:
194: if NEED_REGEX
195:
196: smartctl_SOURCES += \
197: regex/regex.c \
198: regex/regex.h \
199: regex/regex_internal.h
200:
201: smartd_SOURCES += \
202: regex/regex.c \
203: regex/regex.h \
204: regex/regex_internal.h
205:
206: # Included by regex.c:
207: EXTRA_smartctl_SOURCES += \
208: regex/regcomp.c \
209: regex/regexec.c \
210: regex/regex_internal.c
211:
212: EXTRA_smartd_SOURCES += \
213: regex/regcomp.c \
214: regex/regexec.c \
215: regex/regex_internal.c
216:
217: endif
218:
219: if OS_WIN32
220:
221: smartctl_SOURCES += \
222: csmisas.h \
223: os_win32/wmiquery.cpp \
224: os_win32/wmiquery.h
225:
226: smartd_SOURCES += \
227: csmisas.h \
228: os_win32/wmiquery.cpp \
229: os_win32/wmiquery.h
230:
231: smartctl_LDADD += -lole32 -loleaut32
232: smartd_LDADD += -lole32 -loleaut32
233:
234: endif
235:
236: if OS_SOLARIS
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 \
243: smartctl.1m \
244: smartd.1m
245: install-man: $(extra_MANS)
246: @$(NORMAL_INSTALL)
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; \
251: else file=$$i; fi; \
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; \
258: done
259: uninstall-man:
260: @$(NORMAL_UNINSTALL)
261: for i in $(extra_MANS); do \
262: if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
263: else file=$$i; fi; \
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; \
270: done
271: %.1m: %.8
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' > $@
279: %.4: %.5
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' > $@
287: else
288: # For systems that adopts traditional manner
289: man_MANS = smartd.conf.5 \
290: smartctl.8 \
291: smartd.8
292: endif
293:
294: docsdir=$(docdir)
1.1.1.3 ! misho 295: docs_DATA = \
! 296: AUTHORS \
! 297: ChangeLog \
! 298: ChangeLog-5.0-6.0 \
! 299: COPYING \
! 300: INSTALL \
! 301: NEWS \
! 302: README \
! 303: TODO \
! 304: WARNINGS \
! 305: smartd.conf
1.1 misho 306:
307: examplesdir=$(exampledir)
308: examples_DATA = \
309: examplescripts/README
310: examples_SCRIPTS = \
311: examplescripts/Example1 \
312: examplescripts/Example2 \
313: examplescripts/Example3 \
314: examplescripts/Example4
315:
316: sysconf_DATA = smartd.conf
317:
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 "************************************************************"; \
329: f="$$f".sample; \
330: fi; \
331: fi; \
332: echo " $(INSTALL_DATA) $$s $$f"; \
333: $(INSTALL_DATA) "$$s" "$$f"
334:
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 "************************************************************"; \
343: f="$$f".sample; \
344: fi; \
345: echo " rm -f $$f"; \
346: rm -f "$$f"
347:
1.1.1.3 ! misho 348: # automake does not allow 'sysconf_SCRIPTS'
! 349: sysscriptdir = $(sysconfdir)
! 350: sysscript_SCRIPTS = smartd_warning.sh
! 351:
1.1 misho 352: EXTRA_DIST = \
353: autogen.sh \
354: smartd.initd.in \
355: smartd.freebsd.initd.in \
356: smartd.8.in \
357: smartctl.8.in \
358: smartd.conf.5.in \
359: smartd.conf \
360: smartd.service.in \
1.1.1.3 ! misho 361: smartd_warning.sh.in \
1.1 misho 362: update-smart-drivedb.in \
1.1.1.2 misho 363: m4/pkg.m4 \
1.1 misho 364: os_darwin/SMART.in \
365: os_darwin/StartupParameters.plist \
366: os_darwin/English_Localizable.strings \
367: os_win32/installer.nsi \
368: os_win32/runcmd.c \
369: os_win32/runcmda.exe.manifest \
370: os_win32/runcmdu.exe.manifest \
1.1.1.3 ! misho 371: os_win32/smartctl_res.rc.in \
! 372: os_win32/smartd_res.rc.in \
! 373: os_win32/smartd_warning.cmd \
1.1 misho 374: os_win32/syslogevt.mc \
375: os_win32/update-smart-drivedb.nsi \
376: os_win32/wbemcli_small.h \
1.1.1.3 ! misho 377: os_win32/wtssendmsg.c \
1.1 misho 378: $(docs_DATA) \
379: $(examples_DATA) \
380: $(examples_SCRIPTS)
381:
382: CLEANFILES = \
383: smartd.conf.5 \
384: smartd.conf.4 \
385: smartd.8 \
386: smartd.1m \
387: smartd.8.html \
388: smartd.8.txt \
389: smartctl.8 \
390: smartctl.1m \
391: smartctl.8.html \
392: smartctl.8.txt \
393: smartd.conf.5.html \
394: smartd.conf.5.txt \
395: smartd.initd \
396: smartd.freebsd.initd \
397: smartd.service \
1.1.1.3 ! misho 398: smartd_warning.sh \
1.1 misho 399: svnversion.h \
400: update-smart-drivedb \
401: SMART
402:
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 \
412: $(srcdir)/depcomp \
413: $(srcdir)/install-sh \
414: $(srcdir)/missing \
1.1.1.2 misho 415: $(srcdir)/mkinstalldirs \
416: $(srcdir)/m4/pkg.m4
1.1 misho 417:
418: utility.o: svnversion.h
419:
420: if IS_SVN_BUILD
421: # Get version info from SVN
1.1.1.3 ! misho 422: svnversion.h: ChangeLog Makefile $(svn_deps)
1.1 misho 423: echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
424: (cd $(srcdir) \
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_,' >> $@
429: else
430:
431: # SVN not available, guess version info from Id strings
1.1.1.3 ! misho 432: svnversion.h: ChangeLog Makefile
1.1 misho 433: echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
1.1.1.3 ! misho 434: (cd $(srcdir) && cat ChangeLog Makefile.am configure.ac smart*.in *.cpp *.h *.s) \
1.1 misho 435: | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
436: | sort -n -r \
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_,' >> $@
439: endif
440:
441:
442: if ENABLE_DRIVEDB
443: drivedb_DATA = drivedb.h
444: endif
445:
446: if ENABLE_SAVESTATES
447: # Create $(savestatesdir) only
448: savestates_DATA =
449: endif
450:
451: if ENABLE_ATTRIBUTELOG
452: # Create $(attributelogdir) only
453: attributelog_DATA =
454: endif
455:
456: update-smart-drivedb: update-smart-drivedb.in config.status
457: $(SHELL) ./config.status --file=$@
458: chmod +x $@
459:
1.1.1.3 ! misho 460: smartd_warning.sh: smartd_warning.sh.in config.status
! 461: $(SHELL) ./config.status --file=$@
! 462: chmod +x $@
1.1 misho 463:
464: if INSTALL_INITSCRIPT
465: if OS_DARWIN
466: initd_DATA = SMART \
467: os_darwin/StartupParameters.plist \
468: os_darwin/English_Localizable.strings
469:
470: initd_install_name = SMART
471:
472: initd_DATA_install = install-initdDATA-darwin
473: initd_DATA_uninstall = uninstall-initdDATA-darwin
474:
475: SMART : os_darwin/SMART.in
476: sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
477:
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 ; \
490: done
491:
492: uninstall-initdDATA-darwin:
493: rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
494:
495: else
496:
497: initd_DATA = @initdfile@
498:
499: @initdfile@: $(srcdir)/@initdfile@.in Makefile
500: sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/@initdfile@.in > $@
501:
502: initd_install_name = smartd$(smartd_suffix)
503:
504: initd_DATA_install = install-initdDATA-generic
505: initd_DATA_uninstall = uninstall-initdDATA-generic
506:
507: install-initdDATA-generic: $(initd_DATA)
508: $(mkinstalldirs) $(DESTDIR)$(initddir)
509: $(INSTALL_SCRIPT) $(top_builddir)/@initdfile@ $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
510:
511:
512: uninstall-initdDATA-generic:
513: rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
514: endif
515: else
516:
517: initd_DATA_install = install-initdDATA-null
518: initd_DATA_uninstall = uninstall-initdDATA-null
519:
520: install-initdDATA-null:
521: uninstall-initdDATA-null:
522: endif
523:
524: install-initdDATA : $(initd_DATA_install)
525:
526: uninstall-initdDATA: $(initd_DATA_uninstall)
527:
528: if INSTALL_SYSTEMDUNIT
529: systemdsystemunit_DATA = smartd.service
530: endif
531:
532: smartd.service: smartd.service.in Makefile
1.1.1.3 ! misho 533: sed -e 's|/usr/local/sbin/smartd|$(sbindir)/smartd|g' \
! 534: -e 's|/usr/local/etc/sysconfig/smartmontools|$(sysconfdir)/sysconfig/smartmontools|g' \
1.1 misho 535: $(srcdir)/smartd.service.in > $@
536:
537: if ENABLE_CAPABILITIES
538: MAN_CAPABILITIES = cat
539: else
540: MAN_CAPABILITIES = sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,'
541: endif
542:
543: if ENABLE_DRIVEDB
544: MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
545: else
546: MAN_DRIVEDB = sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,'
547: endif
548:
549: if ENABLE_SAVESTATES
550: MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
551: else
552: MAN_SAVESTATES = sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,'
553: endif
554:
555: if ENABLE_ATTRIBUTELOG
556: MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
557: else
558: MAN_ATTRIBUTELOG = sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,'
559: endif
560:
561: MAN_FILTER = \
1.1.1.3 ! misho 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' | \
1.1 misho 574: $(MAN_ATTRIBUTELOG) | \
575: $(MAN_CAPABILITIES) | \
576: $(MAN_DRIVEDB) | \
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,^,!!,' \
1.1.1.2 misho 584: -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \
585: -e 's,^!!!*,,' ; \
1.1 misho 586: else \
587: cat; \
588: fi
589:
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) > $@
593:
594: smartd.8: smartd.8.in Makefile svnversion.h
595: cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@
596:
597: smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
598: cat $(srcdir)/smartd.conf.5.in | $(MAN_FILTER) > $@
599:
600: # Commands to convert man pages into .html and .txt
601: # TODO: configure
602: MAN2HTML = man2html
603: #MAN2HTML = groff -man -Thtml
604: MAN2TXT = groff -man -Tascii -P'-bcou'
605:
606: # Remove HTTP header and fix links in man2html output
1.1.1.2 misho 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'
1.1 misho 612:
613: # Convert man pages into .html and .txt
614:
615: htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
616:
617: txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
618:
619: if OS_WIN32_MINGW
620:
621: %.5.html: %.5
622: $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
623:
624: %.8.html: %.8
625: $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
626: else
627:
628: %.5.html: %.5
629: $(MAN2HTML) $< | $(FIXHTML) > $@
630:
631: %.8.html: %.8
632: $(MAN2HTML) $< | $(FIXHTML) > $@
633: endif
634:
635: %.5.txt: %.5
636: $(MAN2TXT) $< > $@
637:
638: %.8.txt: %.8
639: $(MAN2TXT) $< > $@
640:
641:
642: # Check drive database syntax
643: check:
644: @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
645: echo "$(srcdir)/drivedb.h: OK"; \
646: else \
647: echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
648: fi
649:
650:
651: if OS_WIN32_MINGW
1.1.1.3 ! misho 652: # Windows resources
! 653:
! 654: smartctl_res.o: smartctl_res.rc
! 655: $(WINDRES) $< $@
! 656:
! 657: smartd_res.o: smartd_res.rc syslogevt.rc
! 658: $(WINDRES) -I. $< $@
! 659:
! 660: # Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754
! 661: WIN_RC_FILTER = \
! 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"; )
! 666:
! 667: smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
! 668: cat $< | $(WIN_RC_FILTER) > $@
! 669:
! 670: smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
! 671: cat $< | $(WIN_RC_FILTER) > $@
! 672:
! 673: syslogevt.rc: os_win32/syslogevt.mc
! 674: $(WINDMC) -b $<
! 675:
1.1 misho 676: # Definitions for Windows distribution
677:
678: if OS_WIN64
679: win_bits = 64
680: else
681: win_bits = 32
682: endif
683:
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
687:
688: exedir_win32 = $(distdir_win32)/bin
689: docdir_win32 = $(distdir_win32)/doc
690:
691: EXEFILES_WIN32 = \
692: $(exedir_win32)/smartctl.exe \
693: $(exedir_win32)/smartctl-nc.exe \
694: $(exedir_win32)/smartd.exe \
1.1.1.3 ! misho 695: $(exedir_win32)/smartd_warning.cmd \
1.1 misho 696: $(exedir_win32)/runcmda.exe \
1.1.1.3 ! misho 697: $(exedir_win32)/runcmdu.exe \
! 698: $(exedir_win32)/wtssendmsg.exe
1.1 misho 699:
700: if ENABLE_DRIVEDB
701: if OS_WIN32_NSIS
702: EXEFILES_WIN32 += \
703: $(exedir_win32)/update-smart-drivedb.exe
704: endif
705: endif
706:
707: FILES_WIN32 = \
708: $(EXEFILES_WIN32) \
709: $(docdir_win32)/AUTHORS.txt \
1.1.1.3 ! misho 710: $(docdir_win32)/ChangeLog.txt \
! 711: $(docdir_win32)/ChangeLog-5.0-6.0.txt \
1.1 misho 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 \
1.1.1.2 misho 718: $(docdir_win32)/checksums$(win_bits).txt \
1.1 misho 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
728:
729: if ENABLE_DRIVEDB
730: FILES_WIN32 += \
731: $(exedir_win32)/drivedb.h
732: endif
733:
734: CLEANFILES += \
735: $(FILES_WIN32) \
736: runcmdu.exe \
737: smartctl-nc.exe smartctl-nc.exe.tmp \
1.1.1.3 ! misho 738: smartctl_res.rc smartctl_res.o \
! 739: smartd_res.rc smartd_res.o \
! 740: syslogevt.h syslogevt.o \
! 741: syslogevt.rc syslogevt_*.bin \
! 742: wtssendmsg.exe \
1.1 misho 743: update-smart-drivedb.exe \
744: distdir.mkdir
745:
746: # Textfile converter from package cygutils or tofrodos
747: # Note: Only use without options to be compatible with both packages
748: UNIX2DOS = unix2dos
749: DOS2UNIX = dos2unix
750:
751: # Build Windows distribution
752:
753: dist-win32: $(distzip_win32)
754:
755: install-win32: $(distinst_win32)
756: ./$(distinst_win32)
757:
758: installer-win32: $(distinst_win32)
759:
760: distdir-win32: distdir.mkdir $(FILES_WIN32)
761:
762: $(distzip_win32): distdir.mkdir $(FILES_WIN32)
763: @rm -fv $(distzip_win32)
764: cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
765: md5sum $@ > $@.md5
766: sha1sum $@ > $@.sha1
767: sha256sum $@ > $@.sha256
768:
769: if OS_WIN32_NSIS
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)
1.1.1.2 misho 773: test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
1.1 misho 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); \
1.1.1.2 misho 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" $<
1.1 misho 780: md5sum $@ > $@.md5
781: sha1sum $@ > $@.sha1
782: sha256sum $@ > $@.sha256
783:
784: # Build drivedb.h update tool
785: update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
786: "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
787:
788: else
789: $(distinst_win32):
790: @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
791: @exit 1
792: endif
793:
794: cleandist-win32:
795: rm -rf $(distdir_win32) distdir.mkdir
796:
797: distdir.mkdir:
798: @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
799: @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
800: touch $@
801:
802: $(exedir_win32)/%.exe: %.exe
803: cp -p $< $@
804: if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
805: touch -r $< $@
806:
807: # strip would break NSIS integrity check
808: $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe
809: cp -p $< $@
810:
811: # runcmd?.exe only differ by .exe.manifest files
812: $(exedir_win32)/runcmda.exe: $(exedir_win32)/runcmdu.exe
813: cp -p $< $@
814:
815: $(exedir_win32)/%.h: $(srcdir)/%.h
816: $(UNIX2DOS) < $< > $@
817: touch -r $< $@
818:
819: $(exedir_win32)/%.exe.manifest: $(srcdir)/os_win32/%.exe.manifest
820: $(UNIX2DOS) < $< > $@
821: touch -r $< $@
822:
1.1.1.3 ! misho 823: $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
! 824: $(UNIX2DOS) < $< > $@
! 825: touch -r $< $@
! 826:
1.1 misho 827: $(docdir_win32)/%.html: %.html
828: $(UNIX2DOS) < $< > $@
829: touch -r $< $@
830:
831: $(docdir_win32)/%.txt: %.txt
832: $(UNIX2DOS) < $< > $@
833: touch -r $< $@
834:
835: $(docdir_win32)/%.txt: $(srcdir)/%
836: $(UNIX2DOS) < $< > $@
837: touch -r $< $@
838:
839: $(docdir_win32)/%.conf: $(srcdir)/%.conf
840: $(UNIX2DOS) < $< > $@
841: touch -r $< $@
842:
1.1.1.2 misho 843: $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
1.1 misho 844: (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
845: | $(UNIX2DOS) > $@
846:
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
853: @rm -f $@
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
861: mv -f $@.tmp $@
862:
1.1.1.3 ! misho 863: # Build runcmd?.exe and wtssendmsg.exe
1.1 misho 864: runcmdu.exe: os_win32/runcmd.c
865: $(CC) -Os -o $@ $<
866:
1.1.1.3 ! misho 867: wtssendmsg.exe: os_win32/wtssendmsg.c
! 868: $(CC) -Os -o $@ $< -lwtsapi32
1.1 misho 869:
1.1.1.3 ! misho 870: # Build os_win32/vc10/{config.h,smart*.rc,svnversion.h} for MSVC10 from MinGW files
1.1 misho 871:
1.1.1.3 ! misho 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
1.1 misho 876:
1.1.1.3 ! misho 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. */' \
1.1.1.2 misho 879: -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
1.1 misho 880: -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
881:
1.1.1.3 ! misho 882: $(srcdir)/os_win32/vc10/svnversion.h: svnversion.h
! 883: cp $< $@
! 884:
! 885: $(srcdir)/os_win32/vc10/smartctl_res.rc: smartctl_res.rc
! 886: cp $< $@
! 887:
! 888: $(srcdir)/os_win32/vc10/smartd_res.rc: smartd_res.rc
1.1 misho 889: cp $< $@
890:
891: endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>