]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - Makefile.am
Updated changelog
[mirror_smartmontools-debian.git] / Makefile.am
CommitLineData
832b75ed
GG
1## Process this file with automake to produce Makefile.in
2#
a23d5117 3# $Id: Makefile.am 3059 2010-02-03 21:42:09Z 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
GG
24
25sbin_PROGRAMS = smartd \
26 smartctl
27
4d59bff9 28smartd_SOURCES = smartd.cpp \
4d59bff9
GG
29 atacmdnames.cpp \
30 atacmdnames.h \
31 atacmds.cpp \
32 atacmds.h \
2127e193
GI
33 dev_ata_cmd_set.cpp \
34 dev_ata_cmd_set.h \
35 dev_interface.cpp \
36 dev_interface.h \
37 dev_tunnelled.h \
a23d5117 38 drivedb.h \
4d59bff9
GG
39 extern.h \
40 int64.h \
41 knowndrives.cpp \
42 knowndrives.h \
43 scsicmds.cpp \
44 scsicmds.h \
45 scsiata.cpp \
4d59bff9 46 utility.cpp \
832b75ed
GG
47 utility.h
48
a23d5117 49smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@
832b75ed 50smartd_DEPENDENCIES = @os_deps@
4d59bff9
GG
51
52EXTRA_smartd_SOURCES = os_darwin.cpp \
53 os_darwin.h \
54 os_linux.cpp \
832b75ed 55 os_linux.h \
4d59bff9
GG
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 \
a37e7145
GG
67 os_generic.h \
68 cciss.cpp \
2127e193
GI
69 cciss.h \
70 dev_legacy.cpp \
71 megaraid.h
832b75ed
GG
72
73
74if OS_WIN32_MINGW
75
4d59bff9
GG
76smartd_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
832b75ed
GG
85
86# Included by regex.c:
87EXTRA_smartd_SOURCES += \
88 posix/regcomp.c \
89 posix/regexec.c \
90 posix/regex_internal.c \
91 posix/regex_internal.h
92
93endif
94
4d59bff9
GG
95smartctl_SOURCES= smartctl.cpp \
96 smartctl.h \
97 atacmdnames.cpp \
98 atacmdnames.h \
99 atacmds.cpp \
100 atacmds.h \
101 ataprint.cpp \
102 ataprint.h \
2127e193
GI
103 dev_ata_cmd_set.cpp \
104 dev_ata_cmd_set.h \
105 dev_interface.cpp \
106 dev_interface.h \
107 dev_tunnelled.h \
a23d5117 108 drivedb.h \
4d59bff9
GG
109 extern.h \
110 int64.h \
111 knowndrives.cpp \
112 knowndrives.h \
113 scsicmds.cpp \
114 scsicmds.h \
115 scsiata.cpp \
4d59bff9
GG
116 scsiprint.cpp \
117 scsiprint.h \
118 utility.cpp \
832b75ed
GG
119 utility.h
120
2127e193 121
832b75ed
GG
122smartctl_LDADD = @os_deps@ @os_libs@
123smartctl_DEPENDENCIES = @os_deps@
4d59bff9
GG
124
125EXTRA_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 \
a37e7145
GG
137 os_generic.h \
138 cciss.cpp \
2127e193
GI
139 cciss.h \
140 dev_legacy.cpp \
141 megaraid.h
832b75ed
GG
142
143if OS_WIN32_MINGW
144
145smartctl_SOURCES += \
146 posix/regex.h \
147 posix/regex.c \
148 os_win32/syslog.h
149
150# Included by regex.c:
151EXTRA_smartctl_SOURCES += \
152 posix/regcomp.c \
153 posix/regexec.c \
154 posix/regex_internal.c \
155 posix/regex_internal.h
156
157endif
158
159if 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.
165extra_MANS = smartd.conf.4 \
166 smartctl.1m \
167 smartd.1m
168install-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
182uninstall-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' > $@
210else
211# For systems that adopts traditional manner
212man_MANS = smartd.conf.5 \
213 smartctl.8 \
214 smartd.8
215endif
216
217docsdir=$(docdir)
218docs_DATA = AUTHORS \
219 CHANGELOG \
220 COPYING \
221 INSTALL \
222 NEWS \
223 README \
224 TODO \
225 WARNINGS \
226 smartd.conf
227
228sysconf_DATA = smartd.conf$(smartd_suffix)
229
230if SMARTD_SUFFIX
231smartd.conf$(smartd_suffix): smartd.conf
232 cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
233endif
234
2127e193 235EXTRA_DIST = smartd.initd.in \
832b75ed
GG
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 \
4d59bff9 244 os_win32/installer.nsi \
832b75ed
GG
245 $(docs_DATA)
246
a23d5117 247CLEANFILES = smartd.conf.5 \
832b75ed
GG
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 \
2127e193
GI
259 smartd.initd \
260 svnversion.h \
832b75ed
GG
261 SMART
262
263if SMARTD_SUFFIX
264CLEANFILES += smartd.conf$(smartd_suffix)
265endif
266
2127e193
GI
267# 'make maintainer-clean' also removes files generated by './autogen.sh'
268MAINTAINERCLEANFILES = \
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
281utility.o: svnversion.h
282
283if IS_SVN_BUILD
284# Get version info from SVN
285svnversion.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_,' >> $@
292else
293
294# SVN not available, guess version info from Id strings
295svnversion.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_,' >> $@
302endif
303
304
2127e193
GI
305if ENABLE_DRIVEDB
306drivedb_DATA = drivedb.h
307endif
308
309if ENABLE_SAVESTATES
310# Create $(savestatesdir) only
311savestates_DATA =
312endif
313
314if ENABLE_ATTRIBUTELOG
315# Create $(attributelogdir) only
316attributelog_DATA =
317endif
832b75ed
GG
318
319smartd.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
2127e193 330if INSTALL_INITSCRIPT
832b75ed
GG
331if OS_DARWIN
332initd_DATA = SMART \
333 os_darwin/StartupParameters.plist \
334 os_darwin/English_Localizable.strings
335
336initd_install_name = SMART
337
338initd_DATA_install = install-initdDATA-darwin
2127e193 339initd_DATA_uninstall = uninstall-initdDATA-darwin
832b75ed
GG
340
341SMART : os_darwin/SMART.in
342 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
343
344install-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
2127e193
GI
365uninstall-initdDATA-darwin:
366 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
367
832b75ed
GG
368else
369
370initd_DATA = smartd.initd
371
372smartd.initd: $(srcdir)/smartd.initd.in Makefile
373 sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
374
375initd_install_name = smartd$(smartd_suffix)
376
377initd_DATA_install = install-initdDATA-generic
2127e193 378initd_DATA_uninstall = uninstall-initdDATA-generic
832b75ed
GG
379
380install-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
2127e193
GI
391
392uninstall-initdDATA-generic:
393 rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
394endif
395else
396
397initd_DATA_install = install-initdDATA-null
398initd_DATA_uninstall = uninstall-initdDATA-null
399
400install-initdDATA-null:
401uninstall-initdDATA-null:
832b75ed
GG
402endif
403
404install-initdDATA : $(initd_DATA_install)
405
2127e193 406uninstall-initdDATA: $(initd_DATA_uninstall)
832b75ed 407
a23d5117
GI
408if ENABLE_CAPABILITIES
409MAN_CAPABILITIES = cat
410else
411MAN_CAPABILITIES = sed '/BEGIN ENABLE_CAPABILITIES/,/END ENABLE_CAPABILITIES/d'
412endif
413
2127e193
GI
414if ENABLE_DRIVEDB
415MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g"
416else
417MAN_DRIVEDB = sed '/BEGIN ENABLE_DRIVEDB/,/END ENABLE_DRIVEDB/d'
418endif
832b75ed 419
2127e193
GI
420if ENABLE_SAVESTATES
421MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g"
422else
423MAN_SAVESTATES = sed '/BEGIN ENABLE_SAVESTATES/,/END ENABLE_SAVESTATES/d'
424endif
425
426if ENABLE_ATTRIBUTELOG
427MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g"
428else
429MAN_ATTRIBUTELOG = sed '/BEGIN ENABLE_ATTRIBUTELOG/,/END ENABLE_ATTRIBUTELOG/d'
430endif
431
a23d5117
GI
432MAN_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
2127e193
GI
447if OS_FREEBSD
448.for file in $(man_MANS)
449${file}: $(srcdir)/${file}.in Makefile svnversion.h
a23d5117 450 cat ${.ALLSRC:M*.in} | $(MAN_FILTER) > $@
2127e193
GI
451.endfor
452else
453smart%: $(srcdir)/smart%.in Makefile svnversion.h
a23d5117 454 cat $< | $(MAN_FILTER) > $@
2127e193 455endif
832b75ed
GG
456
457# Commands to convert man pages into .html and .txt
458# TODO: configure
459MAN2HTML = man2html
460#MAN2HTML = groff -man -Thtml
461MAN2TXT = groff -man -Tascii -P'-bcou'
462
4d59bff9
GG
463# Remove HTTP header and fix links in man2html output
464FIXHTML = 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' \
832b75ed
GG
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
472htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
473
474txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
475
4d59bff9
GG
476if OS_WIN32_MINGW
477
478%.5.html: %.5
479 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
480
481%.8.html: %.8
482 $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
483else
484
832b75ed
GG
485%.5.html: %.5
486 $(MAN2HTML) $< | $(FIXHTML) > $@
487
488%.8.html: %.8
489 $(MAN2HTML) $< | $(FIXHTML) > $@
4d59bff9 490endif
832b75ed
GG
491
492%.5.txt: %.5
493 $(MAN2TXT) $< > $@
494
495%.8.txt: %.8
496 $(MAN2TXT) $< > $@
497
498
a23d5117
GI
499# Check drive database syntax
500check:
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
832b75ed
GG
507
508if OS_WIN32_MINGW
509# Definitions for Windows distribution
510
511distdir_win32 = $(PACKAGE)-$(VERSION).win32
512distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
4d59bff9 513distinst_win32= $(PACKAGE)-$(VERSION).win32-setup.exe
832b75ed
GG
514
515exedir_win32 = $(distdir_win32)/bin
516docdir_win32 = $(distdir_win32)/doc
517
518FILES_WIN32 = $(exedir_win32)/smartctl.exe \
2127e193 519 $(exedir_win32)/smartctl-nc.exe \
832b75ed
GG
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
2127e193
GI
537CLEANFILES += $(FILES_WIN32) $(exedir_win32)/syslogevt.exe \
538 smartctl-nc.exe smartctl-nc.exe.tmp \
539 distdir.mkdir syslogevt.check
832b75ed
GG
540
541# Textfile converter from cygutils
542UNIX2DOS = unix2dos -D
4d59bff9 543DOS2UNIX = dos2unix -U
832b75ed
GG
544
545# Build Windows distribution
546
547dist-win32: $(distzip_win32)
548
4d59bff9
GG
549install-win32: $(distinst_win32)
550 ./$(distinst_win32)
551
552installer-win32: $(distinst_win32)
553
832b75ed
GG
554distdir-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
4d59bff9
GG
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; \
2127e193
GI
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"
4d59bff9 577
832b75ed
GG
578cleandist-win32:
579 rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
580
581distdir.mkdir:
582 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
583 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
584 touch $@
585
586syslogevt.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
ba59cff1
GG
597$(docdir_win32)/%.html: %.html
598 $(UNIX2DOS) < $< > $@
599 touch -r $< $@
600
601$(docdir_win32)/%.txt: %.txt
832b75ed
GG
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
2127e193
GI
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
618smartctl-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
632config-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 $@
832b75ed
GG
641
642endif
643
644SUBDIRS= . examplescripts