1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am,v 1.81 2007/04/01 16:49:44 shattered Exp $
8 # Make sure .cpp takes precedence to avoid compiling old .c file
9 SUFFIXES = .cpp .c .s .o
12 AM_CPPFLAGS = -DSMARTMONTOOLS_SYSCONFDIR=\"$(sysconfdir)\"
14 sbin_PROGRAMS = smartd \
17 smartd_SOURCES = smartd.cpp \
38 smartd_LDADD = @os_deps@ @os_libs@
39 smartd_DEPENDENCIES = @os_deps@
41 EXTRA_smartd_SOURCES = os_darwin.cpp \
66 os_win32/daemon_win32.h \
67 os_win32/daemon_win32.cpp \
68 os_win32/hostname_win32.h \
69 os_win32/hostname_win32.cpp \
71 os_win32/syslog_win32.cpp
73 # Included by regex.c:
74 EXTRA_smartd_SOURCES += \
77 posix/regex_internal.c \
78 posix/regex_internal.h
82 smartctl_SOURCES= smartctl.cpp \
103 smartctl_LDADD = @os_deps@ @os_libs@
104 smartctl_DEPENDENCIES = @os_deps@
106 EXTRA_smartctl_SOURCES = os_linux.cpp \
124 smartctl_SOURCES += \
129 # Included by regex.c:
130 EXTRA_smartctl_SOURCES += \
133 posix/regex_internal.c \
134 posix/regex_internal.h
139 # This block is required because Solaris uses manual page section 1m
140 # for administrative command (linux/freebsd use section 8) and Solaris
141 # uses manual page section 4 for file formats (linux/freebsd use
142 # section 5). Automake can deal cleanly with man page sections 1-8
143 # and n, but NOT with sections of the form 1m.
144 extra_MANS = smartd.conf.4 \
147 install-man: $(extra_MANS)
149 $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
150 $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
151 for i in $(extra_MANS); do \
152 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
154 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
155 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
156 inst=`echo $$inst | sed -e 's/^.*\///'`; \
157 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
158 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
159 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
163 for i in $(extra_MANS); do \
164 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
166 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
167 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
168 inst=`echo $$inst | sed -e 's/^.*\///'`; \
169 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
170 echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
171 rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
174 awk '/^.TH/ {$$3="1m"} {print}' < $< | \
175 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
176 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
177 -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
178 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
179 -e 's|/var/log/messages|/var/adm/messages|g' \
180 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
182 awk '/^.TH/ {$$3="4"} {print}' < $< | \
183 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
184 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
185 -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
186 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
187 -e 's|/var/log/messages|/var/adm/messages|g' \
188 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
190 # For systems that adopts traditional manner
191 man_MANS = smartd.conf.5 \
197 docs_DATA = AUTHORS \
207 sysconf_DATA = smartd.conf$(smartd_suffix)
210 smartd.conf$(smartd_suffix): smartd.conf
211 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
214 EXTRA_DIST = smartmontools.spec \
222 os_darwin/StartupParameters.plist \
223 os_darwin/English_Localizable.strings \
224 os_win32/installer.nsi \
227 CLEANFILES = smartd.conf.5 \
243 CLEANFILES += smartd.conf$(smartd_suffix)
247 smartd.conf.5.in: smartd.8.in
248 sed '1,/STARTINCLUDE/ D;/ENDINCLUDE/,$$D' < $(srcdir)/smartd.8.in > $(top_builddir)/tmp.directives
249 sed '/STARTINCLUDE/,$$D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.head
250 sed '1,/ENDINCLUDE/D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.tail
251 cat $(top_builddir)/tmp.head > $(srcdir)/smartd.conf.5.in
252 echo '.\" STARTINCLUDE' >> $(srcdir)/smartd.conf.5.in
253 cat $(top_builddir)/tmp.directives >> $(srcdir)/smartd.conf.5.in
254 echo '.\" ENDINCLUDE' >> $(srcdir)/smartd.conf.5.in
255 cat $(top_builddir)/tmp.tail >> $(srcdir)/smartd.conf.5.in
256 rm -f $(top_builddir)/tmp.head $(top_builddir)/tmp.tail $(top_builddir)/tmp.directives
260 os_darwin/StartupParameters.plist \
261 os_darwin/English_Localizable.strings
263 initd_install_name = SMART
265 initd_DATA_install = install-initdDATA-darwin
267 SMART : os_darwin/SMART.in
268 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
270 install-initdDATA-darwin: $(initd_DATA)
271 $(mkinstalldirs) $(DESTDIR)$(initddir)
272 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
273 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
274 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
275 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
276 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
277 for i in English ; do \
278 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
279 $(mkinstalldirs) $$RDIR ;\
280 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
281 $$RDIR/Localizable.strings ; \
283 @echo -e "\n\n####################################################################\n#"
284 @echo -e "# PLEASE READ THIS BOX!\n#"
285 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/SMART/SMART start\n#"
286 @echo -e "# To automatically start smartd on bootup, add the line:\n# SMARTd=-YES-\n# to /etc/hostconfig\n#"
287 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
288 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
289 @echo -e "####################################################################\n\n"
293 initd_DATA = smartd.initd
295 smartd.initd: $(srcdir)/smartd.initd.in Makefile
296 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
298 initd_install_name = smartd$(smartd_suffix)
300 initd_DATA_install = install-initdDATA-generic
302 install-initdDATA-generic: $(initd_DATA)
303 $(mkinstalldirs) $(DESTDIR)$(initddir)
304 $(INSTALL_SCRIPT) $(top_builddir)/smartd.initd $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
305 @echo -e "\n\n####################################################################\n#"
306 @echo -e "# PLEASE READ THIS BOX!\n#"
307 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/smartd start\n#"
308 @echo -e "# To automatically start smartd on bootup, run:\n# /sbin/chkconfig --add smartd\n#"
309 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
310 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
311 @echo -e "####################################################################\n\n"
315 install-initdDATA : $(initd_DATA_install)
318 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
321 rm -rf $(DESTDIR)$(docsdir)
323 smart%: $(srcdir)/smart%.in Makefile
324 sed "s|CURRENT_CVS_VERSION|$(releaseversion)|g" $< | \
325 sed "s|CURRENT_CVS_DATE|$(smartmontools_release_date)|g" | \
326 sed "s|CURRENT_CVS_TIME|$(smartmontools_release_time)|g" | \
327 sed "s|/usr/local/share/man/|$(mandir)/|g" | \
328 sed "s|/usr/local/sbin/|$(sbindir)/|g" | \
329 sed "s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g" | \
330 sed "s|/usr/local/share/doc/smartmontools-5.1/|$(docsdir)/|g" | \
331 sed "s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g" > $@
334 # Commands to convert man pages into .html and .txt
337 #MAN2HTML = groff -man -Thtml
338 MAN2TXT = groff -man -Tascii -P'-bcou'
340 # Remove HTTP header and fix links in man2html output
341 FIXHTML = sed '1s,^Content-type.*,,' \
342 | sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
343 | sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
344 | sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
345 | sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
347 # Convert man pages into .html and .txt
349 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
351 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
356 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
359 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
363 $(MAN2HTML) $< | $(FIXHTML) > $@
366 $(MAN2HTML) $< | $(FIXHTML) > $@
378 # Definitions for Windows distribution
380 distdir_win32 = $(PACKAGE)-$(VERSION).win32
381 distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
382 distinst_win32= $(PACKAGE)-$(VERSION).win32-setup.exe
384 exedir_win32 = $(distdir_win32)/bin
385 docdir_win32 = $(distdir_win32)/doc
387 FILES_WIN32 = $(exedir_win32)/smartctl.exe \
388 $(exedir_win32)/smartd.exe \
389 $(docdir_win32)/AUTHORS.txt \
390 $(docdir_win32)/CHANGELOG.txt \
391 $(docdir_win32)/COPYING.txt \
392 $(docdir_win32)/INSTALL.txt \
393 $(docdir_win32)/NEWS.txt \
394 $(docdir_win32)/README.txt \
395 $(docdir_win32)/TODO.txt \
396 $(docdir_win32)/WARNINGS.txt \
397 $(docdir_win32)/smartd.conf \
398 $(docdir_win32)/smartctl.8.html \
399 $(docdir_win32)/smartctl.8.txt \
400 $(docdir_win32)/smartd.8.html \
401 $(docdir_win32)/smartd.8.txt \
402 $(docdir_win32)/smartd.conf.5.html \
403 $(docdir_win32)/smartd.conf.5.txt
405 CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe distdir.mkdir syslogevt.check
407 # Textfile converter from cygutils
408 UNIX2DOS = unix2dos -D
409 DOS2UNIX = dos2unix -U
411 # Build Windows distribution
413 dist-win32: $(distzip_win32)
415 install-win32: $(distinst_win32)
418 installer-win32: $(distinst_win32)
420 distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
422 $(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
423 @rm -fv $(distzip_win32)
424 cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
426 # Build NSIS installer, try to locate makensis in default location first
427 $(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) syslogevt.check
428 @makensis="$(MAKENSIS)"; if [ -z "$$makensis" ]; then \
429 if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" /VERSION >/dev/null 2>&1; then \
430 makensis="$$PROGRAMFILES/NSIS/makensis"; \
431 elif makensis /VERSION >/dev/null 2>&1; then \
434 echo 'makensis: command not found. Please download and install NSIS' 1>&2; \
435 echo 'from http://nsis.sourceforge.net/Download' 1>&2; exit 1; \
438 echo "$$makensis /V2 /NOCD /DINPDIR=$(distdir_win32) /DOUTFILE=$(distinst_win32) $(srcdir)/os_win32/installer.nsi"; \
439 "$$makensis" /V2 /NOCD /DINPDIR="$(distdir_win32)" /DOUTFILE="$(distinst_win32)" "$(srcdir)/os_win32/installer.nsi"
442 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
445 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
446 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
450 @if [ -f $(srcdir)/os_win32/syslogevt.exe ]; then \
451 cp -pv $(srcdir)/os_win32/syslogevt.exe $(exedir_win32)/syslogevt.exe; \
452 else echo "Warning: $(srcdir)/os_win32/syslogevt.exe missing."; fi
455 $(exedir_win32)/%.exe: %.exe
460 $(docdir_win32)/%.html: %.html
461 $(UNIX2DOS) < $< > $@
464 $(docdir_win32)/%.txt: %.txt
465 $(UNIX2DOS) < $< > $@
468 $(docdir_win32)/%.txt: $(srcdir)/%
469 $(UNIX2DOS) < $< > $@
472 $(docdir_win32)/%.conf: $(srcdir)/%.conf
473 $(UNIX2DOS) < $< > $@
477 # Build config_vc6.h for MSVC 6 from MinGW config.h
479 config-vc6: $(srcdir)/os_win32/config_vc6.h
481 $(srcdir)/os_win32/config_vc6.h: config.h
482 sed '1i/* config_vc6.h. Generated by Makefile. */' $< | \
483 sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */,' | \
484 sed 's,i.86-pc-mingw32,i686-pc-win32vc6,' > $@
488 SUBDIRS= . examplescripts