]>
Commit | Line | Data |
---|---|---|
832b75ed GG |
1 | ## Process this file with automake to produce Makefile.in |
2 | # | |
f9e10201 | 3 | # $Id: Makefile.am 4519 2017-10-08 15:41:54Z chrfranke $ |
832b75ed GG |
4 | # |
5 | ||
6 | @SET_MAKE@ | |
7 | ||
ee38a438 | 8 | ACLOCAL_AMFLAGS = -I m4 |
d008864d | 9 | |
4d59bff9 GG |
10 | # Make sure .cpp takes precedence to avoid compiling old .c file |
11 | SUFFIXES = .cpp .c .s .o | |
12 | ||
2127e193 GI |
13 | # BUILD_INFO can be provided by package maintainers (see INSTALL file) |
14 | BUILD_INFO= "(local build)" | |
4d59bff9 | 15 | |
d2e702cf GI |
16 | AM_CPPFLAGS = \ |
17 | -DBUILD_INFO='$(BUILD_INFO)' \ | |
18 | -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"' \ | |
19 | -DSMARTMONTOOLS_SMARTDSCRIPTDIR='"$(smartdscriptdir)"' | |
20 | ||
2127e193 GI |
21 | if ENABLE_DRIVEDB |
22 | AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"' | |
23 | endif | |
24 | if ENABLE_SAVESTATES | |
25 | AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"' | |
26 | endif | |
27 | if ENABLE_ATTRIBUTELOG | |
28 | AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"' | |
29 | endif | |
832b75ed | 30 | |
d008864d GI |
31 | if OS_WIN32_MINGW |
32 | AM_CPPFLAGS += -I$(srcdir)/os_win32 | |
33 | endif | |
e9583e0c GI |
34 | if NEED_GETOPT_LONG |
35 | AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__ | |
36 | endif | |
37 | if NEED_REGEX | |
38 | AM_CPPFLAGS += -I$(srcdir)/regex | |
39 | endif | |
40 | ||
ee38a438 GI |
41 | sbin_PROGRAMS = \ |
42 | smartctl \ | |
43 | smartd | |
832b75ed | 44 | |
a86ec89e | 45 | if ENABLE_UPDATE_SMART_DRIVEDB |
cfbba5b9 GI |
46 | if OS_WIN32_MINGW |
47 | else | |
7f0798ef GI |
48 | sbin_SCRIPTS = update-smart-drivedb |
49 | endif | |
cfbba5b9 | 50 | endif |
7f0798ef GI |
51 | |
52 | ||
ee38a438 GI |
53 | smartctl_SOURCES = \ |
54 | smartctl.cpp \ | |
55 | smartctl.h \ | |
56 | atacmdnames.cpp \ | |
57 | atacmdnames.h \ | |
58 | atacmds.cpp \ | |
59 | atacmds.h \ | |
60 | ataidentify.cpp \ | |
61 | ataidentify.h \ | |
62 | ataprint.cpp \ | |
63 | ataprint.h \ | |
64 | dev_ata_cmd_set.cpp \ | |
65 | dev_ata_cmd_set.h \ | |
f9e10201 JD |
66 | dev_intelliprop.cpp \ |
67 | dev_intelliprop.h \ | |
ee38a438 GI |
68 | dev_interface.cpp \ |
69 | dev_interface.h \ | |
70 | dev_tunnelled.h \ | |
71 | drivedb.h \ | |
72 | int64.h \ | |
73 | knowndrives.cpp \ | |
74 | knowndrives.h \ | |
a86ec89e GI |
75 | nvmecmds.cpp \ |
76 | nvmecmds.h \ | |
77 | nvmeprint.cpp \ | |
78 | nvmeprint.h \ | |
ee38a438 GI |
79 | scsicmds.cpp \ |
80 | scsicmds.h \ | |
81 | scsiata.cpp \ | |
82 | scsiprint.cpp \ | |
83 | scsiprint.h \ | |
84 | utility.cpp \ | |
85 | utility.h | |
86 | ||
a86ec89e GI |
87 | smartctl_LDADD = $(os_deps) $(os_libs) |
88 | smartctl_DEPENDENCIES = $(os_deps) | |
ee38a438 GI |
89 | |
90 | EXTRA_smartctl_SOURCES = \ | |
91 | os_darwin.cpp \ | |
92 | os_darwin.h \ | |
93 | os_linux.cpp \ | |
94 | os_linux.h \ | |
95 | os_freebsd.cpp \ | |
96 | os_freebsd.h \ | |
97 | os_netbsd.cpp \ | |
98 | os_netbsd.h \ | |
99 | os_openbsd.cpp \ | |
100 | os_openbsd.h \ | |
f9e10201 JD |
101 | os_os2.cpp \ |
102 | os_os2.h \ | |
ee38a438 GI |
103 | os_qnxnto.cpp \ |
104 | os_qnxnto.h \ | |
105 | os_solaris.cpp \ | |
106 | os_solaris.h \ | |
ee38a438 GI |
107 | os_win32.cpp \ |
108 | os_generic.cpp \ | |
109 | os_generic.h \ | |
d2e702cf | 110 | aacraid.h \ |
ee38a438 GI |
111 | cciss.cpp \ |
112 | cciss.h \ | |
113 | cissio_freebsd.h \ | |
114 | dev_areca.cpp \ | |
115 | dev_areca.h \ | |
116 | dev_legacy.cpp \ | |
a86ec89e | 117 | linux_nvme_ioctl.h \ |
ee38a438 GI |
118 | megaraid.h |
119 | ||
120 | if OS_WIN32_MINGW | |
121 | ||
f9e10201 JD |
122 | smartctl_LDADD += smartctl_res.o |
123 | smartctl_DEPENDENCIES += smartctl_res.o | |
ee38a438 GI |
124 | |
125 | endif | |
126 | ||
127 | ||
128 | smartd_SOURCES = \ | |
129 | smartd.cpp \ | |
130 | atacmdnames.cpp \ | |
131 | atacmdnames.h \ | |
132 | atacmds.cpp \ | |
133 | atacmds.h \ | |
134 | dev_ata_cmd_set.cpp \ | |
135 | dev_ata_cmd_set.h \ | |
f9e10201 JD |
136 | dev_intelliprop.cpp \ |
137 | dev_intelliprop.h \ | |
ee38a438 GI |
138 | dev_interface.cpp \ |
139 | dev_interface.h \ | |
140 | dev_tunnelled.h \ | |
141 | drivedb.h \ | |
142 | int64.h \ | |
143 | knowndrives.cpp \ | |
144 | knowndrives.h \ | |
a86ec89e GI |
145 | nvmecmds.cpp \ |
146 | nvmecmds.h \ | |
ee38a438 GI |
147 | scsicmds.cpp \ |
148 | scsicmds.h \ | |
149 | scsiata.cpp \ | |
150 | utility.cpp \ | |
151 | utility.h | |
832b75ed | 152 | |
a86ec89e GI |
153 | smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD) |
154 | smartd_DEPENDENCIES = $(os_deps) | |
4d59bff9 | 155 | |
ee38a438 GI |
156 | EXTRA_smartd_SOURCES = \ |
157 | os_darwin.cpp \ | |
158 | os_darwin.h \ | |
159 | os_linux.cpp \ | |
160 | os_linux.h \ | |
161 | os_freebsd.cpp \ | |
162 | os_freebsd.h \ | |
163 | os_netbsd.cpp \ | |
164 | os_netbsd.h \ | |
165 | os_openbsd.cpp \ | |
166 | os_openbsd.h \ | |
f9e10201 JD |
167 | os_os2.cpp \ |
168 | os_os2.h \ | |
ee38a438 GI |
169 | os_qnxnto.cpp \ |
170 | os_qnxnto.h \ | |
171 | os_solaris.cpp \ | |
172 | os_solaris.h \ | |
ee38a438 GI |
173 | os_win32.cpp \ |
174 | os_generic.cpp \ | |
175 | os_generic.h \ | |
d2e702cf | 176 | aacraid.h \ |
ee38a438 GI |
177 | cciss.cpp \ |
178 | cciss.h \ | |
179 | cissio_freebsd.h \ | |
180 | dev_areca.cpp \ | |
181 | dev_areca.h \ | |
182 | dev_legacy.cpp \ | |
a86ec89e GI |
183 | linux_nvme_ioctl.h \ |
184 | freebsd_nvme_ioctl.h \ | |
f9e10201 | 185 | netbsd_nvme_ioctl.h \ |
ee38a438 | 186 | megaraid.h |
832b75ed GG |
187 | |
188 | if OS_WIN32_MINGW | |
189 | ||
e9583e0c GI |
190 | smartd_SOURCES += \ |
191 | os_win32/daemon_win32.cpp \ | |
192 | os_win32/daemon_win32.h \ | |
e9583e0c GI |
193 | os_win32/syslog_win32.cpp \ |
194 | os_win32/syslog.h | |
832b75ed | 195 | |
f9e10201 JD |
196 | smartd_LDADD += smartd_res.o |
197 | smartd_DEPENDENCIES += smartd_res.o | |
2127e193 | 198 | |
ee38a438 | 199 | endif |
4d59bff9 | 200 | |
a86ec89e GI |
201 | # Exclude from source tarball |
202 | nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s | |
203 | nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s | |
832b75ed | 204 | |
e9583e0c GI |
205 | if NEED_GETOPT_LONG |
206 | ||
207 | smartctl_SOURCES += \ | |
208 | getopt/getopt.c \ | |
209 | getopt/getopt.h \ | |
210 | getopt/getopt1.c | |
832b75ed | 211 | |
e9583e0c GI |
212 | smartd_SOURCES += \ |
213 | getopt/getopt.c \ | |
214 | getopt/getopt.h \ | |
215 | getopt/getopt1.c | |
216 | ||
217 | endif | |
218 | ||
219 | if NEED_REGEX | |
220 | ||
221 | smartctl_SOURCES += \ | |
222 | regex/regex.c \ | |
223 | regex/regex.h \ | |
224 | regex/regex_internal.h | |
225 | ||
226 | smartd_SOURCES += \ | |
227 | regex/regex.c \ | |
228 | regex/regex.h \ | |
229 | regex/regex_internal.h | |
832b75ed GG |
230 | |
231 | # Included by regex.c: | |
e9583e0c GI |
232 | EXTRA_smartctl_SOURCES += \ |
233 | regex/regcomp.c \ | |
234 | regex/regexec.c \ | |
235 | regex/regex_internal.c | |
236 | ||
237 | EXTRA_smartd_SOURCES += \ | |
238 | regex/regcomp.c \ | |
239 | regex/regexec.c \ | |
240 | regex/regex_internal.c | |
832b75ed GG |
241 | |
242 | endif | |
243 | ||
cfbba5b9 GI |
244 | if OS_WIN32 |
245 | ||
246 | smartctl_SOURCES += \ | |
247 | csmisas.h \ | |
248 | os_win32/wmiquery.cpp \ | |
249 | os_win32/wmiquery.h | |
250 | ||
251 | smartd_SOURCES += \ | |
252 | csmisas.h \ | |
253 | os_win32/wmiquery.cpp \ | |
254 | os_win32/wmiquery.h | |
255 | ||
256 | smartctl_LDADD += -lole32 -loleaut32 | |
257 | smartd_LDADD += -lole32 -loleaut32 | |
258 | ||
259 | endif | |
260 | ||
832b75ed GG |
261 | if OS_SOLARIS |
262 | # This block is required because Solaris uses manual page section 1m | |
263 | # for administrative command (linux/freebsd use section 8) and Solaris | |
264 | # uses manual page section 4 for file formats (linux/freebsd use | |
265 | # section 5). Automake can deal cleanly with man page sections 1-8 | |
266 | # and n, but NOT with sections of the form 1m. | |
267 | extra_MANS = smartd.conf.4 \ | |
268 | smartctl.1m \ | |
269 | smartd.1m | |
a86ec89e | 270 | if ENABLE_UPDATE_SMART_DRIVEDB |
d2e702cf GI |
271 | extra_MANS += update-smart-drivedb.1m |
272 | endif | |
273 | ||
274 | all-local: $(extra_MANS) | |
832b75ed GG |
275 | install-man: $(extra_MANS) |
276 | @$(NORMAL_INSTALL) | |
a86ec89e GI |
277 | $(MKDIR_P) '$(DESTDIR)$(mandir)/man4' |
278 | $(MKDIR_P) '$(DESTDIR)$(mandir)/man1m' | |
832b75ed GG |
279 | for i in $(extra_MANS); do \ |
280 | if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ | |
281 | else file=$$i; fi; \ | |
282 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ | |
283 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ | |
284 | inst=`echo $$inst | sed -e 's/^.*\///'`; \ | |
285 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ | |
a86ec89e GI |
286 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \ |
287 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \ | |
832b75ed GG |
288 | done |
289 | uninstall-man: | |
290 | @$(NORMAL_UNINSTALL) | |
291 | for i in $(extra_MANS); do \ | |
292 | if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ | |
293 | else file=$$i; fi; \ | |
294 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ | |
295 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ | |
296 | inst=`echo $$inst | sed -e 's/^.*\///'`; \ | |
297 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ | |
a86ec89e GI |
298 | echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \ |
299 | rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \ | |
832b75ed | 300 | done |
832b75ed GG |
301 | else |
302 | # For systems that adopts traditional manner | |
d2e702cf | 303 | |
832b75ed GG |
304 | man_MANS = smartd.conf.5 \ |
305 | smartctl.8 \ | |
306 | smartd.8 | |
d2e702cf | 307 | |
a86ec89e | 308 | if ENABLE_UPDATE_SMART_DRIVEDB |
d2e702cf GI |
309 | man_MANS += update-smart-drivedb.8 |
310 | endif | |
311 | ||
832b75ed GG |
312 | endif |
313 | ||
314 | docsdir=$(docdir) | |
ee38a438 GI |
315 | docs_DATA = \ |
316 | AUTHORS \ | |
317 | ChangeLog \ | |
318 | ChangeLog-5.0-6.0 \ | |
319 | COPYING \ | |
320 | INSTALL \ | |
321 | NEWS \ | |
322 | README \ | |
323 | TODO \ | |
ee38a438 | 324 | smartd.conf |
832b75ed | 325 | |
cfbba5b9 GI |
326 | examplesdir=$(exampledir) |
327 | examples_DATA = \ | |
328 | examplescripts/README | |
329 | examples_SCRIPTS = \ | |
330 | examplescripts/Example1 \ | |
331 | examplescripts/Example2 \ | |
332 | examplescripts/Example3 \ | |
d2e702cf GI |
333 | examplescripts/Example4 \ |
334 | examplescripts/Example5 \ | |
335 | examplescripts/Example6 | |
cfbba5b9 GI |
336 | |
337 | sysconf_DATA = smartd.conf | |
338 | ||
339 | # If modified smartd.conf exists install smartd.conf.sample instead | |
340 | install-sysconfDATA: $(sysconf_DATA) | |
a86ec89e | 341 | $(MKDIR_P) '$(DESTDIR)$(sysconfdir)' |
cfbba5b9 GI |
342 | @s="$(srcdir)/smartd.conf"; \ |
343 | f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \ | |
344 | if test -z "$(smartd_suffix)" && test -f "$$f"; then \ | |
345 | if cmp "$$s" "$$f" >/dev/null 2>/dev/null; then :; else \ | |
346 | echo "************************************************************"; \ | |
347 | echo "*** $$f preserved"; \ | |
348 | echo "*** installing smartd.conf.sample instead"; \ | |
349 | echo "************************************************************"; \ | |
350 | f="$$f".sample; \ | |
351 | fi; \ | |
352 | fi; \ | |
a86ec89e | 353 | echo " $(INSTALL_DATA) '$$s' '$$f'"; \ |
cfbba5b9 GI |
354 | $(INSTALL_DATA) "$$s" "$$f" |
355 | ||
356 | # If smartd.conf.sample exists preserve smartd.conf | |
357 | uninstall-sysconfDATA: | |
358 | @f="$(DESTDIR)$(sysconfdir)/smartd.conf$(smartd_suffix)"; \ | |
359 | if test -z "$(smartd_suffix)" && test -f "$$f".sample; then \ | |
360 | echo "************************************************************"; \ | |
361 | echo "*** $$f preserved"; \ | |
362 | echo "*** removing smartd.conf.sample instead"; \ | |
363 | echo "************************************************************"; \ | |
364 | f="$$f".sample; \ | |
365 | fi; \ | |
a86ec89e | 366 | echo " rm -f '$$f'"; \ |
cfbba5b9 GI |
367 | rm -f "$$f" |
368 | ||
d2e702cf | 369 | smartdscript_SCRIPTS = smartd_warning.sh |
ee38a438 | 370 | |
cfbba5b9 | 371 | EXTRA_DIST = \ |
f9e10201 | 372 | .editorconfig \ |
a7e8ffec | 373 | autogen.sh \ |
cfbba5b9 | 374 | smartd.initd.in \ |
a7e8ffec | 375 | smartd.freebsd.initd.in \ |
cfbba5b9 GI |
376 | smartd.8.in \ |
377 | smartctl.8.in \ | |
378 | smartd.conf.5.in \ | |
379 | smartd.conf \ | |
a7e8ffec | 380 | smartd.service.in \ |
ee38a438 | 381 | smartd_warning.sh.in \ |
cfbba5b9 | 382 | update-smart-drivedb.in \ |
d2e702cf | 383 | update-smart-drivedb.8.in \ |
d008864d | 384 | m4/pkg.m4 \ |
a86ec89e GI |
385 | os_darwin/com.smartmontools.smartd.plist.in \ |
386 | os_darwin/pkg/PackageInfo.in \ | |
387 | os_darwin/pkg/Distribution.in \ | |
388 | os_darwin/pkg/installer/README.html \ | |
389 | os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall \ | |
390 | os_win32/default.manifest \ | |
cfbba5b9 | 391 | os_win32/installer.nsi \ |
d008864d | 392 | os_win32/runcmd.c \ |
f9e10201 JD |
393 | os_win32/smartd_mailer.ps1 \ |
394 | os_win32/smartd_mailer.conf.sample.ps1 \ | |
ee38a438 | 395 | os_win32/smartd_warning.cmd \ |
cfbba5b9 GI |
396 | os_win32/syslogevt.mc \ |
397 | os_win32/update-smart-drivedb.nsi \ | |
398 | os_win32/wbemcli_small.h \ | |
f9e10201 | 399 | os_win32/versioninfo.rc.in \ |
ee38a438 | 400 | os_win32/wtssendmsg.c \ |
cfbba5b9 GI |
401 | $(docs_DATA) \ |
402 | $(examples_DATA) \ | |
403 | $(examples_SCRIPTS) | |
832b75ed | 404 | |
a7e8ffec | 405 | CLEANFILES = \ |
a7e8ffec GI |
406 | smartd.8 \ |
407 | smartd.1m \ | |
408 | smartd.8.html \ | |
a86ec89e | 409 | smartd.8.html.tmp \ |
f9e10201 | 410 | smartd.8.pdf \ |
a7e8ffec GI |
411 | smartd.8.txt \ |
412 | smartctl.8 \ | |
413 | smartctl.1m \ | |
414 | smartctl.8.html \ | |
a86ec89e | 415 | smartctl.8.html.tmp \ |
f9e10201 | 416 | smartctl.8.pdf \ |
a7e8ffec | 417 | smartctl.8.txt \ |
f9e10201 JD |
418 | smartd.conf.5 \ |
419 | smartd.conf.4 \ | |
a7e8ffec | 420 | smartd.conf.5.html \ |
a86ec89e | 421 | smartd.conf.5.html.tmp \ |
f9e10201 | 422 | smartd.conf.5.pdf \ |
a7e8ffec GI |
423 | smartd.conf.5.txt \ |
424 | smartd.initd \ | |
425 | smartd.freebsd.initd \ | |
426 | smartd.service \ | |
ee38a438 | 427 | smartd_warning.sh \ |
a7e8ffec GI |
428 | svnversion.h \ |
429 | update-smart-drivedb \ | |
d2e702cf GI |
430 | update-smart-drivedb.8 \ |
431 | update-smart-drivedb.1m \ | |
f9e10201 JD |
432 | update-smart-drivedb.8.html \ |
433 | update-smart-drivedb.8.html.tmp \ | |
434 | update-smart-drivedb.8.pdf \ | |
435 | update-smart-drivedb.8.txt \ | |
a7e8ffec | 436 | SMART |
832b75ed | 437 | |
2127e193 GI |
438 | # 'make maintainer-clean' also removes files generated by './autogen.sh' |
439 | MAINTAINERCLEANFILES = \ | |
440 | $(srcdir)/Makefile.in \ | |
441 | $(srcdir)/aclocal.m4 \ | |
d2e702cf | 442 | $(srcdir)/compile \ |
2127e193 GI |
443 | $(srcdir)/configure \ |
444 | $(srcdir)/config.guess \ | |
445 | $(srcdir)/config.h.in \ | |
446 | $(srcdir)/config.h.in~ \ | |
447 | $(srcdir)/config.sub \ | |
448 | $(srcdir)/depcomp \ | |
449 | $(srcdir)/install-sh \ | |
450 | $(srcdir)/missing \ | |
d008864d | 451 | $(srcdir)/m4/pkg.m4 |
2127e193 GI |
452 | |
453 | utility.o: svnversion.h | |
454 | ||
455 | if IS_SVN_BUILD | |
456 | # Get version info from SVN | |
ee38a438 | 457 | svnversion.h: ChangeLog Makefile $(svn_deps) |
a86ec89e | 458 | @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@' |
d2e702cf GI |
459 | @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@ |
460 | @(cd $(srcdir) \ | |
2127e193 GI |
461 | && svnversion 2>/dev/null | sed -n 's,^\([0-9].*\),REV "\1",p' \ |
462 | && TZ= LC_ALL=C svn info 2>/dev/null \ | |
463 | | sed -n 'h;s,^.* Date: *\([^ ]*\) .*$$,DATE "\1",p;g;s,^.* Date: *[^ ]* *\([^ ]*\) .*$$,TIME "\1",p') \ | |
464 | | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@ | |
465 | else | |
466 | ||
467 | # SVN not available, guess version info from Id strings | |
a86ec89e GI |
468 | svnversion.h: ChangeLog Makefile NEWS |
469 | @echo ' cat ChangeLog NEWS $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@' | |
d2e702cf | 470 | @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@ |
a86ec89e | 471 | @(cd $(srcdir) && cat ChangeLog NEWS Makefile.am configure.ac smart*.in *.cpp *.h) \ |
2127e193 GI |
472 | | sed -n 's,^.*\$$[I][d]: [^ ]* \([0-9][0-9]* [0-9][-0-9]* [0-9][:0-9]*\)[^:0-9][^$$]*\$$.*$$,\1,p' \ |
473 | | sort -n -r \ | |
474 | | sed -n 'h;s,^\([^ ]*\) .*$$,REV "\1",p;g;s,^[^ ]* \([^ ]*\) .*$$,DATE "\1",p;g;s,^[^ ]* [^ ]* \([^ ]*\)$$,TIME "\1",p;q' \ | |
475 | | sed 's,^,#define SMARTMONTOOLS_SVN_,' >> $@ | |
476 | endif | |
477 | ||
478 | ||
2127e193 GI |
479 | if ENABLE_DRIVEDB |
480 | drivedb_DATA = drivedb.h | |
481 | endif | |
482 | ||
7f0798ef GI |
483 | update-smart-drivedb: update-smart-drivedb.in config.status |
484 | $(SHELL) ./config.status --file=$@ | |
485 | chmod +x $@ | |
486 | ||
ee38a438 GI |
487 | smartd_warning.sh: smartd_warning.sh.in config.status |
488 | $(SHELL) ./config.status --file=$@ | |
489 | chmod +x $@ | |
7f0798ef | 490 | |
2127e193 | 491 | if INSTALL_INITSCRIPT |
832b75ed | 492 | if OS_DARWIN |
a86ec89e | 493 | initd_DATA = com.smartmontools.smartd.plist |
832b75ed GG |
494 | |
495 | initd_DATA_install = install-initdDATA-darwin | |
2127e193 | 496 | initd_DATA_uninstall = uninstall-initdDATA-darwin |
832b75ed | 497 | |
a86ec89e | 498 | com.smartmontools.smartd.plist : os_darwin/com.smartmontools.smartd.plist.in |
832b75ed GG |
499 | sed "s|/usr/sbin/|$(sbindir)/|" $< > $@ |
500 | ||
501 | install-initdDATA-darwin: $(initd_DATA) | |
a86ec89e GI |
502 | $(MKDIR_P) '$(DESTDIR)$(initddir)' |
503 | $(INSTALL_DATA) $(top_builddir)/$(initd_DATA) $(DESTDIR)$(initddir)/$(initd_DATA) | |
832b75ed | 504 | |
2127e193 | 505 | uninstall-initdDATA-darwin: |
a86ec89e | 506 | rm -f $(DESTDIR)$(initddir)/$(initd_DATA) |
2127e193 | 507 | |
832b75ed GG |
508 | else |
509 | ||
a86ec89e | 510 | initd_DATA = $(initdfile) |
832b75ed | 511 | |
a86ec89e GI |
512 | $(initdfile): $(srcdir)/$(initdfile).in Makefile |
513 | sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@ | |
832b75ed GG |
514 | |
515 | initd_install_name = smartd$(smartd_suffix) | |
516 | ||
517 | initd_DATA_install = install-initdDATA-generic | |
2127e193 | 518 | initd_DATA_uninstall = uninstall-initdDATA-generic |
832b75ed GG |
519 | |
520 | install-initdDATA-generic: $(initd_DATA) | |
a86ec89e GI |
521 | $(MKDIR_P) '$(DESTDIR)$(initddir)' |
522 | $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)' | |
2127e193 GI |
523 | |
524 | uninstall-initdDATA-generic: | |
a86ec89e | 525 | rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)' |
2127e193 GI |
526 | endif |
527 | else | |
528 | ||
529 | initd_DATA_install = install-initdDATA-null | |
530 | initd_DATA_uninstall = uninstall-initdDATA-null | |
531 | ||
532 | install-initdDATA-null: | |
533 | uninstall-initdDATA-null: | |
832b75ed GG |
534 | endif |
535 | ||
536 | install-initdDATA : $(initd_DATA_install) | |
537 | ||
2127e193 | 538 | uninstall-initdDATA: $(initd_DATA_uninstall) |
832b75ed | 539 | |
a7e8ffec GI |
540 | if INSTALL_SYSTEMDUNIT |
541 | systemdsystemunit_DATA = smartd.service | |
542 | endif | |
543 | ||
544 | smartd.service: smartd.service.in Makefile | |
a86ec89e GI |
545 | @echo ' $$(SMARTD_SERVICE_FILTER) < $(srcdir)/smartd.service.in > $@' |
546 | @{ \ | |
d2e702cf GI |
547 | sed 's|/usr/local/sbin/smartd|$(sbindir)/smartd|' | \ |
548 | if test -n '$(systemdenvfile)'; then \ | |
549 | sed 's|/usr/local/etc/sysconfig/smartmontools|$(systemdenvfile)|'; \ | |
550 | else \ | |
551 | sed -e '/^EnvironmentFile=/d' -e 's| *\$$smartd[_a-z]* *||g'; \ | |
a86ec89e | 552 | fi; } < $(srcdir)/smartd.service.in > $@ |
d2e702cf GI |
553 | |
554 | ||
555 | # Create empty directories if configured. | |
556 | # Default install rules no longer create empty directories since automake 1.11. | |
d2e702cf GI |
557 | installdirs-local: |
558 | @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \ | |
559 | test -n "$$d" || continue; \ | |
a86ec89e GI |
560 | echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \ |
561 | $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \ | |
d2e702cf GI |
562 | done |
563 | ||
564 | install-data-local: installdirs-local | |
a7e8ffec | 565 | |
d2e702cf GI |
566 | # |
567 | # Build man pages | |
568 | # | |
a86ec89e | 569 | MAN_FILTER = { \ |
ee38a438 GI |
570 | sed -e 's|CURRENT_SVN_VERSION|$(releaseversion)|g' \ |
571 | -e "s|CURRENT_SVN_DATE|`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h`|g" \ | |
572 | -e "s|CURRENT_SVN_REV|`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h`|g" \ | |
573 | -e 's|/usr/local/share/man/|$(mandir)/|g' \ | |
574 | -e 's|/usr/local/sbin/|$(sbindir)/|g' \ | |
ee38a438 GI |
575 | -e 's|/usr/local/share/doc/smartmontools/examplescripts/|!exampledir!|g' \ |
576 | -e 's|/usr/local/share/doc/smartmontools/|$(docsdir)/|g' \ | |
577 | -e 's|!exampledir!|$(exampledir)/|g' \ | |
578 | -e 's|/usr/local/etc/smartd\.conf|$(sysconfdir)/smartd.conf|g' \ | |
d2e702cf GI |
579 | -e 's|/usr/local/etc/smart_drivedb\.h|$(sysconfdir)/smart_drivedb.h|g' \ |
580 | -e 's|/usr/local/etc/smartd_warning\.sh|$(smartdscriptdir)/smartd_warning.sh|g' \ | |
581 | -e 's|\\fBmail\\fP|\\fB$(os_mailer)\\fP|g' \ | |
582 | -e 's|\\'\''mail\\'\''|\\'\''$(os_mailer)\\'\''|g' \ | |
583 | -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \ | |
a86ec89e GI |
584 | -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \ |
585 | if test -n '$(drivedbdir)'; then \ | |
586 | sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \ | |
587 | else \ | |
588 | sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \ | |
589 | fi | \ | |
590 | if test '$(with_update_smart_drivedb)' = 'yes'; then \ | |
591 | cat; \ | |
592 | else \ | |
593 | sed '/^\.\\" %IF ENABLE_UPDATE_SMART_DRIVEDB/,/^\.\\" %ENDIF ENABLE_UPDATE_SMART_DRIVEDB/ s,^,.\\"\# ,' ; \ | |
594 | fi | \ | |
595 | if test -n '$(initddir)'; then \ | |
596 | sed 's|/usr/local/etc/rc\.d/init\.d/|$(initddir)/|g' ; \ | |
597 | else \ | |
598 | sed '/^\.\\" %IF ENABLE_INITSCRIPT/,/^\.\\" %ENDIF ENABLE_INITSCRIPT/ s,^,.\\"\# ,' ; \ | |
599 | fi | \ | |
600 | if test -n '$(savestates)'; then \ | |
601 | sed 's|/usr/local/var/lib/smartmontools/smartd\.|$(savestates)|g' ; \ | |
602 | else \ | |
603 | sed '/^\.\\" %IF ENABLE_SAVESTATES/,/^\.\\" %ENDIF ENABLE_SAVESTATES/ s,^,.\\"\# ,' ; \ | |
604 | fi | \ | |
605 | if test -n '$(attributelog)'; then \ | |
606 | sed 's|/usr/local/var/lib/smartmontools/attrlog\.|$(attributelog)|g' ; \ | |
607 | else \ | |
608 | sed '/^\.\\" %IF ENABLE_ATTRIBUTELOG/,/^\.\\" %ENDIF ENABLE_ATTRIBUTELOG/ s,^,.\\"\# ,' ; \ | |
609 | fi | \ | |
d2e702cf GI |
610 | if test -n '$(smartdplugindir)'; then \ |
611 | sed 's|/usr/local/etc/smartd_warning\.d|$(smartdplugindir)|g' ; \ | |
612 | else \ | |
613 | sed '/^\.\\" %IF ENABLE_SMARTDPLUGINDIR/,/^\.\\" %ENDIF ENABLE_SMARTDPLUGINDIR/ s,^,.\\"\# ,' ; \ | |
614 | fi | \ | |
a86ec89e GI |
615 | if test -n '$(CAPNG_LDADD)'; then \ |
616 | cat; \ | |
617 | else \ | |
618 | sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \ | |
619 | fi | \ | |
620 | if test '$(with_nvme_devicescan)' = 'yes'; then \ | |
621 | cat; \ | |
622 | else \ | |
623 | sed '/^\.\\" %IF ENABLE_NVME_DEVICESCAN/,/^\.\\" %ENDIF ENABLE_NVME_DEVICESCAN/ s,^,.\\"\# ,' ; \ | |
624 | fi | \ | |
d008864d GI |
625 | if test -n '$(os_man_filter)'; then \ |
626 | sed -e 's,OS_MAN_FILTER,$(os_man_filter),g' \ | |
627 | -e '/^\.\\" %IF NOT OS .*$(os_man_filter)/,/^.\\" %ENDIF NOT OS .*$(os_man_filter)/ s,^,.\\"\# ,' \ | |
628 | -e '/^\.\\" %IF OS .*$(os_man_filter)/,/^\.\\" %ENDIF OS .*$(os_man_filter)/ s,^,!!,' \ | |
629 | -e '/^\.\\" %IF OS ./,/^\.\\" %ENDIF OS ./ s,^,.\\"\# ,' \ | |
630 | -e '/^!*\.\\" %IF NOT OS ./,/^!*\.\\" %ENDIF NOT OS ./ s,^,!!,' \ | |
631 | -e 's,^!!!*\.\\"! \(.*\)$$,\1 \\"\#,' \ | |
632 | -e 's,^!!!*,,' ; \ | |
633 | else \ | |
634 | cat; \ | |
a86ec89e | 635 | fi; } |
a23d5117 | 636 | |
7f0798ef GI |
637 | # Implicit rule 'smart%: smart%.in ...' does not work with BSD make |
638 | smartctl.8: smartctl.8.in Makefile svnversion.h | |
a86ec89e GI |
639 | @echo ' $$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@' |
640 | @$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@ | |
7f0798ef GI |
641 | |
642 | smartd.8: smartd.8.in Makefile svnversion.h | |
a86ec89e GI |
643 | @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@' |
644 | @$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@ | |
7f0798ef GI |
645 | |
646 | smartd.conf.5: smartd.conf.5.in Makefile svnversion.h | |
a86ec89e GI |
647 | @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@' |
648 | @$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@ | |
d2e702cf GI |
649 | |
650 | update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h | |
a86ec89e GI |
651 | @echo ' $$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@' |
652 | @$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@ | |
d2e702cf GI |
653 | |
654 | # Build Solaris specific man pages | |
655 | SOLARIS_MAN_FILTER = \ | |
656 | sed -e '/^\.TH/s, \([58]\) , !!\1!! ,' \ | |
657 | -e '/^\.BR/s, (\([578]\)), (!!\1!!),' \ | |
658 | -e 's,\\fP(\([578]\)),\\fP(!!\1!!),g' \ | |
659 | -e 's,!!5!!,4,g' -e 's,!!7!!,5,g' -e 's,!!8!!,1m,g' \ | |
660 | -e 's,/var/log/messages,/var/adm/messages,g' | |
661 | ||
662 | smartctl.1m: smartctl.8 | |
a86ec89e GI |
663 | @echo ' $$(SOLARIS_MAN_FILTER) < smartctl.8 > $@' |
664 | @$(SOLARIS_MAN_FILTER) < smartctl.8 > $@ | |
d2e702cf GI |
665 | |
666 | smartd.1m: smartd.8 | |
a86ec89e GI |
667 | @echo ' $$(SOLARIS_MAN_FILTER) < smartd.8 > $@' |
668 | @$(SOLARIS_MAN_FILTER) < smartd.8 > $@ | |
d2e702cf GI |
669 | |
670 | smartd.conf.4: smartd.conf.5 | |
a86ec89e GI |
671 | @echo ' $$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@' |
672 | @$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@ | |
d2e702cf GI |
673 | |
674 | update-smart-drivedb.1m: update-smart-drivedb.8 | |
a86ec89e GI |
675 | @echo ' $$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@' |
676 | @$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@ | |
d2e702cf | 677 | |
832b75ed | 678 | |
f9e10201 | 679 | # Convert man pages into .html, .pdf and .txt |
832b75ed GG |
680 | # TODO: configure |
681 | MAN2HTML = man2html | |
682 | #MAN2HTML = groff -man -Thtml | |
f9e10201 JD |
683 | MAN2PDF = man -Tpdf -l |
684 | #MAN2PDF = groff -man -Tpdf | |
832b75ed GG |
685 | MAN2TXT = groff -man -Tascii -P'-bcou' |
686 | ||
4d59bff9 | 687 | # Remove HTTP header and fix links in man2html output |
ee38a438 GI |
688 | FIXHTML = sed -e '1s,^Content-type.*,,' \ |
689 | -e 's,<A HREF="[^"]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \ | |
690 | -e 's,<A HREF="[^"]*/man2html">,<A HREF=".">,g' \ | |
691 | -e 's,<A HREF="[^"]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \ | |
692 | -e 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g' | |
832b75ed | 693 | |
f9e10201 | 694 | htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html update-smart-drivedb.8.html |
832b75ed | 695 | |
f9e10201 | 696 | pdfman: smartctl.8.pdf smartd.8.pdf smartd.conf.5.pdf update-smart-drivedb.8.pdf |
832b75ed | 697 | |
f9e10201 | 698 | txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt update-smart-drivedb.8.txt |
832b75ed | 699 | |
4d59bff9 | 700 | %.5.html: %.5 |
a86ec89e GI |
701 | $(MAN2HTML) $< > $@.tmp |
702 | @echo ' $$(FIXHTML) < $@.tmp > $@' | |
703 | @$(FIXHTML) < $@.tmp > $@ | |
4d59bff9 GG |
704 | |
705 | %.8.html: %.8 | |
a86ec89e GI |
706 | $(MAN2HTML) $< > $@.tmp |
707 | @echo ' $$(FIXHTML) < $@.tmp > $@' | |
708 | @$(FIXHTML) < $@.tmp > $@ | |
832b75ed | 709 | |
f9e10201 JD |
710 | %.5.pdf: %.5 |
711 | $(MAN2PDF) $< > $@ | |
712 | ||
713 | %.8.pdf: %.8 | |
714 | $(MAN2PDF) $< > $@ | |
715 | ||
832b75ed GG |
716 | %.5.txt: %.5 |
717 | $(MAN2TXT) $< > $@ | |
718 | ||
719 | %.8.txt: %.8 | |
720 | $(MAN2TXT) $< > $@ | |
721 | ||
722 | ||
a23d5117 GI |
723 | # Check drive database syntax |
724 | check: | |
725 | @if ./smartctl -B $(srcdir)/drivedb.h -P showall >/dev/null; then \ | |
726 | echo "$(srcdir)/drivedb.h: OK"; \ | |
727 | else \ | |
728 | echo "$(srcdir)/drivedb.h: Syntax check failed"; exit 1; \ | |
729 | fi | |
730 | ||
832b75ed GG |
731 | |
732 | if OS_WIN32_MINGW | |
ee38a438 GI |
733 | # Windows resources |
734 | ||
f9e10201 JD |
735 | smartctl_res.o: smartctl_res.rc $(os_win32_manifest) |
736 | $(WINDRES) $< $@ | |
737 | ||
738 | smartd_res.o: smartd_res.rc syslogevt.rc $(os_win32_manifest) | |
ee38a438 GI |
739 | $(WINDRES) $< $@ |
740 | ||
f9e10201 JD |
741 | runcmda_res.o: runcmda_res.rc defadmin.manifest |
742 | $(WINDRES) $< $@ | |
743 | ||
744 | runcmdu_res.o: runcmdu_res.rc $(os_win32_manifest) | |
745 | $(WINDRES) $< $@ | |
746 | ||
747 | wtssendmsg_res.o: wtssendmsg_res.rc $(os_win32_manifest) | |
748 | $(WINDRES) $< $@ | |
ee38a438 | 749 | |
f9e10201 JD |
750 | # Convert version for VERSIONINFO resource: 6.6 r4519 -> 6.6.0.4519, |
751 | # set description, name, version and year | |
a86ec89e GI |
752 | WIN_RC_FILTER = { \ |
753 | ver=`echo '$(PACKAGE_VERSION).0' | sed -n 's,^\([0-9]*\.[0-9]*\.[0-9]*\).*$$,\1,p'` && \ | |
754 | rev=`sed -n 's,^.*REV[^"]*"\([0-9]*\).*$$,\1,p' svnversion.h` && \ | |
755 | txtver="$${ver:-0.0.0}.$${rev:-0}" && binver=`echo "$$txtver" | sed 's|\.|,|g'` && \ | |
756 | yy=`sed -n 's,^.*DATE[^"]*"20\([0-9][0-9]\).*$$,\1,p' svnversion.h` && yy="$${yy:-XX}" && \ | |
f9e10201 JD |
757 | sed -e "s|@DESC@|$$d|" -e "s|@NAME@|$$n|" -e "s|@BINARY_VERSION@|$$binver|g" \ |
758 | -e "s|@TEXT_VERSION@|$$txtver|g" -e "s|@YY@|$$yy|g"; } | |
ee38a438 | 759 | |
f9e10201 JD |
760 | WIN_MAKE_RES = \ |
761 | echo "n=$$n d=\"$$d"'"; $$(WIN_RC_FILTER) < $< > $@'; \ | |
762 | $(WIN_RC_FILTER) < $< > $@ | |
ee38a438 | 763 | |
f9e10201 JD |
764 | WIN_APP_MANIFEST = \ |
765 | if test -n '$(os_win32_manifest)'; then \ | |
766 | echo "echo '1 24 \"$(srcdir)/$(os_win32_manifest)\"' >> $@"; \ | |
767 | echo '1 24 "$(srcdir)/$(os_win32_manifest)"' >> $@; \ | |
768 | fi | |
ee38a438 | 769 | |
f9e10201 JD |
770 | smartctl_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h |
771 | @n=smartctl d="Control and Monitor Utility for SMART Disks"; $(WIN_MAKE_RES) | |
772 | @$(WIN_APP_MANIFEST) | |
773 | ||
774 | smartd_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h | |
775 | @n=smartd d="SMART Disk Monitoring Daemon"; $(WIN_MAKE_RES) | |
776 | echo '#include "./syslogevt.rc"' >> $@ | |
777 | @$(WIN_APP_MANIFEST) | |
ee38a438 | 778 | |
f9e10201 JD |
779 | runcmdu_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h |
780 | @n=runcmdu d="Run console command"; $(WIN_MAKE_RES) | |
781 | @$(WIN_APP_MANIFEST) | |
a86ec89e | 782 | |
f9e10201 JD |
783 | runcmda_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h |
784 | @n=runcmda d="Run console command as admin"; $(WIN_MAKE_RES) | |
785 | echo '1 24 "./defadmin.manifest"' >> $@ | |
a86ec89e | 786 | |
f9e10201 JD |
787 | wtssendmsg_res.rc: os_win32/versioninfo.rc.in Makefile svnversion.h |
788 | @n=wtssendmsg d="Send console messages"; $(WIN_MAKE_RES) | |
789 | @$(WIN_APP_MANIFEST) | |
790 | ||
791 | syslogevt.rc: os_win32/syslogevt.mc | |
792 | $(WINDMC) -b $< | |
a86ec89e GI |
793 | |
794 | defadmin.manifest: os_win32/default.manifest | |
795 | sed 's,"asInvoker","requireAdministrator",' $< > $@ | |
796 | ||
832b75ed GG |
797 | # Definitions for Windows distribution |
798 | ||
7f0798ef GI |
799 | if OS_WIN64 |
800 | win_bits = 64 | |
801 | else | |
802 | win_bits = 32 | |
803 | endif | |
804 | ||
805 | distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits) | |
806 | distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip | |
807 | distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe | |
832b75ed GG |
808 | |
809 | exedir_win32 = $(distdir_win32)/bin | |
810 | docdir_win32 = $(distdir_win32)/doc | |
811 | ||
cfbba5b9 GI |
812 | EXEFILES_WIN32 = \ |
813 | $(exedir_win32)/smartctl.exe \ | |
814 | $(exedir_win32)/smartctl-nc.exe \ | |
d008864d | 815 | $(exedir_win32)/smartd.exe \ |
f9e10201 JD |
816 | $(exedir_win32)/smartd_mailer.ps1 \ |
817 | $(exedir_win32)/smartd_mailer.conf.sample.ps1 \ | |
ee38a438 | 818 | $(exedir_win32)/smartd_warning.cmd \ |
d008864d | 819 | $(exedir_win32)/runcmda.exe \ |
ee38a438 GI |
820 | $(exedir_win32)/runcmdu.exe \ |
821 | $(exedir_win32)/wtssendmsg.exe | |
cfbba5b9 GI |
822 | |
823 | if ENABLE_DRIVEDB | |
824 | if OS_WIN32_NSIS | |
825 | EXEFILES_WIN32 += \ | |
826 | $(exedir_win32)/update-smart-drivedb.exe | |
827 | endif | |
828 | endif | |
829 | ||
830 | FILES_WIN32 = \ | |
831 | $(EXEFILES_WIN32) \ | |
832 | $(docdir_win32)/AUTHORS.txt \ | |
ee38a438 GI |
833 | $(docdir_win32)/ChangeLog.txt \ |
834 | $(docdir_win32)/ChangeLog-5.0-6.0.txt \ | |
cfbba5b9 GI |
835 | $(docdir_win32)/COPYING.txt \ |
836 | $(docdir_win32)/INSTALL.txt \ | |
837 | $(docdir_win32)/NEWS.txt \ | |
838 | $(docdir_win32)/README.txt \ | |
839 | $(docdir_win32)/TODO.txt \ | |
f4e463df | 840 | $(docdir_win32)/checksums$(win_bits).txt \ |
cfbba5b9 GI |
841 | $(docdir_win32)/smartd.conf \ |
842 | $(docdir_win32)/smartctl.8.html \ | |
f9e10201 | 843 | $(docdir_win32)/smartctl.8.pdf \ |
cfbba5b9 | 844 | $(docdir_win32)/smartd.8.html \ |
f9e10201 | 845 | $(docdir_win32)/smartd.8.pdf \ |
cfbba5b9 | 846 | $(docdir_win32)/smartd.conf.5.html \ |
f9e10201 | 847 | $(docdir_win32)/smartd.conf.5.pdf |
cfbba5b9 GI |
848 | |
849 | if ENABLE_DRIVEDB | |
850 | FILES_WIN32 += \ | |
851 | $(exedir_win32)/drivedb.h | |
852 | endif | |
853 | ||
854 | CLEANFILES += \ | |
855 | $(FILES_WIN32) \ | |
a86ec89e GI |
856 | defadmin.manifest \ |
857 | distdir.mkdir \ | |
f9e10201 JD |
858 | runcmda.exe runcmda_res.rc \ |
859 | runcmdu.exe runcmdu_res.rc \ | |
cfbba5b9 | 860 | smartctl-nc.exe smartctl-nc.exe.tmp \ |
a86ec89e GI |
861 | smartctl_res.rc smartd_res.rc \ |
862 | syslogevt.h \ | |
ee38a438 | 863 | syslogevt.rc syslogevt_*.bin \ |
cfbba5b9 | 864 | update-smart-drivedb.exe \ |
f9e10201 | 865 | wtssendmsg.exe wtssendmsg_res.rc |
832b75ed | 866 | |
a86ec89e | 867 | # Note: Only use without options to be compatible with all variants |
7f0798ef | 868 | UNIX2DOS = unix2dos |
832b75ed GG |
869 | |
870 | # Build Windows distribution | |
871 | ||
872 | dist-win32: $(distzip_win32) | |
873 | ||
4d59bff9 GG |
874 | install-win32: $(distinst_win32) |
875 | ./$(distinst_win32) | |
876 | ||
877 | installer-win32: $(distinst_win32) | |
878 | ||
cfbba5b9 | 879 | distdir-win32: distdir.mkdir $(FILES_WIN32) |
832b75ed | 880 | |
cfbba5b9 | 881 | $(distzip_win32): distdir.mkdir $(FILES_WIN32) |
832b75ed | 882 | @rm -fv $(distzip_win32) |
cfbba5b9 GI |
883 | cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/* |
884 | md5sum $@ > $@.md5 | |
885 | sha1sum $@ > $@.sha1 | |
886 | sha256sum $@ > $@.sha256 | |
832b75ed | 887 | |
cfbba5b9 GI |
888 | if OS_WIN32_NSIS |
889 | # Build NSIS installer | |
7f0798ef | 890 | # Note: Only option character '-' is also compatible with Linux version of makensis |
cfbba5b9 | 891 | $(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) |
f4e463df | 892 | test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 ) |
a86ec89e GI |
893 | @date=`sed -n 's,^.*DATE[^"]*"\([^"]*\)".*$$,\1,p' svnversion.h` && \ |
894 | rev=`sed -n 's,^.*REV[^"]*"\([^"]*\)".*$$,r\1,p' svnversion.h` && \ | |
895 | verstr="$(PACKAGE_VERSION) $$date $$rev "$(BUILD_INFO) && \ | |
896 | d64= && if [ -n '$(builddir_win64)' ]; then d64='-DINPDIR64=$(builddir_win64)/$(PACKAGE)-$(VERSION).win64'; fi && \ | |
897 | echo "'$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR='$$verstr' $<" && \ | |
f4e463df | 898 | '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $< |
cfbba5b9 GI |
899 | md5sum $@ > $@.md5 |
900 | sha1sum $@ > $@.sha1 | |
901 | sha256sum $@ > $@.sha256 | |
902 | ||
903 | # Build drivedb.h update tool | |
904 | update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi | |
905 | "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $< | |
906 | ||
907 | else | |
908 | $(distinst_win32): | |
909 | @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2 | |
910 | @exit 1 | |
911 | endif | |
4d59bff9 | 912 | |
832b75ed | 913 | cleandist-win32: |
cfbba5b9 | 914 | rm -rf $(distdir_win32) distdir.mkdir |
832b75ed GG |
915 | |
916 | distdir.mkdir: | |
917 | @test -d $(exedir_win32) || mkdir -pv $(exedir_win32) | |
918 | @test -d $(docdir_win32) || mkdir -pv $(docdir_win32) | |
919 | touch $@ | |
920 | ||
832b75ed GG |
921 | $(exedir_win32)/%.exe: %.exe |
922 | cp -p $< $@ | |
7f0798ef | 923 | if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi |
832b75ed GG |
924 | touch -r $< $@ |
925 | ||
cfbba5b9 GI |
926 | # strip would break NSIS integrity check |
927 | $(exedir_win32)/update-smart-drivedb.exe: update-smart-drivedb.exe | |
928 | cp -p $< $@ | |
929 | ||
930 | $(exedir_win32)/%.h: $(srcdir)/%.h | |
931 | $(UNIX2DOS) < $< > $@ | |
932 | touch -r $< $@ | |
933 | ||
ee38a438 GI |
934 | $(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd |
935 | $(UNIX2DOS) < $< > $@ | |
936 | touch -r $< $@ | |
937 | ||
f9e10201 | 938 | $(exedir_win32)/%.ps1: $(srcdir)/os_win32/%.ps1 |
ba59cff1 GG |
939 | $(UNIX2DOS) < $< > $@ |
940 | touch -r $< $@ | |
941 | ||
f9e10201 | 942 | $(docdir_win32)/%.html: %.html |
832b75ed GG |
943 | $(UNIX2DOS) < $< > $@ |
944 | touch -r $< $@ | |
945 | ||
f9e10201 JD |
946 | $(docdir_win32)/%.pdf: %.pdf |
947 | cp -p $< $@ | |
948 | ||
832b75ed GG |
949 | $(docdir_win32)/%.txt: $(srcdir)/% |
950 | $(UNIX2DOS) < $< > $@ | |
951 | touch -r $< $@ | |
952 | ||
953 | $(docdir_win32)/%.conf: $(srcdir)/%.conf | |
954 | $(UNIX2DOS) < $< > $@ | |
955 | touch -r $< $@ | |
956 | ||
f4e463df | 957 | $(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32) |
cfbba5b9 GI |
958 | (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \ |
959 | | $(UNIX2DOS) > $@ | |
960 | ||
2127e193 GI |
961 | # Build non-console version of smartctl for GSmartControl. |
962 | # The script below changes the word at offset 220 (Subsystem) from 3 | |
963 | # (Console) to 2 (GUI) in a copy of smartctl.exe. | |
964 | # This will be changed when a tool (like 'editbin') is available in | |
965 | # the Cygwin distribution | |
966 | smartctl-nc.exe: smartctl.exe | |
967 | @rm -f $@ | |
968 | cp -p smartctl.exe $@.tmp | |
969 | @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 3; then :; \ | |
970 | else echo "invalid EXE header"; exit 1; fi | |
971 | @echo "editbin /subsystem:windows $@.tmp" | |
972 | @echo -ne '\002' | dd bs=1 seek=220 count=1 conv=notrunc of=$@.tmp 2>/dev/null | |
973 | @if test `od -A n -j 220 -N 2 -d $@.tmp` -eq 2; then :; \ | |
974 | else echo "EXE patch failed"; exit 1; fi | |
975 | mv -f $@.tmp $@ | |
976 | ||
ee38a438 | 977 | # Build runcmd?.exe and wtssendmsg.exe |
a86ec89e GI |
978 | runcmd.o: os_win32/runcmd.c |
979 | $(CC) -c -Os $< | |
980 | ||
f9e10201 | 981 | runcmdu.exe: runcmd.o runcmdu_res.o |
a86ec89e | 982 | $(CC) -o $@ $^ |
d008864d | 983 | |
f9e10201 | 984 | runcmda.exe: runcmd.o runcmda_res.o |
a86ec89e GI |
985 | $(CC) -o $@ $^ |
986 | ||
f9e10201 JD |
987 | wtssendmsg.exe: os_win32/wtssendmsg.c wtssendmsg_res.o |
988 | $(CC) -Os -o $@ $^ -lwtsapi32 | |
cfbba5b9 | 989 | |
f9e10201 | 990 | # Build os_win32/vc14/{config.h,smart*.rc,svnversion.h} for MSVC14 from MinGW files |
cfbba5b9 | 991 | |
f9e10201 | 992 | vcver = 14 |
2127e193 | 993 | |
f9e10201 JD |
994 | CONFIG_VC_FILES = \ |
995 | $(srcdir)/os_win32/vc$(vcver)/config.h \ | |
996 | $(srcdir)/os_win32/vc$(vcver)/smartctl_res.rc \ | |
997 | $(srcdir)/os_win32/vc$(vcver)/smartd_res.rc \ | |
998 | $(srcdir)/os_win32/vc$(vcver)/svnversion.h | |
2127e193 | 999 | |
f9e10201 | 1000 | config-vc$(vcver): $(CONFIG_VC_FILES) |
ee38a438 | 1001 | |
f9e10201 JD |
1002 | $(srcdir)/os_win32/vc$(vcver)/config.h: config.h Makefile |
1003 | sed -e '1i/* os_win32/vc$(vcver)/config.h. Generated from config.h by Makefile. */' \ | |
1004 | -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|[DK_]*NTDDDISK_H\|STRINGS_H\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */ /* VC$(vcver) */,' \ | |
1005 | -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc$(vcver),' $< > $@ | |
ee38a438 | 1006 | |
f9e10201 | 1007 | $(srcdir)/os_win32/vc$(vcver)/svnversion.h: svnversion.h |
d008864d | 1008 | cp $< $@ |
832b75ed | 1009 | |
f9e10201 JD |
1010 | $(srcdir)/os_win32/vc$(vcver)/smartctl_res.rc: smartctl_res.rc |
1011 | sed '/^1 24 /d' $< > $@ | |
1012 | ||
1013 | $(srcdir)/os_win32/vc$(vcver)/smartd_res.rc: smartd_res.rc | |
1014 | sed '/^1 24 /d' $< > $@ | |
1015 | ||
1016 | clean-vc$(vcver): | |
1017 | rm -f $(srcdir)/os_win32/vc$(vcver)/smartmontools.VC.VC.opendb | |
1018 | rm -f $(srcdir)/os_win32/vc$(vcver)/smartmontools.VC.db | |
1019 | rm -f $(srcdir)/os_win32/vc$(vcver)/syslogevt.h | |
1020 | rm -rf $(srcdir)/os_win32/vc$(vcver)/Debug | |
1021 | rm -rf $(srcdir)/os_win32/vc$(vcver)/Release | |
1022 | rm -rf $(srcdir)/os_win32/vc$(vcver)/x64 | |
1023 | ||
1024 | distclean-vc$(vcver): clean-vc$(vcver) | |
1025 | rm -f $(CONFIG_VC_FILES) | |
1026 | ||
1027 | maintainer-clean-vc$(vcver): distclean-vc$(vcver) | |
1028 | rm -rf $(srcdir)/os_win32/vc$(vcver)/.vs | |
1029 | ||
832b75ed | 1030 | endif |
f9e10201 JD |
1031 | |
1032 | ||
a86ec89e GI |
1033 | if OS_DARWIN |
1034 | # Definitions for OSX distribution | |
1035 | distdir_darwin = $(PACKAGE)-$(VERSION).darwin | |
1036 | dmg_darwin = $(PACKAGE)-$(VERSION).dmg | |
1037 | pkg_darwin = $(PACKAGE)-$(VERSION).pkg | |
1038 | ||
1039 | # build darwin installer | |
1040 | $(pkg_darwin): | |
1041 | ${MAKE} install DESTDIR=$(distdir_darwin)/root | |
1042 | @cp $(srcdir)/os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall $(distdir_darwin)/root$(sbindir) | |
1043 | @mkdir -p $(distdir_darwin)/pkg | |
1044 | @( cd $(distdir_darwin)/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > $(distdir_darwin)/pkg/Payload | |
1045 | PAYLOAD_FILES=`find $(distdir_darwin)/root | wc -l` &&\ | |
1046 | PAYLOAD_SIZEKB=`du -BK -s $(distdir_darwin)/root|${AWK} '{print $$1}'|tr -d 'K'` &&\ | |
1047 | sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" \ | |
1048 | -e "s|@size@|$${PAYLOAD_SIZEKB}|" $(srcdir)/os_darwin/pkg/PackageInfo.in \ | |
1049 | > $(distdir_darwin)/pkg/PackageInfo &&\ | |
1050 | sed -e "s|@version@|$(VERSION)|" -e "s|@files@|$${PAYLOAD_FILES}|" -e "s|@size@|$${PAYLOAD_SIZEKB}|" \ | |
1051 | -e "s|@pkgname@|$(pkg_darwin)|" \ | |
1052 | $(srcdir)/os_darwin/pkg/Distribution.in > $(distdir_darwin)/pkg/Distribution | |
1053 | @mkdir -p $(distdir_darwin)/pkg/Resources/English.lproj | |
1054 | @cp $(srcdir)/COPYING $(distdir_darwin)/pkg/Resources/English.lproj/license.txt | |
1055 | @mkbom -u 0 -g 80 $(distdir_darwin)/root $(distdir_darwin)/pkg/Bom | |
1056 | @mkdir -p $(distdir_darwin)/dmg | |
1057 | @( cd $(distdir_darwin)/pkg && xar --compression none -cf "../dmg/$(pkg_darwin)" * ) | |
1058 | ||
1059 | # build darwon dmg image | |
1060 | $(dmg_darwin): | |
1061 | @cp $(srcdir)/os_darwin/pkg/installer/README.html $(distdir_darwin)/dmg | |
1062 | @mkisofs -V 'smartmontools' -no-pad -r -apple -o $(distdir_darwin)/smartmontools-$(VERSION).iso \ | |
1063 | -hfs-bless "$(distdir_darwin)/dmg/" "$(distdir_darwin)/dmg/" | |
1064 | @dmg dmg $(distdir_darwin)/smartmontools-$(VERSION).iso $(dmg_darwin) | |
1065 | md5sum $@ > $@.md5 | |
1066 | sha1sum $@ > $@.sha1 | |
1067 | sha256sum $@ > $@.sha256 | |
1068 | ||
1069 | install-darwin: install-darwin-cleanup $(pkg_darwin) $(dmg_darwin) | |
1070 | ||
1071 | install-darwin-cleanup: | |
1072 | @rm -rf $(distdir_darwin) | |
1073 | endif |