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