]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - Makefile.am
Imported Upstream version 5.39.1+svn3124
[mirror_smartmontools-debian.git] / Makefile.am
CommitLineData
832b75ed
GG
1## Process this file with automake to produce Makefile.in
2#
e9583e0c 3# $Id: Makefile.am 3115 2010-06-02 17:23:05Z chrfranke $
832b75ed
GG
4#
5
6@SET_MAKE@
7
4d59bff9
GG
8# Make sure .cpp takes precedence to avoid compiling old .c file
9SUFFIXES = .cpp .c .s .o
10
2127e193
GI
11# BUILD_INFO can be provided by package maintainers (see INSTALL file)
12BUILD_INFO= "(local build)"
4d59bff9 13
2127e193
GI
14AM_CPPFLAGS = -DBUILD_INFO='$(BUILD_INFO)' -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"'
15if ENABLE_DRIVEDB
16AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"'
17endif
18if ENABLE_SAVESTATES
19AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"'
20endif
21if ENABLE_ATTRIBUTELOG
22AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
23endif
832b75ed 24
e9583e0c
GI
25if NEED_GETOPT_LONG
26AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
27endif
28if NEED_REGEX
29AM_CPPFLAGS += -I$(srcdir)/regex
30endif
31
832b75ed
GG
32sbin_PROGRAMS = smartd \
33 smartctl
34
7f0798ef
GI
35if ENABLE_DRIVEDB
36sbin_SCRIPTS = update-smart-drivedb
37endif
38
39
4d59bff9 40smartd_SOURCES = smartd.cpp \
4d59bff9
GG
41 atacmdnames.cpp \
42 atacmdnames.h \
43 atacmds.cpp \
44 atacmds.h \
2127e193
GI
45 dev_ata_cmd_set.cpp \
46 dev_ata_cmd_set.h \
47 dev_interface.cpp \
48 dev_interface.h \
49 dev_tunnelled.h \
a23d5117 50 drivedb.h \
4d59bff9
GG
51 extern.h \
52 int64.h \
53 knowndrives.cpp \
54 knowndrives.h \
55 scsicmds.cpp \
56 scsicmds.h \
57 scsiata.cpp \
4d59bff9 58 utility.cpp \
832b75ed
GG
59 utility.h
60
a23d5117 61smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@
832b75ed 62smartd_DEPENDENCIES = @os_deps@
4d59bff9
GG
63
64EXTRA_smartd_SOURCES = os_darwin.cpp \
65 os_darwin.h \
66 os_linux.cpp \
832b75ed 67 os_linux.h \
4d59bff9
GG
68 os_freebsd.cpp \
69 os_freebsd.h \
70 os_netbsd.cpp \
71 os_netbsd.h \
72 os_openbsd.cpp \
73 os_openbsd.h \
e9583e0c
GI
74 os_qnxnto.cpp \
75 os_qnxnto.h \
4d59bff9
GG
76 os_solaris.cpp \
77 os_solaris.h \
78 os_solaris_ata.s \
79 os_win32.cpp \
80 os_generic.cpp \
a37e7145
GG
81 os_generic.h \
82 cciss.cpp \
2127e193
GI
83 cciss.h \
84 dev_legacy.cpp \
85 megaraid.h
832b75ed
GG
86
87
88if OS_WIN32_MINGW
89
e9583e0c
GI
90smartd_SOURCES += \
91 os_win32/daemon_win32.cpp \
92 os_win32/daemon_win32.h \
93 os_win32/hostname_win32.cpp \
94 os_win32/hostname_win32.h \
95 os_win32/syslog_win32.cpp \
96 os_win32/syslog.h
832b75ed
GG
97
98endif
99
4d59bff9
GG
100smartctl_SOURCES= smartctl.cpp \
101 smartctl.h \
102 atacmdnames.cpp \
103 atacmdnames.h \
104 atacmds.cpp \
105 atacmds.h \
106 ataprint.cpp \
107 ataprint.h \
2127e193
GI
108 dev_ata_cmd_set.cpp \
109 dev_ata_cmd_set.h \
110 dev_interface.cpp \
111 dev_interface.h \
112 dev_tunnelled.h \
a23d5117 113 drivedb.h \
4d59bff9
GG
114 extern.h \
115 int64.h \
116 knowndrives.cpp \
117 knowndrives.h \
118 scsicmds.cpp \
119 scsicmds.h \
120 scsiata.cpp \
4d59bff9
GG
121 scsiprint.cpp \
122 scsiprint.h \
123 utility.cpp \
832b75ed
GG
124 utility.h
125
2127e193 126
832b75ed
GG
127smartctl_LDADD = @os_deps@ @os_libs@
128smartctl_DEPENDENCIES = @os_deps@
4d59bff9
GG
129
130EXTRA_smartctl_SOURCES = os_linux.cpp \
131 os_linux.h \
132 os_freebsd.cpp \
133 os_freebsd.h \
134 os_netbsd.cpp \
135 os_netbsd.h \
136 os_openbsd.cpp \
137 os_openbsd.h \
e9583e0c
GI
138 os_qnxnto.cpp \
139 os_qnxnto.h \
4d59bff9
GG
140 os_solaris.cpp \
141 os_solaris.h \
142 os_win32.cpp \
143 os_generic.cpp \
a37e7145
GG
144 os_generic.h \
145 cciss.cpp \
2127e193
GI
146 cciss.h \
147 dev_legacy.cpp \
148 megaraid.h
832b75ed 149
e9583e0c
GI
150if NEED_GETOPT_LONG
151
152smartctl_SOURCES += \
153 getopt/getopt.c \
154 getopt/getopt.h \
155 getopt/getopt1.c
832b75ed 156
e9583e0c
GI
157smartd_SOURCES += \
158 getopt/getopt.c \
159 getopt/getopt.h \
160 getopt/getopt1.c
161
162endif
163
164if NEED_REGEX
165
166smartctl_SOURCES += \
167 regex/regex.c \
168 regex/regex.h \
169 regex/regex_internal.h
170
171smartd_SOURCES += \
172 regex/regex.c \
173 regex/regex.h \
174 regex/regex_internal.h
832b75ed
GG
175
176# Included by regex.c:
e9583e0c
GI
177EXTRA_smartctl_SOURCES += \
178 regex/regcomp.c \
179 regex/regexec.c \
180 regex/regex_internal.c
181
182EXTRA_smartd_SOURCES += \
183 regex/regcomp.c \
184 regex/regexec.c \
185 regex/regex_internal.c
832b75ed
GG
186
187endif
188
189if OS_SOLARIS
190# This block is required because Solaris uses manual page section 1m
191# for administrative command (linux/freebsd use section 8) and Solaris
192# uses manual page section 4 for file formats (linux/freebsd use
193# section 5). Automake can deal cleanly with man page sections 1-8
194# and n, but NOT with sections of the form 1m.
195extra_MANS = smartd.conf.4 \
196 smartctl.1m \
197 smartd.1m
198install-man: $(extra_MANS)
199 @$(NORMAL_INSTALL)
200 $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
201 $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
202 for i in $(extra_MANS); do \
203 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
204 else file=$$i; fi; \
205 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
206 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
207 inst=`echo $$inst | sed -e 's/^.*\///'`; \
208 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
209 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
210 $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
211 done
212uninstall-man:
213 @$(NORMAL_UNINSTALL)
214 for i in $(extra_MANS); do \
215 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
216 else file=$$i; fi; \
217 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
218 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
219 inst=`echo $$inst | sed -e 's/^.*\///'`; \
220 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
221 echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
222 rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
223 done
224%.1m: %.8
225 awk '/^.TH/ {$$3="1m"} {print}' < $< | \
226 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
227 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
228 -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
229 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
230 -e 's|/var/log/messages|/var/adm/messages|g' \
231 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
232%.4: %.5
233 awk '/^.TH/ {$$3="4"} {print}' < $< | \
234 sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
235 -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
236 -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
237 -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
238 -e 's|/var/log/messages|/var/adm/messages|g' \
239 -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
240else
241# For systems that adopts traditional manner
242man_MANS = smartd.conf.5 \
243 smartctl.8 \
244 smartd.8
245endif
246
247docsdir=$(docdir)
248docs_DATA = AUTHORS \
249 CHANGELOG \
250 COPYING \
251 INSTALL \
252 NEWS \
253 README \
254 TODO \
255 WARNINGS \
256 smartd.conf
257
258sysconf_DATA = smartd.conf$(smartd_suffix)
259
260if SMARTD_SUFFIX
261smartd.conf$(smartd_suffix): smartd.conf
262 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
263endif
264
2127e193 265EXTRA_DIST = smartd.initd.in \
832b75ed
GG
266 smartd.8.in \
267 smartctl.8.in \
268 smartd.conf.5.in \
269 smartd.conf \
270 autogen.sh \
7f0798ef 271 update-smart-drivedb.in \
832b75ed
GG
272 os_darwin/SMART.in \
273 os_darwin/StartupParameters.plist \
274 os_darwin/English_Localizable.strings \
4d59bff9 275 os_win32/installer.nsi \
832b75ed
GG
276 $(docs_DATA)
277
a23d5117 278CLEANFILES = smartd.conf.5 \
832b75ed
GG
279 smartd.conf.4 \
280 smartd.8 \
281 smartd.1m \
282 smartd.8.html \
283 smartd.8.txt \
284 smartctl.8 \
285 smartctl.1m \
286 smartctl.8.html \
287 smartctl.8.txt \
288 smartd.conf.5.html \
289 smartd.conf.5.txt \
2127e193
GI
290 smartd.initd \
291 svnversion.h \
7f0798ef 292 update-smart-drivedb \
832b75ed
GG
293 SMART
294
295if SMARTD_SUFFIX
296CLEANFILES += smartd.conf$(smartd_suffix)
297endif
298
2127e193
GI
299# 'make maintainer-clean' also removes files generated by './autogen.sh'
300MAINTAINERCLEANFILES = \
301 $(srcdir)/Makefile.in \
302 $(srcdir)/aclocal.m4 \
303 $(srcdir)/configure \
304 $(srcdir)/config.guess \
305 $(srcdir)/config.h.in \
306 $(srcdir)/config.h.in~ \
307 $(srcdir)/config.sub \
308 $(srcdir)/depcomp \
309 $(srcdir)/install-sh \
310 $(srcdir)/missing \
311 $(srcdir)/mkinstalldirs
312
313utility.o: svnversion.h
314
315if IS_SVN_BUILD
316# Get version info from SVN
317svnversion.h: CHANGELOG Makefile $(srcdir)/.svn/entries
318 echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
319 (cd $(srcdir) \
320 && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \
321 && TZ= LC_ALL=C svn info 2>/dev/null \
322 | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \
323 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
324else
325
326# SVN not available, guess version info from Id strings
327svnversion.h: CHANGELOG Makefile
328 echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
329 (cd $(srcdir) && cat CHANGELOG Makefile.am configure.in smart*.in *.cpp *.h *.s) \
330 | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \
331 | sort -n -r \
332 | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \
333 | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@
334endif
335
336
2127e193
GI
337if ENABLE_DRIVEDB
338drivedb_DATA = drivedb.h
339endif
340
341if ENABLE_SAVESTATES
342# Create $(savestatesdir) only
343savestates_DATA =
344endif
345
346if ENABLE_ATTRIBUTELOG
347# Create $(attributelogdir) only
348attributelog_DATA =
349endif
832b75ed
GG
350
351smartd.conf.5.in: smartd.8.in
352 sed '1,/STARTINCLUDE/ D;/ENDINCLUDE/,$$D' < $(srcdir)/smartd.8.in > $(top_builddir)/tmp.directives
353 sed '/STARTINCLUDE/,$$D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.head
354 sed '1,/ENDINCLUDE/D' < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.tail
355 cat $(top_builddir)/tmp.head > $(srcdir)/smartd.conf.5.in
356 echo '.\" STARTINCLUDE' >> $(srcdir)/smartd.conf.5.in
357 cat $(top_builddir)/tmp.directives >> $(srcdir)/smartd.conf.5.in
358 echo '.\" ENDINCLUDE' >> $(srcdir)/smartd.conf.5.in
359 cat $(top_builddir)/tmp.tail >> $(srcdir)/smartd.conf.5.in
360 rm -f $(top_builddir)/tmp.head $(top_builddir)/tmp.tail $(top_builddir)/tmp.directives
361
7f0798ef
GI
362update-smart-drivedb: update-smart-drivedb.in config.status
363 $(SHELL) ./config.status --file=$@
364 chmod +x $@
365
366
2127e193 367if INSTALL_INITSCRIPT
832b75ed
GG
368if OS_DARWIN
369initd_DATA = SMART \
370 os_darwin/StartupParameters.plist \
371 os_darwin/English_Localizable.strings
372
373initd_install_name = SMART
374
375initd_DATA_install = install-initdDATA-darwin
2127e193 376initd_DATA_uninstall = uninstall-initdDATA-darwin
832b75ed
GG
377
378SMART : os_darwin/SMART.in
379 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
380
381install-initdDATA-darwin: $(initd_DATA)
382 $(mkinstalldirs) $(DESTDIR)$(initddir)
383 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
384 $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
385 $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
386 $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
387 $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
388 for i in English ; do \
389 RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
390 $(mkinstalldirs) $$RDIR ;\
391 $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
392 $$RDIR/Localizable.strings ; \
393 done
394 @echo -e "\n\n####################################################################\n#"
395 @echo -e "# PLEASE READ THIS BOX!\n#"
396 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/SMART/SMART start\n#"
397 @echo -e "# To automatically start smartd on bootup, add the line:\n# SMARTd=-YES-\n# to /etc/hostconfig\n#"
398 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
399 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
400 @echo -e "####################################################################\n\n"
401
2127e193
GI
402uninstall-initdDATA-darwin:
403 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
404
832b75ed
GG
405else
406
407initd_DATA = smartd.initd
408
409smartd.initd: $(srcdir)/smartd.initd.in Makefile
410 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
411
412initd_install_name = smartd$(smartd_suffix)
413
414initd_DATA_install = install-initdDATA-generic
2127e193 415initd_DATA_uninstall = uninstall-initdDATA-generic
832b75ed
GG
416
417install-initdDATA-generic: $(initd_DATA)
418 $(mkinstalldirs) $(DESTDIR)$(initddir)
419 $(INSTALL_SCRIPT) $(top_builddir)/smartd.initd $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
420 @echo -e "\n\n####################################################################\n#"
421 @echo -e "# PLEASE READ THIS BOX!\n#"
422 @echo -e "# To manually start the smartd daemon, run:\n# ${initddir}/smartd start\n#"
423 @echo -e "# To automatically start smartd on bootup, run:\n# /sbin/chkconfig --add smartd\n#"
424 @echo -e "# smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n# man smartd"
425 @echo -e "# to learn about it. A sample configuration file can be found in:\n# ${docdir}\n#"
426 @echo -e "####################################################################\n\n"
427
2127e193
GI
428
429uninstall-initdDATA-generic:
430 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
431endif
432else
433
434initd_DATA_install = install-initdDATA-null
435initd_DATA_uninstall = uninstall-initdDATA-null
436
437install-initdDATA-null:
438uninstall-initdDATA-null:
832b75ed
GG
439endif
440
441install-initdDATA : $(initd_DATA_install)
442
2127e193 443uninstall-initdDATA: $(initd_DATA_uninstall)
832b75ed 444
a23d5117
GI
445if ENABLE_CAPABILITIES
446MAN_CAPABILITIES = cat
447else
448MAN_CAPABILITIES = sed '/BEGIN ENABLE_CAPABILITIES/,/END ENABLE_CAPABILITIES/d'
449endif
450
2127e193
GI
451if ENABLE_DRIVEDB
452MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
453else
454MAN_DRIVEDB = sed '/BEGIN ENABLE_DRIVEDB/,/END ENABLE_DRIVEDB/d'
455endif
832b75ed 456
2127e193
GI
457if ENABLE_SAVESTATES
458MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
459else
460MAN_SAVESTATES = sed '/BEGIN ENABLE_SAVESTATES/,/END ENABLE_SAVESTATES/d'
461endif
462
463if ENABLE_ATTRIBUTELOG
464MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
465else
466MAN_ATTRIBUTELOG = sed '/BEGIN ENABLE_ATTRIBUTELOG/,/END ENABLE_ATTRIBUTELOG/d'
467endif
468
a23d5117 469MAN_FILTER = \
e9583e0c
GI
470 sed "s|CURRENT_SVN_VERSION|$(releaseversion)|g; \
471 s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g; \
472 s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g; \
a23d5117
GI
473 s|/usr/local/share/man/|$(mandir)/|g; \
474 s|/usr/local/sbin/|$(sbindir)/|g; \
475 s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g; \
e9583e0c 476 s|/usr/local/share/doc/smartmontools/|$(docsdir)/|g; \
a23d5117
GI
477 s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g; \
478 s|/usr/local/etc/smart_drivedb\\.h|$(sysconfdir)/smart_drivedb\\.h|g" | \
479 $(MAN_CAPABILITIES) | \
480 $(MAN_DRIVEDB) | \
481 $(MAN_SAVESTATES) | \
482 $(MAN_ATTRIBUTELOG)
483
7f0798ef
GI
484# Implicit rule 'smart%: smart%.in ...' does not work with BSD make
485smartctl.8: smartctl.8.in Makefile svnversion.h
486 cat $(srcdir)/smartctl.8.in | $(MAN_FILTER) > $@
487
488smartd.8: smartd.8.in Makefile svnversion.h
489 cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@
490
491smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
492 cat $(srcdir)/smartd.conf.5.in | $(MAN_FILTER) > $@
832b75ed
GG
493
494# Commands to convert man pages into .html and .txt
495# TODO: configure
496MAN2HTML = man2html
497#MAN2HTML = groff -man -Thtml
498MAN2TXT = groff -man -Tascii -P'-bcou'
499
4d59bff9
GG
500# Remove HTTP header and fix links in man2html output
501FIXHTML = sed '1s,^Content-type.*,,' \
502 | sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
832b75ed
GG
503 | sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
504 | sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
505 | sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
506
507# Convert man pages into .html and .txt
508
509htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
510
511txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
512
4d59bff9
GG
513if OS_WIN32_MINGW
514
515%.5.html: %.5
516 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
517
518%.8.html: %.8
519 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
520else
521
832b75ed
GG
522%.5.html: %.5
523 $(MAN2HTML) $< | $(FIXHTML) > $@
524
525%.8.html: %.8
526 $(MAN2HTML) $< | $(FIXHTML) > $@
4d59bff9 527endif
832b75ed
GG
528
529%.5.txt: %.5
530 $(MAN2TXT) $< > $@
531
532%.8.txt: %.8
533 $(MAN2TXT) $< > $@
534
535
a23d5117
GI
536# Check drive database syntax
537check:
538 @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \
539 echo "$(srcdir)/drivedb.h: OK"; \
540 else \
541 echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \
542 fi
543
832b75ed
GG
544
545if OS_WIN32_MINGW
546# Definitions for Windows distribution
547
7f0798ef
GI
548if OS_WIN64
549win_bits = 64
550else
551win_bits = 32
552endif
553
554distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
555distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
556distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
832b75ed
GG
557
558exedir_win32 = $(distdir_win32)/bin
559docdir_win32 = $(distdir_win32)/doc
560
561FILES_WIN32 = $(exedir_win32)/smartctl.exe \
2127e193 562 $(exedir_win32)/smartctl-nc.exe \
832b75ed
GG
563 $(exedir_win32)/smartd.exe \
564 $(docdir_win32)/AUTHORS.txt \
565 $(docdir_win32)/CHANGELOG.txt \
566 $(docdir_win32)/COPYING.txt \
567 $(docdir_win32)/INSTALL.txt \
568 $(docdir_win32)/NEWS.txt \
569 $(docdir_win32)/README.txt \
570 $(docdir_win32)/TODO.txt \
571 $(docdir_win32)/WARNINGS.txt \
572 $(docdir_win32)/smartd.conf \
573 $(docdir_win32)/smartctl.8.html \
574 $(docdir_win32)/smartctl.8.txt \
575 $(docdir_win32)/smartd.8.html \
576 $(docdir_win32)/smartd.8.txt \
577 $(docdir_win32)/smartd.conf.5.html \
578 $(docdir_win32)/smartd.conf.5.txt
579
2127e193
GI
580CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe \
581 smartctl-nc.exe smartctl-nc.exe.tmp \
582 distdir.mkdir syslogevt.check
832b75ed 583
7f0798ef
GI
584# Textfile converter from package cygutils or tofrodos
585# Note: Only use without options to be compatible with both packages
586UNIX2DOS = unix2dos
587DOS2UNIX = dos2unix
832b75ed
GG
588
589# Build Windows distribution
590
591dist-win32: $(distzip_win32)
592
4d59bff9
GG
593install-win32: $(distinst_win32)
594 ./$(distinst_win32)
595
596installer-win32: $(distinst_win32)
597
832b75ed
GG
598distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
599
600$(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
601 @rm -fv $(distzip_win32)
602 cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
603
4d59bff9 604# Build NSIS installer, try to locate makensis in default location first
7f0798ef 605# Note: Only option character '-' is also compatible with Linux version of makensis
4d59bff9
GG
606$(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) syslogevt.check
607 @makensis="$(MAKENSIS)"; if [ -z "$$makensis" ]; then \
7f0798ef 608 if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then \
4d59bff9 609 makensis="$$PROGRAMFILES/NSIS/makensis"; \
7f0798ef 610 elif makensis -VERSION >/dev/null 2>&1; then \
4d59bff9
GG
611 makensis=makensis; \
612 else \
613 echo 'makensis: command not found. Please download and install NSIS' 1>&2; \
614 echo 'from http://nsis.sourceforge.net/Download' 1>&2; exit 1; \
615 fi; \
616 fi; \
2127e193
GI
617 date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`; \
618 rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`; \
619 verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO); \
7f0798ef
GI
620 echo "$$makensis -V2 -NOCD -DINPDIR=$(distdir_win32) -DOUTFILE=$(distinst_win32) -DVERSTR='$$verstr' $(srcdir)/os_win32/installer.nsi"; \
621 "$$makensis" -V2 -NOCD -DINPDIR="$(distdir_win32)" -DOUTFILE="$(distinst_win32)" -DVERSTR="$$verstr" "$(srcdir)/os_win32/installer.nsi"
4d59bff9 622
832b75ed
GG
623cleandist-win32:
624 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
625
626distdir.mkdir:
627 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
628 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
629 touch $@
630
631syslogevt.check:
632 @if [ -f $(srcdir)/os_win32/syslogevt.exe ]; then \
633 cp -pv $(srcdir)/os_win32/syslogevt.exe $(exedir_win32)/syslogevt.exe; \
634 else echo "Warning: $(srcdir)/os_win32/syslogevt.exe missing."; fi
635 touch $@
636
637$(exedir_win32)/%.exe: %.exe
638 cp -p $< $@
7f0798ef 639 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
832b75ed
GG
640 touch -r $< $@
641
ba59cff1
GG
642$(docdir_win32)/%.html: %.html
643 $(UNIX2DOS) < $< > $@
644 touch -r $< $@
645
646$(docdir_win32)/%.txt: %.txt
832b75ed
GG
647 $(UNIX2DOS) < $< > $@
648 touch -r $< $@
649
650$(docdir_win32)/%.txt: $(srcdir)/%
651 $(UNIX2DOS) < $< > $@
652 touch -r $< $@
653
654$(docdir_win32)/%.conf: $(srcdir)/%.conf
655 $(UNIX2DOS) < $< > $@
656 touch -r $< $@
657
2127e193
GI
658# Build non-console version of smartctl for GSmartControl.
659# The script below changes the word at offset 220 (Subsystem) from 3
660# (Console) to 2 (GUI) in a copy of smartctl.exe.
661# This will be changed when a tool (like 'editbin') is available in
662# the Cygwin distribution
663smartctl-nc.exe: smartctl.exe
664 @rm -f $@
665 cp -p smartctl.exe $@.tmp
666 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \
667 else echo "invalid EXE header"; exit 1; fi
668 @echo "editbin /subsystem:windows $@.tmp"
669 @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null
670 @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \
671 else echo "EXE patch failed"; exit 1; fi
672 mv -f $@.tmp $@
673
674
675# Build {config,svnversion}_vc8.h for MSVC8 from MinGW {config,svnversion}.h
676
677config-vc8: $(srcdir)/os_win32/config_vc8.h $(srcdir)/os_win32/svnversion_vc8.h
678
679$(srcdir)/os_win32/config_vc8.h: config.h
680 sed '1i/* config_vc8.h. Generated from config.h by Makefile. */' $< | \
681 sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' | \
682 sed 's,i.86-pc-mingw32,i686-pc-win32vc8,' > $@
683
684$(srcdir)/os_win32/svnversion_vc8.h: svnversion.h
685 cp svnversion.h $@
832b75ed
GG
686
687endif
688
689SUBDIRS= . examplescripts