1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am,v 1.80 2006/10/21 18:34:31 chrfranke 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 \
64 os_win32/daemon_win32.h \
65 os_win32/daemon_win32.cpp \
66 os_win32/hostname_win32.h \
67 os_win32/hostname_win32.cpp \
69 os_win32/syslog_win32.cpp
71 # Included by regex.c:
72 EXTRA_smartd_SOURCES += \
75 posix/regex_internal.c \
76 posix/regex_internal.h
80 smartctl_SOURCES= smartctl.cpp \
101 smartctl_LDADD = @os_deps@ @os_libs@
102 smartctl_DEPENDENCIES = @os_deps@
104 EXTRA_smartctl_SOURCES = os_linux.cpp \
120 smartctl_SOURCES += \
125 # Included by regex.c:
126 EXTRA_smartctl_SOURCES += \
129 posix/regex_internal.c \
130 posix/regex_internal.h
135 # This block is required because Solaris uses manual page section 1m
136 # for administrative command (linux/freebsd use section 8) and Solaris
137 # uses manual page section 4 for file formats (linux/freebsd use
138 # section 5). Automake can deal cleanly with man page sections 1-8
139 # and n, but NOT with sections of the form 1m.
140 extra_MANS = smartd.conf.4 \
143 install-man: $(extra_MANS)
145 $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
146 $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
147 for i in $(extra_MANS); do \
148 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
150 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
151 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
152 inst=`echo $$inst | sed -e 's/^.*\///'`; \
153 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
154 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
155 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
159 for i in $(extra_MANS); do \
160 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
162 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
163 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
164 inst=`echo $$inst | sed -e 's/^.*\///'`; \
165 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
166 echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
167 rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
170 awk '/^.TH/ {$$3="1m"} {print}' < $< | \
171 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
172 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
173 -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
174 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
175 -e 's|/var/log/messages|/var/adm/messages|g' \
176 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
178 awk '/^.TH/ {$$3="4"} {print}' < $< | \
179 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
180 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
181 -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
182 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
183 -e 's|/var/log/messages|/var/adm/messages|g' \
184 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
186 # For systems that adopts traditional manner
187 man_MANS = smartd.conf.5 \
193 docs_DATA = AUTHORS \
203 sysconf_DATA = smartd.conf$(smartd_suffix)
206 smartd.conf$(smartd_suffix): smartd.conf
207 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
210 EXTRA_DIST = smartmontools.spec \
218 os_darwin/StartupParameters.plist \
219 os_darwin/English_Localizable.strings \
220 os_win32/installer.nsi \
223 CLEANFILES = smartd.conf.5 \
239 CLEANFILES += smartd.conf$(smartd_suffix)
243 smartd.conf.5.in: smartd.8.in
244 sed '1,/STARTINCLUDE/ D;/ENDINCLUDE/,$$D' < $(srcdir)/smartd.8.in > $(top_builddir)/tmp.directives
245 sed '/STARTINCLUDE/,$$D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.head
246 sed '1,/ENDINCLUDE/D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.tail
247 cat $(top_builddir)/tmp.head > $(srcdir)/smartd.conf.5.in
248 echo '.\" STARTINCLUDE' >> $(srcdir)/smartd.conf.5.in
249 cat $(top_builddir)/tmp.directives >> $(srcdir)/smartd.conf.5.in
250 echo '.\" ENDINCLUDE' >> $(srcdir)/smartd.conf.5.in
251 cat $(top_builddir)/tmp.tail >> $(srcdir)/smartd.conf.5.in
252 rm -f $(top_builddir)/tmp.head $(top_builddir)/tmp.tail $(top_builddir)/tmp.directives
256 os_darwin/StartupParameters.plist \
257 os_darwin/English_Localizable.strings
259 initd_install_name = SMART
261 initd_DATA_install = install-initdDATA-darwin
263 SMART : os_darwin/SMART.in
264 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
266 install-initdDATA-darwin: $(initd_DATA)
267 $(mkinstalldirs) $(DESTDIR)$(initddir)
268 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
269 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
270 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
271 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
272 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
273 for i in English ; do \
274 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
275 $(mkinstalldirs) $$RDIR ;\
276 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
277 $$RDIR/Localizable.strings ; \
279 @echo -e "\n\n####################################################################\n#"
280 @echo -e "# PLEASE READ THIS BOX!\n#"
281 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/SMART/SMART start\n#"
282 @echo -e "# To automatically start smartd on bootup, add the line:\n# SMARTd=-YES-\n# to /etc/hostconfig\n#"
283 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
284 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
285 @echo -e "####################################################################\n\n"
289 initd_DATA = smartd.initd
291 smartd.initd: $(srcdir)/smartd.initd.in Makefile
292 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
294 initd_install_name = smartd$(smartd_suffix)
296 initd_DATA_install = install-initdDATA-generic
298 install-initdDATA-generic: $(initd_DATA)
299 $(mkinstalldirs) $(DESTDIR)$(initddir)
300 $(INSTALL_SCRIPT) $(top_builddir)/smartd.initd $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
301 @echo -e "\n\n####################################################################\n#"
302 @echo -e "# PLEASE READ THIS BOX!\n#"
303 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/smartd start\n#"
304 @echo -e "# To automatically start smartd on bootup, run:\n# /sbin/chkconfig --add smartd\n#"
305 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
306 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
307 @echo -e "####################################################################\n\n"
311 install-initdDATA : $(initd_DATA_install)
314 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
317 rm -rf $(DESTDIR)$(docsdir)
319 smart%: $(srcdir)/smart%.in Makefile
320 sed "s|CURRENT_CVS_VERSION|$(releaseversion)|g" $< | \
321 sed "s|CURRENT_CVS_DATE|$(smartmontools_release_date)|g" | \
322 sed "s|CURRENT_CVS_TIME|$(smartmontools_release_time)|g" | \
323 sed "s|/usr/local/share/man/|$(mandir)/|g" | \
324 sed "s|/usr/local/sbin/|$(sbindir)/|g" | \
325 sed "s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g" | \
326 sed "s|/usr/local/share/doc/smartmontools-5.1/|$(docsdir)/|g" | \
327 sed "s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g" > $@
330 # Commands to convert man pages into .html and .txt
333 #MAN2HTML = groff -man -Thtml
334 MAN2TXT = groff -man -Tascii -P'-bcou'
336 # Remove HTTP header and fix links in man2html output
337 FIXHTML = sed '1s,^Content-type.*,,' \
338 | sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
339 | sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
340 | sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
341 | sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
343 # Convert man pages into .html and .txt
345 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
347 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
352 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
355 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
359 $(MAN2HTML) $< | $(FIXHTML) > $@
362 $(MAN2HTML) $< | $(FIXHTML) > $@
374 # Definitions for Windows distribution
376 distdir_win32 = $(PACKAGE)-$(VERSION).win32
377 distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
378 distinst_win32= $(PACKAGE)-$(VERSION).win32-setup.exe
380 exedir_win32 = $(distdir_win32)/bin
381 docdir_win32 = $(distdir_win32)/doc
383 FILES_WIN32 = $(exedir_win32)/smartctl.exe \
384 $(exedir_win32)/smartd.exe \
385 $(docdir_win32)/AUTHORS.txt \
386 $(docdir_win32)/CHANGELOG.txt \
387 $(docdir_win32)/COPYING.txt \
388 $(docdir_win32)/INSTALL.txt \
389 $(docdir_win32)/NEWS.txt \
390 $(docdir_win32)/README.txt \
391 $(docdir_win32)/TODO.txt \
392 $(docdir_win32)/WARNINGS.txt \
393 $(docdir_win32)/smartd.conf \
394 $(docdir_win32)/smartctl.8.html \
395 $(docdir_win32)/smartctl.8.txt \
396 $(docdir_win32)/smartd.8.html \
397 $(docdir_win32)/smartd.8.txt \
398 $(docdir_win32)/smartd.conf.5.html \
399 $(docdir_win32)/smartd.conf.5.txt
401 CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe distdir.mkdir syslogevt.check
403 # Textfile converter from cygutils
404 UNIX2DOS = unix2dos -D
405 DOS2UNIX = dos2unix -U
407 # Build Windows distribution
409 dist-win32: $(distzip_win32)
411 install-win32: $(distinst_win32)
414 installer-win32: $(distinst_win32)
416 distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
418 $(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
419 @rm -fv $(distzip_win32)
420 cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
422 # Build NSIS installer, try to locate makensis in default location first
423 $(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) syslogevt.check
424 @makensis="$(MAKENSIS)"; if [ -z "$$makensis" ]; then \
425 if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" /VERSION >/dev/null 2>&1; then \
426 makensis="$$PROGRAMFILES/NSIS/makensis"; \
427 elif makensis /VERSION >/dev/null 2>&1; then \
430 echo 'makensis: command not found. Please download and install NSIS' 1>&2; \
431 echo 'from http://nsis.sourceforge.net/Download' 1>&2; exit 1; \
434 echo "$$makensis /V2 /NOCD /DINPDIR=$(distdir_win32) /DOUTFILE=$(distinst_win32) $(srcdir)/os_win32/installer.nsi"; \
435 "$$makensis" /V2 /NOCD /DINPDIR="$(distdir_win32)" /DOUTFILE="$(distinst_win32)" "$(srcdir)/os_win32/installer.nsi"
438 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
441 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
442 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
446 @if [ -f $(srcdir)/os_win32/syslogevt.exe ]; then \
447 cp -pv $(srcdir)/os_win32/syslogevt.exe $(exedir_win32)/syslogevt.exe; \
448 else echo "Warning: $(srcdir)/os_win32/syslogevt.exe missing."; fi
451 $(exedir_win32)/%.exe: %.exe
456 $(docdir_win32)/%.html: %.html
457 $(UNIX2DOS) < $< > $@
460 $(docdir_win32)/%.txt: %.txt
461 $(UNIX2DOS) < $< > $@
464 $(docdir_win32)/%.txt: $(srcdir)/%
465 $(UNIX2DOS) < $< > $@
468 $(docdir_win32)/%.conf: $(srcdir)/%.conf
469 $(UNIX2DOS) < $< > $@
473 # Build config_vc6.h for MSVC 6 from MinGW config.h
475 config-vc6: $(srcdir)/os_win32/config_vc6.h
477 $(srcdir)/os_win32/config_vc6.h: config.h
478 sed '1i/* config_vc6.h. Generated by Makefile. */' $< | \
479 sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */,' | \
480 sed 's,i.86-pc-mingw32,i686-pc-win32vc6,' > $@
484 SUBDIRS= . examplescripts