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