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