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