1 ## Process this file with automake to produce Makefile.in
3 # $Id: Makefile.am,v 1.74 2005/11/29 18:22:51 chrfranke Exp $
8 AM_CPPFLAGS = -DSMARTMONTOOLS_SYSCONFDIR=\"$(sysconfdir)\"
10 sbin_PROGRAMS = smartd \
13 smartd_SOURCES = smartd.c \
32 smartd_LDADD = @os_deps@ @os_libs@
33 smartd_DEPENDENCIES = @os_deps@
34 EXTRA_smartd_SOURCES = os_darwin.c \
57 os_win32/daemon_win32.h \
58 os_win32/daemon_win32.c \
59 os_win32/hostname_win32.h \
60 os_win32/hostname_win32.c \
62 os_win32/syslog_win32.c
64 # Included by regex.c:
65 EXTRA_smartd_SOURCES += \
68 posix/regex_internal.c \
69 posix/regex_internal.h
73 smartctl_SOURCES= smartctl.c \
92 smartctl_LDADD = @os_deps@ @os_libs@
93 smartctl_DEPENDENCIES = @os_deps@
94 EXTRA_smartctl_SOURCES = os_linux.c \
110 smartctl_SOURCES += \
115 # Included by regex.c:
116 EXTRA_smartctl_SOURCES += \
119 posix/regex_internal.c \
120 posix/regex_internal.h
125 # This block is required because Solaris uses manual page section 1m
126 # for administrative command (linux/freebsd use section 8) and Solaris
127 # uses manual page section 4 for file formats (linux/freebsd use
128 # section 5). Automake can deal cleanly with man page sections 1-8
129 # and n, but NOT with sections of the form 1m.
130 extra_MANS = smartd.conf.4 \
133 install-man: $(extra_MANS)
135 $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
136 $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
137 for i in $(extra_MANS); do \
138 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
140 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
141 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
142 inst=`echo $$inst | sed -e 's/^.*\///'`; \
143 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
144 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
145 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
149 for i in $(extra_MANS); do \
150 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
152 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
153 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
154 inst=`echo $$inst | sed -e 's/^.*\///'`; \
155 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
156 echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
157 rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
160 awk '/^.TH/ {$$3="1m"} {print}' < $< | \
161 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
162 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
163 -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
164 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
165 -e 's|/var/log/messages|/var/adm/messages|g' \
166 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
168 awk '/^.TH/ {$$3="4"} {print}' < $< | \
169 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
170 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
171 -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
172 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
173 -e 's|/var/log/messages|/var/adm/messages|g' \
174 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
176 # For systems that adopts traditional manner
177 man_MANS = smartd.conf.5 \
183 docs_DATA = AUTHORS \
193 sysconf_DATA = smartd.conf$(smartd_suffix)
196 smartd.conf$(smartd_suffix): smartd.conf
197 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
200 EXTRA_DIST = smartmontools.spec \
208 os_darwin/StartupParameters.plist \
209 os_darwin/English_Localizable.strings \
212 CLEANFILES = smartd.conf.5 \
228 CLEANFILES += smartd.conf$(smartd_suffix)
232 smartd.conf.5.in: smartd.8.in
233 sed '1,/STARTINCLUDE/ D;/ENDINCLUDE/,$$D' < $(srcdir)/smartd.8.in > $(top_builddir)/tmp.directives
234 sed '/STARTINCLUDE/,$$D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.head
235 sed '1,/ENDINCLUDE/D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.tail
236 cat $(top_builddir)/tmp.head > $(srcdir)/smartd.conf.5.in
237 echo '.\" STARTINCLUDE' >> $(srcdir)/smartd.conf.5.in
238 cat $(top_builddir)/tmp.directives >> $(srcdir)/smartd.conf.5.in
239 echo '.\" ENDINCLUDE' >> $(srcdir)/smartd.conf.5.in
240 cat $(top_builddir)/tmp.tail >> $(srcdir)/smartd.conf.5.in
241 rm -f $(top_builddir)/tmp.head $(top_builddir)/tmp.tail $(top_builddir)/tmp.directives
245 os_darwin/StartupParameters.plist \
246 os_darwin/English_Localizable.strings
248 initd_install_name = SMART
250 initd_DATA_install = install-initdDATA-darwin
252 SMART : os_darwin/SMART.in
253 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
255 install-initdDATA-darwin: $(initd_DATA)
256 $(mkinstalldirs) $(DESTDIR)$(initddir)
257 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
258 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
259 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
260 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
261 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
262 for i in English ; do \
263 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
264 $(mkinstalldirs) $$RDIR ;\
265 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
266 $$RDIR/Localizable.strings ; \
268 @echo -e "\n\n####################################################################\n#"
269 @echo -e "# PLEASE READ THIS BOX!\n#"
270 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/SMART/SMART start\n#"
271 @echo -e "# To automatically start smartd on bootup, add the line:\n# SMARTd=-YES-\n# to /etc/hostconfig\n#"
272 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
273 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
274 @echo -e "####################################################################\n\n"
278 initd_DATA = smartd.initd
280 smartd.initd: $(srcdir)/smartd.initd.in Makefile
281 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
283 initd_install_name = smartd$(smartd_suffix)
285 initd_DATA_install = install-initdDATA-generic
287 install-initdDATA-generic: $(initd_DATA)
288 $(mkinstalldirs) $(DESTDIR)$(initddir)
289 $(INSTALL_SCRIPT) $(top_builddir)/smartd.initd $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
290 @echo -e "\n\n####################################################################\n#"
291 @echo -e "# PLEASE READ THIS BOX!\n#"
292 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/smartd start\n#"
293 @echo -e "# To automatically start smartd on bootup, run:\n# /sbin/chkconfig --add smartd\n#"
294 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
295 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
296 @echo -e "####################################################################\n\n"
300 install-initdDATA : $(initd_DATA_install)
303 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
306 rm -rf $(DESTDIR)$(docsdir)
308 smart%: $(srcdir)/smart%.in Makefile
309 sed "s|CURRENT_CVS_VERSION|$(releaseversion)|g" $< | \
310 sed "s|CURRENT_CVS_DATE|$(smartmontools_release_date)|g" | \
311 sed "s|CURRENT_CVS_TIME|$(smartmontools_release_time)|g" | \
312 sed "s|/usr/local/share/man/|$(mandir)/|g" | \
313 sed "s|/usr/local/sbin/|$(sbindir)/|g" | \
314 sed "s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g" | \
315 sed "s|/usr/local/share/doc/smartmontools-5.1/|$(docsdir)/|g" | \
316 sed "s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g" > $@
319 # Commands to convert man pages into .html and .txt
322 #MAN2HTML = groff -man -Thtml
323 MAN2TXT = groff -man -Tascii -P'-bcou'
325 # Fix links in man2html output
326 FIXHTML = sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
327 | sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
328 | sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
329 | sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
331 # Convert man pages into .html and .txt
333 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
335 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
338 $(MAN2HTML) $< | $(FIXHTML) > $@
341 $(MAN2HTML) $< | $(FIXHTML) > $@
352 # Definitions for Windows distribution
354 distdir_win32 = $(PACKAGE)-$(VERSION).win32
355 distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
357 exedir_win32 = $(distdir_win32)/bin
358 docdir_win32 = $(distdir_win32)/doc
360 FILES_WIN32 = $(exedir_win32)/smartctl.exe \
361 $(exedir_win32)/smartd.exe \
362 $(docdir_win32)/AUTHORS.txt \
363 $(docdir_win32)/CHANGELOG.txt \
364 $(docdir_win32)/COPYING.txt \
365 $(docdir_win32)/INSTALL.txt \
366 $(docdir_win32)/NEWS.txt \
367 $(docdir_win32)/README.txt \
368 $(docdir_win32)/TODO.txt \
369 $(docdir_win32)/WARNINGS.txt \
370 $(docdir_win32)/smartd.conf \
371 $(docdir_win32)/smartctl.8.html \
372 $(docdir_win32)/smartctl.8.txt \
373 $(docdir_win32)/smartd.8.html \
374 $(docdir_win32)/smartd.8.txt \
375 $(docdir_win32)/smartd.conf.5.html \
376 $(docdir_win32)/smartd.conf.5.txt
378 CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe distdir.mkdir syslogevt.check
380 # Textfile converter from cygutils
381 UNIX2DOS = unix2dos -D
383 # Build Windows distribution
385 dist-win32: $(distzip_win32)
387 distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
389 $(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
390 @rm -fv $(distzip_win32)
391 cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
394 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
397 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
398 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
402 @if [ -f $(srcdir)/os_win32/syslogevt.exe ]; then \
403 cp -pv $(srcdir)/os_win32/syslogevt.exe $(exedir_win32)/syslogevt.exe; \
404 else echo "Warning: $(srcdir)/os_win32/syslogevt.exe missing."; fi
407 $(exedir_win32)/%.exe: %.exe
413 $(UNIX2DOS) < $< > $@
416 $(docdir_win32)/%.txt: $(srcdir)/%
417 $(UNIX2DOS) < $< > $@
420 $(docdir_win32)/%.conf: $(srcdir)/%.conf
421 $(UNIX2DOS) < $< > $@
425 # Build config_vc6.h for MSVC 6 from MinGW config.h
427 config-vc6: $(srcdir)/os_win32/config_vc6.h
429 $(srcdir)/os_win32/config_vc6.h: config.h
430 sed '1i/* config_vc6.h. Generated by Makefile. */' $< | \
431 sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRTOULL\|U*INT64_T\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */,' | \
432 sed 's,i.86-pc-mingw32,i686-pc-win32vc6,' > $@
436 SUBDIRS= . examplescripts