]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - Makefile.am
Merge branch 'upstream'
[mirror_smartmontools-debian.git] / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2 #
3 # $Id: Makefile.am,v 1.81 2007/04/01 16:49:44 shattered 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
12 AM_CPPFLAGS = -DSMARTMONTOOLS_SYSCONFDIR=\"$(sysconfdir)\"
13
14 sbin_PROGRAMS = smartd \
15 smartctl
16
17 smartd_SOURCES = smartd.cpp \
18 smartd.h \
19 atacmdnames.cpp \
20 atacmdnames.h \
21 atacmds.cpp \
22 atacmds.h \
23 ataprint.cpp \
24 ataprint.h \
25 extern.h \
26 int64.h \
27 knowndrives.cpp \
28 knowndrives.h \
29 scsicmds.cpp \
30 scsicmds.h \
31 scsiata.cpp \
32 scsiata.h \
33 scsiprint.cpp \
34 scsiprint.h \
35 utility.cpp \
36 utility.h
37
38 smartd_LDADD = @os_deps@ @os_libs@
39 smartd_DEPENDENCIES = @os_deps@
40
41 EXTRA_smartd_SOURCES = os_darwin.cpp \
42 os_darwin.h \
43 os_linux.cpp \
44 os_linux.h \
45 os_freebsd.cpp \
46 os_freebsd.h \
47 os_netbsd.cpp \
48 os_netbsd.h \
49 os_openbsd.cpp \
50 os_openbsd.h \
51 os_solaris.cpp \
52 os_solaris.h \
53 os_solaris_ata.s \
54 os_win32.cpp \
55 os_generic.cpp \
56 os_generic.h \
57 cciss.cpp \
58 cciss.h
59
60
61 if OS_WIN32_MINGW
62
63 smartd_SOURCES += \
64 posix/regex.h \
65 posix/regex.c \
66 os_win32/daemon_win32.h \
67 os_win32/daemon_win32.cpp \
68 os_win32/hostname_win32.h \
69 os_win32/hostname_win32.cpp \
70 os_win32/syslog.h \
71 os_win32/syslog_win32.cpp
72
73 # Included by regex.c:
74 EXTRA_smartd_SOURCES += \
75 posix/regcomp.c \
76 posix/regexec.c \
77 posix/regex_internal.c \
78 posix/regex_internal.h
79
80 endif
81
82 smartctl_SOURCES= smartctl.cpp \
83 smartctl.h \
84 atacmdnames.cpp \
85 atacmdnames.h \
86 atacmds.cpp \
87 atacmds.h \
88 ataprint.cpp \
89 ataprint.h \
90 extern.h \
91 int64.h \
92 knowndrives.cpp \
93 knowndrives.h \
94 scsicmds.cpp \
95 scsicmds.h \
96 scsiata.cpp \
97 scsiata.h \
98 scsiprint.cpp \
99 scsiprint.h \
100 utility.cpp \
101 utility.h
102
103 smartctl_LDADD = @os_deps@ @os_libs@
104 smartctl_DEPENDENCIES = @os_deps@
105
106 EXTRA_smartctl_SOURCES = os_linux.cpp \
107 os_linux.h \
108 os_freebsd.cpp \
109 os_freebsd.h \
110 os_netbsd.cpp \
111 os_netbsd.h \
112 os_openbsd.cpp \
113 os_openbsd.h \
114 os_solaris.cpp \
115 os_solaris.h \
116 os_win32.cpp \
117 os_generic.cpp \
118 os_generic.h \
119 cciss.cpp \
120 cciss.h
121
122 if OS_WIN32_MINGW
123
124 smartctl_SOURCES += \
125 posix/regex.h \
126 posix/regex.c \
127 os_win32/syslog.h
128
129 # Included by regex.c:
130 EXTRA_smartctl_SOURCES += \
131 posix/regcomp.c \
132 posix/regexec.c \
133 posix/regex_internal.c \
134 posix/regex_internal.h
135
136 endif
137
138 if OS_SOLARIS
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 \
145 smartctl.1m \
146 smartd.1m
147 install-man: $(extra_MANS)
148 @$(NORMAL_INSTALL)
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; \
153 else file=$$i; fi; \
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; \
160 done
161 uninstall-man:
162 @$(NORMAL_UNINSTALL)
163 for i in $(extra_MANS); do \
164 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
165 else file=$$i; fi; \
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; \
172 done
173 %.1m: %.8
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' > $@
181 %.4: %.5
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' > $@
189 else
190 # For systems that adopts traditional manner
191 man_MANS = smartd.conf.5 \
192 smartctl.8 \
193 smartd.8
194 endif
195
196 docsdir=$(docdir)
197 docs_DATA = AUTHORS \
198 CHANGELOG \
199 COPYING \
200 INSTALL \
201 NEWS \
202 README \
203 TODO \
204 WARNINGS \
205 smartd.conf
206
207 sysconf_DATA = smartd.conf$(smartd_suffix)
208
209 if SMARTD_SUFFIX
210 smartd.conf$(smartd_suffix): smartd.conf
211 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
212 endif
213
214 EXTRA_DIST = smartmontools.spec \
215 smartd.initd.in \
216 smartd.8.in \
217 smartctl.8.in \
218 smartd.conf.5.in \
219 smartd.conf \
220 autogen.sh \
221 os_darwin/SMART.in \
222 os_darwin/StartupParameters.plist \
223 os_darwin/English_Localizable.strings \
224 os_win32/installer.nsi \
225 $(docs_DATA)
226
227 CLEANFILES = smartd.conf.5 \
228 smartd.conf.4 \
229 smartd.8 \
230 smartd.1m \
231 smartd.8.html \
232 smartd.8.txt \
233 smartctl.8 \
234 smartctl.1m \
235 smartctl.8.html \
236 smartctl.8.txt \
237 smartd.conf.5.html \
238 smartd.conf.5.txt \
239 smartd.initd \
240 SMART
241
242 if SMARTD_SUFFIX
243 CLEANFILES += smartd.conf$(smartd_suffix)
244 endif
245
246
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
257
258 if OS_DARWIN
259 initd_DATA = SMART \
260 os_darwin/StartupParameters.plist \
261 os_darwin/English_Localizable.strings
262
263 initd_install_name = SMART
264
265 initd_DATA_install = install-initdDATA-darwin
266
267 SMART : os_darwin/SMART.in
268 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
269
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 ; \
282 done
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"
290
291 else
292
293 initd_DATA = smartd.initd
294
295 smartd.initd: $(srcdir)/smartd.initd.in Makefile
296 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
297
298 initd_install_name = smartd$(smartd_suffix)
299
300 initd_DATA_install = install-initdDATA-generic
301
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"
312
313 endif
314
315 install-initdDATA : $(initd_DATA_install)
316
317 uninstall-initdDATA:
318 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
319
320 uninstall-docsDATA:
321 rm -rf $(DESTDIR)$(docsdir)
322
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" > $@
332
333
334 # Commands to convert man pages into .html and .txt
335 # TODO: configure
336 MAN2HTML = man2html
337 #MAN2HTML = groff -man -Thtml
338 MAN2TXT = groff -man -Tascii -P'-bcou'
339
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'
346
347 # Convert man pages into .html and .txt
348
349 htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
350
351 txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
352
353 if OS_WIN32_MINGW
354
355 %.5.html: %.5
356 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
357
358 %.8.html: %.8
359 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
360 else
361
362 %.5.html: %.5
363 $(MAN2HTML) $< | $(FIXHTML) > $@
364
365 %.8.html: %.8
366 $(MAN2HTML) $< | $(FIXHTML) > $@
367 endif
368
369 %.5.txt: %.5
370 $(MAN2TXT) $< > $@
371
372 %.8.txt: %.8
373 $(MAN2TXT) $< > $@
374
375
376
377 if OS_WIN32_MINGW
378 # Definitions for Windows distribution
379
380 distdir_win32 = $(PACKAGE)-$(VERSION).win32
381 distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
382 distinst_win32= $(PACKAGE)-$(VERSION).win32-setup.exe
383
384 exedir_win32 = $(distdir_win32)/bin
385 docdir_win32 = $(distdir_win32)/doc
386
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
404
405 CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe distdir.mkdir syslogevt.check
406
407 # Textfile converter from cygutils
408 UNIX2DOS = unix2dos -D
409 DOS2UNIX = dos2unix -U
410
411 # Build Windows distribution
412
413 dist-win32: $(distzip_win32)
414
415 install-win32: $(distinst_win32)
416 ./$(distinst_win32)
417
418 installer-win32: $(distinst_win32)
419
420 distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
421
422 $(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
423 @rm -fv $(distzip_win32)
424 cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
425
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 \
432 makensis=makensis; \
433 else \
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; \
436 fi; \
437 fi; \
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"
440
441 cleandist-win32:
442 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
443
444 distdir.mkdir:
445 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
446 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
447 touch $@
448
449 syslogevt.check:
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
453 touch $@
454
455 $(exedir_win32)/%.exe: %.exe
456 cp -p $< $@
457 strip -s $@
458 touch -r $< $@
459
460 $(docdir_win32)/%.html: %.html
461 $(UNIX2DOS) < $< > $@
462 touch -r $< $@
463
464 $(docdir_win32)/%.txt: %.txt
465 $(UNIX2DOS) < $< > $@
466 touch -r $< $@
467
468 $(docdir_win32)/%.txt: $(srcdir)/%
469 $(UNIX2DOS) < $< > $@
470 touch -r $< $@
471
472 $(docdir_win32)/%.conf: $(srcdir)/%.conf
473 $(UNIX2DOS) < $< > $@
474 touch -r $< $@
475
476
477 # Build config_vc6.h for MSVC 6 from MinGW config.h
478
479 config-vc6: $(srcdir)/os_win32/config_vc6.h
480
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,' > $@
485
486 endif
487
488 SUBDIRS= . examplescripts