]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - Makefile.am
add debian specific patches
[mirror_smartmontools-debian.git] / Makefile.am
CommitLineData
832b75ed
GG
1## Process this file with automake to produce Makefile.in
2#
3# $Id: Makefile.am,v 1.74 2005/11/29 18:22:51 chrfranke Exp $
4#
5
6@SET_MAKE@
7
8AM_CPPFLAGS = -DSMARTMONTOOLS_SYSCONFDIR=\"$(sysconfdir)\"
9
10sbin_PROGRAMS = smartd \
11 smartctl
12
13smartd_SOURCES = smartd.c \
14 smartd.h \
15 atacmdnames.c \
16 atacmdnames.h \
17 atacmds.c \
18 atacmds.h \
19 ataprint.c \
20 ataprint.h \
21 extern.h \
22 int64.h \
23 knowndrives.c \
24 knowndrives.h \
25 scsicmds.c \
26 scsicmds.h \
27 scsiprint.c \
28 scsiprint.h \
29 utility.c \
30 utility.h
31
32smartd_LDADD = @os_deps@ @os_libs@
33smartd_DEPENDENCIES = @os_deps@
34EXTRA_smartd_SOURCES = os_darwin.c \
35 os_darwin.h \
36 os_linux.c \
37 os_linux.h \
38 os_freebsd.c \
39 os_freebsd.h \
40 os_netbsd.c \
41 os_netbsd.h \
42 os_openbsd.c \
43 os_openbsd.h \
44 os_solaris.c \
45 os_solaris.h \
46 os_solaris_ata.s \
47 os_win32.c \
48 os_generic.c \
49 os_generic.h
50
51
52if OS_WIN32_MINGW
53
54smartd_SOURCES += \
55 posix/regex.h \
56 posix/regex.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 \
61 os_win32/syslog.h \
62 os_win32/syslog_win32.c
63
64# Included by regex.c:
65EXTRA_smartd_SOURCES += \
66 posix/regcomp.c \
67 posix/regexec.c \
68 posix/regex_internal.c \
69 posix/regex_internal.h
70
71endif
72
73smartctl_SOURCES= smartctl.c \
74 smartctl.h \
75 atacmdnames.c \
76 atacmdnames.h \
77 atacmds.c \
78 atacmds.h \
79 ataprint.c \
80 ataprint.h \
81 extern.h \
82 int64.h \
83 knowndrives.c \
84 knowndrives.h \
85 scsicmds.c \
86 scsicmds.h \
87 scsiprint.c \
88 scsiprint.h \
89 utility.c \
90 utility.h
91
92smartctl_LDADD = @os_deps@ @os_libs@
93smartctl_DEPENDENCIES = @os_deps@
94EXTRA_smartctl_SOURCES = os_linux.c \
95 os_linux.h \
96 os_freebsd.c \
97 os_freebsd.h \
98 os_netbsd.c \
99 os_netbsd.h \
100 os_openbsd.c \
101 os_openbsd.h \
102 os_solaris.c \
103 os_solaris.h \
104 os_win32.c \
105 os_generic.c \
106 os_generic.h
107
108if OS_WIN32_MINGW
109
110smartctl_SOURCES += \
111 posix/regex.h \
112 posix/regex.c \
113 os_win32/syslog.h
114
115# Included by regex.c:
116EXTRA_smartctl_SOURCES += \
117 posix/regcomp.c \
118 posix/regexec.c \
119 posix/regex_internal.c \
120 posix/regex_internal.h
121
122endif
123
124if OS_SOLARIS
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.
130extra_MANS = smartd.conf.4 \
131 smartctl.1m \
132 smartd.1m
133install-man: $(extra_MANS)
134 @$(NORMAL_INSTALL)
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; \
139 else file=$$i; fi; \
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; \
146 done
147uninstall-man:
148 @$(NORMAL_UNINSTALL)
149 for i in $(extra_MANS); do \
150 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
151 else file=$$i; fi; \
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; \
158 done
159%.1m: %.8
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' > $@
167%.4: %.5
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' > $@
175else
176# For systems that adopts traditional manner
177man_MANS = smartd.conf.5 \
178 smartctl.8 \
179 smartd.8
180endif
181
182docsdir=$(docdir)
183docs_DATA = AUTHORS \
184 CHANGELOG \
185 COPYING \
186 INSTALL \
187 NEWS \
188 README \
189 TODO \
190 WARNINGS \
191 smartd.conf
192
193sysconf_DATA = smartd.conf$(smartd_suffix)
194
195if SMARTD_SUFFIX
196smartd.conf$(smartd_suffix): smartd.conf
197 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
198endif
199
200EXTRA_DIST = smartmontools.spec \
201 smartd.initd.in \
202 smartd.8.in \
203 smartctl.8.in \
204 smartd.conf.5.in \
205 smartd.conf \
206 autogen.sh \
207 os_darwin/SMART.in \
208 os_darwin/StartupParameters.plist \
209 os_darwin/English_Localizable.strings \
210 $(docs_DATA)
211
212CLEANFILES = smartd.conf.5 \
213 smartd.conf.4 \
214 smartd.8 \
215 smartd.1m \
216 smartd.8.html \
217 smartd.8.txt \
218 smartctl.8 \
219 smartctl.1m \
220 smartctl.8.html \
221 smartctl.8.txt \
222 smartd.conf.5.html \
223 smartd.conf.5.txt \
224 smartd.initd \
225 SMART
226
227if SMARTD_SUFFIX
228CLEANFILES += smartd.conf$(smartd_suffix)
229endif
230
231
232smartd.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
242
243if OS_DARWIN
244initd_DATA = SMART \
245 os_darwin/StartupParameters.plist \
246 os_darwin/English_Localizable.strings
247
248initd_install_name = SMART
249
250initd_DATA_install = install-initdDATA-darwin
251
252SMART : os_darwin/SMART.in
253 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
254
255install-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 ; \
267 done
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"
275
276else
277
278initd_DATA = smartd.initd
279
280smartd.initd: $(srcdir)/smartd.initd.in Makefile
281 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
282
283initd_install_name = smartd$(smartd_suffix)
284
285initd_DATA_install = install-initdDATA-generic
286
287install-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"
297
298endif
299
300install-initdDATA : $(initd_DATA_install)
301
302uninstall-initdDATA:
303 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
304
305uninstall-docsDATA:
306 rm -rf $(DESTDIR)$(docsdir)
307
308smart%: $(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" > $@
317
318
319# Commands to convert man pages into .html and .txt
320# TODO: configure
321MAN2HTML = man2html
322#MAN2HTML = groff -man -Thtml
323MAN2TXT = groff -man -Tascii -P'-bcou'
324
325# Fix links in man2html output
326FIXHTML = 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'
330
331# Convert man pages into .html and .txt
332
333htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
334
335txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
336
337%.5.html: %.5
338 $(MAN2HTML) $< | $(FIXHTML) > $@
339
340%.8.html: %.8
341 $(MAN2HTML) $< | $(FIXHTML) > $@
342
343%.5.txt: %.5
344 $(MAN2TXT) $< > $@
345
346%.8.txt: %.8
347 $(MAN2TXT) $< > $@
348
349
350
351if OS_WIN32_MINGW
352# Definitions for Windows distribution
353
354distdir_win32 = $(PACKAGE)-$(VERSION).win32
355distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
356
357exedir_win32 = $(distdir_win32)/bin
358docdir_win32 = $(distdir_win32)/doc
359
360FILES_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
377
378CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe distdir.mkdir syslogevt.check
379
380# Textfile converter from cygutils
381UNIX2DOS = unix2dos -D
382
383# Build Windows distribution
384
385dist-win32: $(distzip_win32)
386
387distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
388
389$(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
390 @rm -fv $(distzip_win32)
391 cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
392
393cleandist-win32:
394 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
395
396distdir.mkdir:
397 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
398 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
399 touch $@
400
401syslogevt.check:
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
405 touch $@
406
407$(exedir_win32)/%.exe: %.exe
408 cp -p $< $@
409 strip -s $@
410 touch -r $< $@
411
412$(docdir_win32)/%: %
413 $(UNIX2DOS) < $< > $@
414 touch -r $< $@
415
416$(docdir_win32)/%.txt: $(srcdir)/%
417 $(UNIX2DOS) < $< > $@
418 touch -r $< $@
419
420$(docdir_win32)/%.conf: $(srcdir)/%.conf
421 $(UNIX2DOS) < $< > $@
422 touch -r $< $@
423
424
425# Build config_vc6.h for MSVC 6 from MinGW config.h
426
427config-vc6: $(srcdir)/os_win32/config_vc6.h
428
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,' > $@
433
434endif
435
436SUBDIRS= . examplescripts