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