]>
Commit | Line | Data |
---|---|---|
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 |
9 | SUFFIXES = .cpp .c .s .o | |
10 | ||
2127e193 GI |
11 | # BUILD_INFO can be provided by package maintainers (see INSTALL file) |
12 | BUILD_INFO= "(local build)" | |
4d59bff9 | 13 | |
2127e193 GI |
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 | |
832b75ed | 24 | |
e9583e0c GI |
25 | if NEED_GETOPT_LONG |
26 | AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__ | |
27 | endif | |
28 | if NEED_REGEX | |
29 | AM_CPPFLAGS += -I$(srcdir)/regex | |
30 | endif | |
31 | ||
832b75ed GG |
32 | sbin_PROGRAMS = smartd \ |
33 | smartctl | |
34 | ||
7f0798ef GI |
35 | if ENABLE_DRIVEDB |
36 | sbin_SCRIPTS = update-smart-drivedb | |
37 | endif | |
38 | ||
39 | ||
4d59bff9 | 40 | smartd_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 | 61 | smartd_LDADD = @os_deps@ @os_libs@ @CAPNG_LDADD@ |
832b75ed | 62 | smartd_DEPENDENCIES = @os_deps@ |
4d59bff9 GG |
63 | |
64 | EXTRA_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 | ||
88 | if OS_WIN32_MINGW | |
89 | ||
e9583e0c GI |
90 | smartd_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 | |
98 | endif | |
99 | ||
4d59bff9 GG |
100 | smartctl_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 |
127 | smartctl_LDADD = @os_deps@ @os_libs@ |
128 | smartctl_DEPENDENCIES = @os_deps@ | |
4d59bff9 GG |
129 | |
130 | EXTRA_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 |
150 | if NEED_GETOPT_LONG |
151 | ||
152 | smartctl_SOURCES += \ | |
153 | getopt/getopt.c \ | |
154 | getopt/getopt.h \ | |
155 | getopt/getopt1.c | |
832b75ed | 156 | |
e9583e0c GI |
157 | smartd_SOURCES += \ |
158 | getopt/getopt.c \ | |
159 | getopt/getopt.h \ | |
160 | getopt/getopt1.c | |
161 | ||
162 | endif | |
163 | ||
164 | if NEED_REGEX | |
165 | ||
166 | smartctl_SOURCES += \ | |
167 | regex/regex.c \ | |
168 | regex/regex.h \ | |
169 | regex/regex_internal.h | |
170 | ||
171 | smartd_SOURCES += \ | |
172 | regex/regex.c \ | |
173 | regex/regex.h \ | |
174 | regex/regex_internal.h | |
832b75ed GG |
175 | |
176 | # Included by regex.c: | |
e9583e0c GI |
177 | EXTRA_smartctl_SOURCES += \ |
178 | regex/regcomp.c \ | |
179 | regex/regexec.c \ | |
180 | regex/regex_internal.c | |
181 | ||
182 | EXTRA_smartd_SOURCES += \ | |
183 | regex/regcomp.c \ | |
184 | regex/regexec.c \ | |
185 | regex/regex_internal.c | |
832b75ed GG |
186 | |
187 | endif | |
188 | ||
189 | if 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. | |
195 | extra_MANS = smartd.conf.4 \ | |
196 | smartctl.1m \ | |
197 | smartd.1m | |
198 | install-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 | |
212 | uninstall-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' > $@ | |
240 | else | |
241 | # For systems that adopts traditional manner | |
242 | man_MANS = smartd.conf.5 \ | |
243 | smartctl.8 \ | |
244 | smartd.8 | |
245 | endif | |
246 | ||
247 | docsdir=$(docdir) | |
248 | docs_DATA = AUTHORS \ | |
249 | CHANGELOG \ | |
250 | COPYING \ | |
251 | INSTALL \ | |
252 | NEWS \ | |
253 | README \ | |
254 | TODO \ | |
255 | WARNINGS \ | |
256 | smartd.conf | |
257 | ||
258 | sysconf_DATA = smartd.conf$(smartd_suffix) | |
259 | ||
260 | if SMARTD_SUFFIX | |
261 | smartd.conf$(smartd_suffix): smartd.conf | |
262 | cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix) | |
263 | endif | |
264 | ||
2127e193 | 265 | EXTRA_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 | 278 | CLEANFILES = 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 | ||
295 | if SMARTD_SUFFIX | |
296 | CLEANFILES += smartd.conf$(smartd_suffix) | |
297 | endif | |
298 | ||
2127e193 GI |
299 | # 'make maintainer-clean' also removes files generated by './autogen.sh' |
300 | MAINTAINERCLEANFILES = \ | |
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 | ||
313 | utility.o: svnversion.h | |
314 | ||
315 | if IS_SVN_BUILD | |
316 | # Get version info from SVN | |
317 | svnversion.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_,' >> $@ | |
324 | else | |
325 | ||
326 | # SVN not available, guess version info from Id strings | |
327 | svnversion.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_,' >> $@ | |
334 | endif | |
335 | ||
336 | ||
2127e193 GI |
337 | if ENABLE_DRIVEDB |
338 | drivedb_DATA = drivedb.h | |
339 | endif | |
340 | ||
341 | if ENABLE_SAVESTATES | |
342 | # Create $(savestatesdir) only | |
343 | savestates_DATA = | |
344 | endif | |
345 | ||
346 | if ENABLE_ATTRIBUTELOG | |
347 | # Create $(attributelogdir) only | |
348 | attributelog_DATA = | |
349 | endif | |
832b75ed GG |
350 | |
351 | smartd.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 |
362 | update-smart-drivedb: update-smart-drivedb.in config.status |
363 | $(SHELL) ./config.status --file=$@ | |
364 | chmod +x $@ | |
365 | ||
366 | ||
2127e193 | 367 | if INSTALL_INITSCRIPT |
832b75ed GG |
368 | if OS_DARWIN |
369 | initd_DATA = SMART \ | |
370 | os_darwin/StartupParameters.plist \ | |
371 | os_darwin/English_Localizable.strings | |
372 | ||
373 | initd_install_name = SMART | |
374 | ||
375 | initd_DATA_install = install-initdDATA-darwin | |
2127e193 | 376 | initd_DATA_uninstall = uninstall-initdDATA-darwin |
832b75ed GG |
377 | |
378 | SMART : os_darwin/SMART.in | |
379 | sed "s|/usr/sbin/|$(sbindir)/|" $< > $@ | |
380 | ||
381 | install-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 |
402 | uninstall-initdDATA-darwin: |
403 | rm -rf $(DESTDIR)$(initddir)/$(initd_install_name) | |
404 | ||
832b75ed GG |
405 | else |
406 | ||
407 | initd_DATA = smartd.initd | |
408 | ||
409 | smartd.initd: $(srcdir)/smartd.initd.in Makefile | |
410 | sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@ | |
411 | ||
412 | initd_install_name = smartd$(smartd_suffix) | |
413 | ||
414 | initd_DATA_install = install-initdDATA-generic | |
2127e193 | 415 | initd_DATA_uninstall = uninstall-initdDATA-generic |
832b75ed GG |
416 | |
417 | install-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 | |
429 | uninstall-initdDATA-generic: | |
430 | rm -rf $(DESTDIR)$(initddir)/$(initd_install_name) | |
431 | endif | |
432 | else | |
433 | ||
434 | initd_DATA_install = install-initdDATA-null | |
435 | initd_DATA_uninstall = uninstall-initdDATA-null | |
436 | ||
437 | install-initdDATA-null: | |
438 | uninstall-initdDATA-null: | |
832b75ed GG |
439 | endif |
440 | ||
441 | install-initdDATA : $(initd_DATA_install) | |
442 | ||
2127e193 | 443 | uninstall-initdDATA: $(initd_DATA_uninstall) |
832b75ed | 444 | |
a23d5117 GI |
445 | if ENABLE_CAPABILITIES |
446 | MAN_CAPABILITIES = cat | |
447 | else | |
448 | MAN_CAPABILITIES = sed '/BEGIN ENABLE_CAPABILITIES/,/END ENABLE_CAPABILITIES/d' | |
449 | endif | |
450 | ||
2127e193 GI |
451 | if ENABLE_DRIVEDB |
452 | MAN_DRIVEDB = sed "s|/usr/local/share/smartmontools/drivedb\\.h|$(drivedbdir)/drivedb.h|g" | |
453 | else | |
454 | MAN_DRIVEDB = sed '/BEGIN ENABLE_DRIVEDB/,/END ENABLE_DRIVEDB/d' | |
455 | endif | |
832b75ed | 456 | |
2127e193 GI |
457 | if ENABLE_SAVESTATES |
458 | MAN_SAVESTATES = sed "s|/usr/local/var/lib/smartmontools/smartd\\.|$(savestates)|g" | |
459 | else | |
460 | MAN_SAVESTATES = sed '/BEGIN ENABLE_SAVESTATES/,/END ENABLE_SAVESTATES/d' | |
461 | endif | |
462 | ||
463 | if ENABLE_ATTRIBUTELOG | |
464 | MAN_ATTRIBUTELOG = sed "s|/usr/local/var/lib/smartmontools/attrlog\\.|$(attributelog)|g" | |
465 | else | |
466 | MAN_ATTRIBUTELOG = sed '/BEGIN ENABLE_ATTRIBUTELOG/,/END ENABLE_ATTRIBUTELOG/d' | |
467 | endif | |
468 | ||
a23d5117 | 469 | MAN_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 |
485 | smartctl.8: smartctl.8.in Makefile svnversion.h | |
486 | cat $(srcdir)/smartctl.8.in | $(MAN_FILTER) > $@ | |
487 | ||
488 | smartd.8: smartd.8.in Makefile svnversion.h | |
489 | cat $(srcdir)/smartd.8.in | $(MAN_FILTER) > $@ | |
490 | ||
491 | smartd.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 | |
496 | MAN2HTML = man2html | |
497 | #MAN2HTML = groff -man -Thtml | |
498 | MAN2TXT = groff -man -Tascii -P'-bcou' | |
499 | ||
4d59bff9 GG |
500 | # Remove HTTP header and fix links in man2html output |
501 | FIXHTML = 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 | ||
509 | htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html | |
510 | ||
511 | txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt | |
512 | ||
4d59bff9 GG |
513 | if OS_WIN32_MINGW |
514 | ||
515 | %.5.html: %.5 | |
516 | $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@ | |
517 | ||
518 | %.8.html: %.8 | |
519 | $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@ | |
520 | else | |
521 | ||
832b75ed GG |
522 | %.5.html: %.5 |
523 | $(MAN2HTML) $< | $(FIXHTML) > $@ | |
524 | ||
525 | %.8.html: %.8 | |
526 | $(MAN2HTML) $< | $(FIXHTML) > $@ | |
4d59bff9 | 527 | endif |
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 |
537 | check: | |
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 | |
545 | if OS_WIN32_MINGW | |
546 | # Definitions for Windows distribution | |
547 | ||
7f0798ef GI |
548 | if OS_WIN64 |
549 | win_bits = 64 | |
550 | else | |
551 | win_bits = 32 | |
552 | endif | |
553 | ||
554 | distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits) | |
555 | distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip | |
556 | distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe | |
832b75ed GG |
557 | |
558 | exedir_win32 = $(distdir_win32)/bin | |
559 | docdir_win32 = $(distdir_win32)/doc | |
560 | ||
561 | FILES_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 |
580 | CLEANFILES += $(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 | |
586 | UNIX2DOS = unix2dos | |
587 | DOS2UNIX = dos2unix | |
832b75ed GG |
588 | |
589 | # Build Windows distribution | |
590 | ||
591 | dist-win32: $(distzip_win32) | |
592 | ||
4d59bff9 GG |
593 | install-win32: $(distinst_win32) |
594 | ./$(distinst_win32) | |
595 | ||
596 | installer-win32: $(distinst_win32) | |
597 | ||
832b75ed GG |
598 | distdir-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 |
623 | cleandist-win32: |
624 | rm -rf $(distdir_win32) distdir.mkdir syslogevt.check | |
625 | ||
626 | distdir.mkdir: | |
627 | @test -d $(exedir_win32) || mkdir -pv $(exedir_win32) | |
628 | @test -d $(docdir_win32) || mkdir -pv $(docdir_win32) | |
629 | touch $@ | |
630 | ||
631 | syslogevt.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 | |
663 | smartctl-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 | ||
677 | config-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 | |
687 | endif | |
688 | ||
689 | SUBDIRS= . examplescripts |