]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - Makefile.am
Merge branch 'upstream' of git.debian.org:/git/collab-maint/smartmontools into upstream
[mirror_smartmontools-debian.git] / Makefile.am
CommitLineData
832b75ed
GG
1## Process this file with automake to produce Makefile.in
2#
17d0b8d9 3<<<<<<< HEAD
a86ec89e 4# $Id: Makefile.am 4299 2016-04-16 19:45:57Z chrfranke $
17d0b8d9 5=======
3d8ad6fa 6# $Id: Makefile.am 4102 2015-06-01 19:25:47Z chrfranke $
17d0b8d9 7>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
832b75ed
GG
8#
9
10@SET_MAKE@
11
ee38a438 12ACLOCAL_AMFLAGS = -I m4
d008864d 13
4d59bff9
GG
14# Make sure .cpp takes precedence to avoid compiling old .c file
15SUFFIXES = .cpp .c .s .o
16
2127e193
GI
17# BUILD_INFO can be provided by package maintainers (see INSTALL file)
18BUILD_INFO= "(local build)"
4d59bff9 19
d2e702cf
GI
20AM_CPPFLAGS = \
21 -DBUILD_INFO='$(BUILD_INFO)' \
22 -DSMARTMONTOOLS_SYSCONFDIR='"$(sysconfdir)"' \
23 -DSMARTMONTOOLS_SMARTDSCRIPTDIR='"$(smartdscriptdir)"'
24
2127e193
GI
25if ENABLE_DRIVEDB
26AM_CPPFLAGS += -DSMARTMONTOOLS_DRIVEDBDIR='"$(drivedbdir)"'
27endif
28if ENABLE_SAVESTATES
29AM_CPPFLAGS += -DSMARTMONTOOLS_SAVESTATES='"$(savestates)"'
30endif
31if ENABLE_ATTRIBUTELOG
32AM_CPPFLAGS += -DSMARTMONTOOLS_ATTRIBUTELOG='"$(attributelog)"'
33endif
832b75ed 34
d008864d
GI
35if OS_WIN32_MINGW
36AM_CPPFLAGS += -I$(srcdir)/os_win32
37endif
e9583e0c
GI
38if NEED_GETOPT_LONG
39AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
40endif
41if NEED_REGEX
42AM_CPPFLAGS += -I$(srcdir)/regex
43endif
44
ee38a438
GI
45sbin_PROGRAMS = \
46 smartctl \
47 smartd
832b75ed 48
a86ec89e 49if ENABLE_UPDATE_SMART_DRIVEDB
cfbba5b9
GI
50if OS_WIN32_MINGW
51else
7f0798ef
GI
52sbin_SCRIPTS = update-smart-drivedb
53endif
cfbba5b9 54endif
7f0798ef
GI
55
56
ee38a438
GI
57smartctl_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 \
a86ec89e
GI
77 nvmecmds.cpp \
78 nvmecmds.h \
79 nvmeprint.cpp \
80 nvmeprint.h \
ee38a438
GI
81 scsicmds.cpp \
82 scsicmds.h \
83 scsiata.cpp \
84 scsiprint.cpp \
85 scsiprint.h \
86 utility.cpp \
87 utility.h
88
a86ec89e
GI
89smartctl_LDADD = $(os_deps) $(os_libs)
90smartctl_DEPENDENCIES = $(os_deps)
ee38a438
GI
91
92EXTRA_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 \
ee38a438
GI
107 os_win32.cpp \
108 os_generic.cpp \
109 os_generic.h \
d2e702cf 110 aacraid.h \
ee38a438
GI
111 cciss.cpp \
112 cciss.h \
113 cissio_freebsd.h \
114 dev_areca.cpp \
115 dev_areca.h \
116 dev_legacy.cpp \
a86ec89e 117 linux_nvme_ioctl.h \
ee38a438
GI
118 megaraid.h
119
120if OS_WIN32_MINGW
121
a86ec89e
GI
122smartctl_LDADD += smartctl_res.o $(os_win32_manifest)
123smartctl_DEPENDENCIES += smartctl_res.o $(os_win32_manifest)
ee38a438
GI
124
125endif
126
127
128smartd_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 \
a86ec89e
GI
143 nvmecmds.cpp \
144 nvmecmds.h \
ee38a438
GI
145 scsicmds.cpp \
146 scsicmds.h \
147 scsiata.cpp \
148 utility.cpp \
149 utility.h
832b75ed 150
a86ec89e
GI
151smartd_LDADD = $(os_deps) $(os_libs) $(CAPNG_LDADD)
152smartd_DEPENDENCIES = $(os_deps)
4d59bff9 153
ee38a438
GI
154EXTRA_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 \
ee38a438
GI
169 os_win32.cpp \
170 os_generic.cpp \
171 os_generic.h \
d2e702cf 172 aacraid.h \
ee38a438
GI
173 cciss.cpp \
174 cciss.h \
175 cissio_freebsd.h \
176 dev_areca.cpp \
177 dev_areca.h \
178 dev_legacy.cpp \
a86ec89e
GI
179 linux_nvme_ioctl.h \
180 freebsd_nvme_ioctl.h \
ee38a438 181 megaraid.h
832b75ed
GG
182
183if OS_WIN32_MINGW
184
e9583e0c
GI
185smartd_SOURCES += \
186 os_win32/daemon_win32.cpp \
187 os_win32/daemon_win32.h \
e9583e0c
GI
188 os_win32/syslog_win32.cpp \
189 os_win32/syslog.h
832b75ed 190
a86ec89e
GI
191smartd_LDADD += smartd_res.o $(os_win32_manifest)
192smartd_DEPENDENCIES += smartd_res.o $(os_win32_manifest)
2127e193 193
ee38a438 194endif
4d59bff9 195
a86ec89e
GI
196# Exclude from source tarball
197nodist_EXTRA_smartctl_SOURCES = os_solaris_ata.s
198nodist_EXTRA_smartd_SOURCES = os_solaris_ata.s
832b75ed 199
e9583e0c
GI
200if NEED_GETOPT_LONG
201
202smartctl_SOURCES += \
203 getopt/getopt.c \
204 getopt/getopt.h \
205 getopt/getopt1.c
832b75ed 206
e9583e0c
GI
207smartd_SOURCES += \
208 getopt/getopt.c \
209 getopt/getopt.h \
210 getopt/getopt1.c
211
212endif
213
214if NEED_REGEX
215
216smartctl_SOURCES += \
217 regex/regex.c \
218 regex/regex.h \
219 regex/regex_internal.h
220
221smartd_SOURCES += \
222 regex/regex.c \
223 regex/regex.h \
224 regex/regex_internal.h
832b75ed
GG
225
226# Included by regex.c:
e9583e0c
GI
227EXTRA_smartctl_SOURCES += \
228 regex/regcomp.c \
229 regex/regexec.c \
230 regex/regex_internal.c
231
232EXTRA_smartd_SOURCES += \
233 regex/regcomp.c \
234 regex/regexec.c \
235 regex/regex_internal.c
832b75ed
GG
236
237endif
238
cfbba5b9
GI
239if OS_WIN32
240
241smartctl_SOURCES += \
242 csmisas.h \
243 os_win32/wmiquery.cpp \
244 os_win32/wmiquery.h
245
246smartd_SOURCES += \
247 csmisas.h \
248 os_win32/wmiquery.cpp \
249 os_win32/wmiquery.h
250
251smartctl_LDADD += -lole32 -loleaut32
252smartd_LDADD += -lole32 -loleaut32
253
254endif
255
832b75ed
GG
256if 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.
262extra_MANS = smartd.conf.4 \
263 smartctl.1m \
264 smartd.1m
a86ec89e 265if ENABLE_UPDATE_SMART_DRIVEDB
d2e702cf
GI
266extra_MANS += update-smart-drivedb.1m
267endif
268
269all-local: $(extra_MANS)
832b75ed
GG
270install-man: $(extra_MANS)
271 @$(NORMAL_INSTALL)
17d0b8d9 272<<<<<<< HEAD
a86ec89e
GI
273 $(MKDIR_P) '$(DESTDIR)$(mandir)/man4'
274 $(MKDIR_P) '$(DESTDIR)$(mandir)/man1m'
17d0b8d9 275=======
3d8ad6fa
JD
276 $(mkinstalldirs) '$(DESTDIR)$(mandir)/man4'
277 $(mkinstalldirs) '$(DESTDIR)$(mandir)/man1m'
17d0b8d9 278>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
832b75ed
GG
279 for i in $(extra_MANS); do \
280 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
281 else file=$$i; fi; \
282 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
283 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
284 inst=`echo $$inst | sed -e 's/^.*\///'`; \
285 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
a86ec89e
GI
286 echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
287 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
832b75ed
GG
288 done
289uninstall-man:
290 @$(NORMAL_UNINSTALL)
291 for i in $(extra_MANS); do \
292 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
293 else file=$$i; fi; \
294 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
295 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
296 inst=`echo $$inst | sed -e 's/^.*\///'`; \
297 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
a86ec89e
GI
298 echo " rm -f '$(DESTDIR)$(mandir)/man$$ext/$$inst'"; \
299 rm -f "$(DESTDIR)$(mandir)/man$$ext/$$inst"; \
832b75ed 300 done
832b75ed
GG
301else
302# For systems that adopts traditional manner
d2e702cf 303
832b75ed
GG
304man_MANS = smartd.conf.5 \
305 smartctl.8 \
306 smartd.8
d2e702cf 307
a86ec89e 308if ENABLE_UPDATE_SMART_DRIVEDB
d2e702cf
GI
309man_MANS += update-smart-drivedb.8
310endif
311
832b75ed
GG
312endif
313
314docsdir=$(docdir)
ee38a438
GI
315docs_DATA = \
316 AUTHORS \
317 ChangeLog \
318 ChangeLog-5.0-6.0 \
319 COPYING \
320 INSTALL \
321 NEWS \
322 README \
323 TODO \
ee38a438 324 smartd.conf
832b75ed 325
cfbba5b9
GI
326examplesdir=$(exampledir)
327examples_DATA = \
328 examplescripts/README
329examples_SCRIPTS = \
330 examplescripts/Example1 \
331 examplescripts/Example2 \
332 examplescripts/Example3 \
d2e702cf
GI
333 examplescripts/Example4 \
334 examplescripts/Example5 \
335 examplescripts/Example6
cfbba5b9
GI
336
337sysconf_DATA = smartd.conf
338
339# If modified smartd.conf exists install smartd.conf.sample instead
340install-sysconfDATA: $(sysconf_DATA)
17d0b8d9 341<<<<<<< HEAD
a86ec89e 342 $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'
17d0b8d9 343=======
3d8ad6fa 344 $(mkinstalldirs) '$(DESTDIR)$(sysconfdir)'
17d0b8d9 345>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
cfbba5b9
GI
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; \
a86ec89e 357 echo " $(INSTALL_DATA) '$$s' '$$f'"; \
cfbba5b9
GI
358 $(INSTALL_DATA) "$$s" "$$f"
359
360# If smartd.conf.sample exists preserve smartd.conf
361uninstall-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; \
a86ec89e 370 echo " rm -f '$$f'"; \
cfbba5b9
GI
371 rm -f "$$f"
372
d2e702cf 373smartdscript_SCRIPTS = smartd_warning.sh
ee38a438 374
cfbba5b9 375EXTRA_DIST = \
a7e8ffec 376 autogen.sh \
cfbba5b9 377 smartd.initd.in \
a7e8ffec 378 smartd.freebsd.initd.in \
cfbba5b9
GI
379 smartd.8.in \
380 smartctl.8.in \
381 smartd.conf.5.in \
382 smartd.conf \
a7e8ffec 383 smartd.service.in \
ee38a438 384 smartd_warning.sh.in \
cfbba5b9 385 update-smart-drivedb.in \
d2e702cf 386 update-smart-drivedb.8.in \
d008864d 387 m4/pkg.m4 \
a86ec89e
GI
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 \
cfbba5b9 394 os_win32/installer.nsi \
d008864d 395 os_win32/runcmd.c \
ee38a438
GI
396 os_win32/smartctl_res.rc.in \
397 os_win32/smartd_res.rc.in \
398 os_win32/smartd_warning.cmd \
cfbba5b9
GI
399 os_win32/syslogevt.mc \
400 os_win32/update-smart-drivedb.nsi \
401 os_win32/wbemcli_small.h \
ee38a438 402 os_win32/wtssendmsg.c \
cfbba5b9
GI
403 $(docs_DATA) \
404 $(examples_DATA) \
405 $(examples_SCRIPTS)
832b75ed 406
a7e8ffec
GI
407CLEANFILES = \
408 smartd.conf.5 \
409 smartd.conf.4 \
410 smartd.8 \
411 smartd.1m \
412 smartd.8.html \
a86ec89e 413 smartd.8.html.tmp \
a7e8ffec
GI
414 smartd.8.txt \
415 smartctl.8 \
416 smartctl.1m \
417 smartctl.8.html \
a86ec89e 418 smartctl.8.html.tmp \
a7e8ffec
GI
419 smartctl.8.txt \
420 smartd.conf.5.html \
a86ec89e 421 smartd.conf.5.html.tmp \
a7e8ffec
GI
422 smartd.conf.5.txt \
423 smartd.initd \
424 smartd.freebsd.initd \
425 smartd.service \
ee38a438 426 smartd_warning.sh \
a7e8ffec
GI
427 svnversion.h \
428 update-smart-drivedb \
d2e702cf
GI
429 update-smart-drivedb.8 \
430 update-smart-drivedb.1m \
a7e8ffec 431 SMART
832b75ed 432
2127e193
GI
433# 'make maintainer-clean' also removes files generated by './autogen.sh'
434MAINTAINERCLEANFILES = \
435 $(srcdir)/Makefile.in \
436 $(srcdir)/aclocal.m4 \
d2e702cf 437 $(srcdir)/compile \
2127e193
GI
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 \
d008864d 446 $(srcdir)/m4/pkg.m4
2127e193
GI
447
448utility.o: svnversion.h
449
450if IS_SVN_BUILD
451# Get version info from SVN
ee38a438 452svnversion.h: ChangeLog Makefile $(svn_deps)
a86ec89e 453 @echo ' svn info | $$(VERSION_FROM_SVN_INFO) > $@'
d2e702cf
GI
454 @echo '/* svnversion.h. Generated by Makefile from svn info. */' > $@
455 @(cd $(srcdir) \
2127e193
GI
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_,' >> $@
460else
461
462# SVN not available, guess version info from Id strings
a86ec89e
GI
463svnversion.h: ChangeLog Makefile NEWS
464 @echo ' cat ChangeLog NEWS $$(SOURCES) | $$(VERSION_FROM_SVN_IDS) > $@'
d2e702cf 465 @echo '/* svnversion.h. Generated by Makefile from Id strings. */' > $@
a86ec89e 466 @(cd $(srcdir) && cat ChangeLog NEWS Makefile.am configure.ac smart*.in *.cpp *.h) \
2127e193
GI
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_,' >> $@
471endif
472
473
2127e193
GI
474if ENABLE_DRIVEDB
475drivedb_DATA = drivedb.h
476endif
477
7f0798ef
GI
478update-smart-drivedb: update-smart-drivedb.in config.status
479 $(SHELL) ./config.status --file=$@
480 chmod +x $@
481
ee38a438
GI
482smartd_warning.sh: smartd_warning.sh.in config.status
483 $(SHELL) ./config.status --file=$@
484 chmod +x $@
7f0798ef 485
2127e193 486if INSTALL_INITSCRIPT
832b75ed 487if OS_DARWIN
a86ec89e 488initd_DATA = com.smartmontools.smartd.plist
832b75ed
GG
489
490initd_DATA_install = install-initdDATA-darwin
2127e193 491initd_DATA_uninstall = uninstall-initdDATA-darwin
832b75ed 492
a86ec89e 493com.smartmontools.smartd.plist : os_darwin/com.smartmontools.smartd.plist.in
832b75ed
GG
494 sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
495
496install-initdDATA-darwin: $(initd_DATA)
a86ec89e
GI
497 $(MKDIR_P) '$(DESTDIR)$(initddir)'
498 $(INSTALL_DATA) $(top_builddir)/$(initd_DATA) $(DESTDIR)$(initddir)/$(initd_DATA)
832b75ed 499
2127e193 500uninstall-initdDATA-darwin:
a86ec89e 501 rm -f $(DESTDIR)$(initddir)/$(initd_DATA)
2127e193 502
832b75ed
GG
503else
504
a86ec89e 505initd_DATA = $(initdfile)
832b75ed 506
a86ec89e
GI
507$(initdfile): $(srcdir)/$(initdfile).in Makefile
508 sed 's|/usr/local/sbin/|$(sbindir)/|g' $(srcdir)/$(initdfile).in > $@
832b75ed
GG
509
510initd_install_name = smartd$(smartd_suffix)
511
512initd_DATA_install = install-initdDATA-generic
2127e193 513initd_DATA_uninstall = uninstall-initdDATA-generic
832b75ed
GG
514
515install-initdDATA-generic: $(initd_DATA)
17d0b8d9 516<<<<<<< HEAD
a86ec89e 517 $(MKDIR_P) '$(DESTDIR)$(initddir)'
17d0b8d9 518=======
3d8ad6fa 519 $(mkinstalldirs) '$(DESTDIR)$(initddir)'
17d0b8d9 520>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
a86ec89e 521 $(INSTALL_SCRIPT) '$(top_builddir)/$(initdfile)' '$(DESTDIR)$(initddir)/smartd$(smartd_suffix)'
2127e193
GI
522
523uninstall-initdDATA-generic:
a86ec89e 524 rm -f '$(DESTDIR)$(initddir)/$(initd_install_name)'
2127e193
GI
525endif
526else
527
528initd_DATA_install = install-initdDATA-null
529initd_DATA_uninstall = uninstall-initdDATA-null
530
531install-initdDATA-null:
532uninstall-initdDATA-null:
832b75ed
GG
533endif
534
535install-initdDATA : $(initd_DATA_install)
536
2127e193 537uninstall-initdDATA: $(initd_DATA_uninstall)
832b75ed 538
a7e8ffec
GI
539if INSTALL_SYSTEMDUNIT
540systemdsystemunit_DATA = smartd.service
541endif
542
543smartd.service: smartd.service.in Makefile
17d0b8d9 544<<<<<<< HEAD
a86ec89e
GI
545 @echo ' $$(SMARTD_SERVICE_FILTER) < $(srcdir)/smartd.service.in > $@'
546 @{ \
17d0b8d9 547=======
3d8ad6fa
JD
548 @echo ' cat $(srcdir)/smartd.service.in | $$(SMARTD_SERVICE_FILTER) > $@'
549 @cat $(srcdir)/smartd.service.in | \
17d0b8d9 550>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
d2e702cf
GI
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'; \
a86ec89e 556 fi; } < $(srcdir)/smartd.service.in > $@
d2e702cf
GI
557
558
559# Create empty directories if configured.
560# Default install rules no longer create empty directories since automake 1.11.
d2e702cf
GI
561installdirs-local:
562 @for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
563 test -n "$$d" || continue; \
17d0b8d9 564<<<<<<< HEAD
a86ec89e
GI
565 echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
566 $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
17d0b8d9 567=======
3d8ad6fa 568 echo " $(mkinstalldirs) '$(DESTDIR)$$d'"; \
d2e702cf 569 $(mkinstalldirs) "$(DESTDIR)$$d" || exit 1; \
17d0b8d9 570>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
d2e702cf
GI
571 done
572
573install-data-local: installdirs-local
a7e8ffec 574
d2e702cf
GI
575#
576# Build man pages
577#
17d0b8d9 578<<<<<<< HEAD
a86ec89e 579MAN_FILTER = { \
17d0b8d9 580=======
a23d5117 581MAN_FILTER = \
17d0b8d9 582>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
ee38a438
GI
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' \
ee38a438
GI
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' \
d2e702cf
GI
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' \
a86ec89e
GI
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 | \
17d0b8d9 603<<<<<<< HEAD
a86ec89e
GI
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 | \
17d0b8d9
GI
609=======
610>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
a86ec89e
GI
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 | \
d2e702cf
GI
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 | \
a86ec89e
GI
631 if test -n '$(CAPNG_LDADD)'; then \
632 cat; \
633 else \
634 sed '/^\.\\" %IF ENABLE_CAPABILITIES/,/^\.\\" %ENDIF ENABLE_CAPABILITIES/ s,^,.\\"\# ,' ; \
635 fi | \
17d0b8d9 636<<<<<<< HEAD
a86ec89e
GI
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 | \
17d0b8d9
GI
642=======
643>>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
d008864d
GI
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; \
a86ec89e 654 fi; }
a23d5117 655
7f0798ef
GI
656# Implicit rule 'smart%: smart%.in ...' does not work with BSD make
657smartctl.8: smartctl.8.in Makefile svnversion.h
a86ec89e
GI
658 @echo ' $$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@'
659 @$(MAN_FILTER) < $(srcdir)/smartctl.8.in > $@
7f0798ef
GI
660
661smartd.8: smartd.8.in Makefile svnversion.h
a86ec89e
GI
662 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@'
663 @$(MAN_FILTER) < $(srcdir)/smartd.8.in > $@
7f0798ef
GI
664
665smartd.conf.5: smartd.conf.5.in Makefile svnversion.h
a86ec89e
GI
666 @echo ' $$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@'
667 @$(MAN_FILTER) < $(srcdir)/smartd.conf.5.in > $@
d2e702cf
GI
668
669update-smart-drivedb.8: update-smart-drivedb.8.in Makefile svnversion.h
a86ec89e
GI
670 @echo ' $$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@'
671 @$(MAN_FILTER) < $(srcdir)/update-smart-drivedb.8.in > $@
d2e702cf
GI
672
673# Build Solaris specific man pages
674SOLARIS_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
681smartctl.1m: smartctl.8
a86ec89e
GI
682 @echo ' $$(SOLARIS_MAN_FILTER) < smartctl.8 > $@'
683 @$(SOLARIS_MAN_FILTER) < smartctl.8 > $@
d2e702cf
GI
684
685smartd.1m: smartd.8
a86ec89e
GI
686 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.8 > $@'
687 @$(SOLARIS_MAN_FILTER) < smartd.8 > $@
d2e702cf
GI
688
689smartd.conf.4: smartd.conf.5
a86ec89e
GI
690 @echo ' $$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@'
691 @$(SOLARIS_MAN_FILTER) < smartd.conf.5 > $@
d2e702cf
GI
692
693update-smart-drivedb.1m: update-smart-drivedb.8
a86ec89e
GI
694 @echo ' $$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@'
695 @$(SOLARIS_MAN_FILTER) < update-smart-drivedb.8 > $@
d2e702cf 696
832b75ed
GG
697
698# Commands to convert man pages into .html and .txt
699# TODO: configure
700MAN2HTML = man2html
701#MAN2HTML = groff -man -Thtml
702MAN2TXT = groff -man -Tascii -P'-bcou'
703
4d59bff9 704# Remove HTTP header and fix links in man2html output
ee38a438
GI
705FIXHTML = 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'
832b75ed
GG
710
711# Convert man pages into .html and .txt
712
713htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
714
715txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
716
4d59bff9 717%.5.html: %.5
a86ec89e
GI
718 $(MAN2HTML) $< > $@.tmp
719 @echo ' $$(FIXHTML) < $@.tmp > $@'
720 @$(FIXHTML) < $@.tmp > $@
4d59bff9
GG
721
722%.8.html: %.8
a86ec89e
GI
723 $(MAN2HTML) $< > $@.tmp
724 @echo ' $$(FIXHTML) < $@.tmp > $@'
725 @$(FIXHTML) < $@.tmp > $@
832b75ed
GG
726
727%.5.txt: %.5
728 $(MAN2TXT) $< > $@
729
730%.8.txt: %.8
731 $(MAN2TXT) $< > $@
732
733
a23d5117
GI
734# Check drive database syntax
735check:
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
832b75ed
GG
742
743if OS_WIN32_MINGW
ee38a438
GI
744# Windows resources
745
746smartctl_res.o: smartctl_res.rc
747 $(WINDRES) $< $@
748
749smartd_res.o: smartd_res.rc syslogevt.rc
750 $(WINDRES) -I. $< $@
751
d2e702cf 752# Convert version for VERSIONINFO resource: 6.1 r3754 -> 6.1.0.3754, set Copyright year
a86ec89e
GI
753WIN_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"; }
ee38a438
GI
759
760smartctl_res.rc: os_win32/smartctl_res.rc.in Makefile svnversion.h
a86ec89e
GI
761 @echo ' $$(WIN_RC_FILTER) < $< > $@'
762 @$(WIN_RC_FILTER) < $< > $@
ee38a438
GI
763
764smartd_res.rc: os_win32/smartd_res.rc.in Makefile svnversion.h
a86ec89e
GI
765 @echo ' $$(WIN_RC_FILTER) < $< > $@'
766 @$(WIN_RC_FILTER) < $< > $@
ee38a438
GI
767
768syslogevt.rc: os_win32/syslogevt.mc
769 $(WINDMC) -b $<
770
a86ec89e
GI
771# Application manifests
772
773default.manifest.o: os_win32/default.manifest
774 echo '1 24 "$<"' | $(WINDRES) -J rc -o $@
775
776defadmin.manifest.o: defadmin.manifest
777 echo '1 24 "$<"' | $(WINDRES) -J rc -o $@
778
779defadmin.manifest: os_win32/default.manifest
780 sed 's,"asInvoker","requireAdministrator",' $< > $@
781
832b75ed
GG
782# Definitions for Windows distribution
783
7f0798ef
GI
784if OS_WIN64
785win_bits = 64
786else
787win_bits = 32
788endif
789
790distdir_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)
791distzip_win32 = $(PACKAGE)-$(VERSION).win$(win_bits).zip
792distinst_win32 = $(PACKAGE)-$(VERSION).win$(win_bits)-setup.exe
832b75ed
GG
793
794exedir_win32 = $(distdir_win32)/bin
795docdir_win32 = $(distdir_win32)/doc
796
cfbba5b9
GI
797EXEFILES_WIN32 = \
798 $(exedir_win32)/smartctl.exe \
799 $(exedir_win32)/smartctl-nc.exe \
d008864d 800 $(exedir_win32)/smartd.exe \
ee38a438 801 $(exedir_win32)/smartd_warning.cmd \
d008864d 802 $(exedir_win32)/runcmda.exe \
ee38a438
GI
803 $(exedir_win32)/runcmdu.exe \
804 $(exedir_win32)/wtssendmsg.exe
cfbba5b9
GI
805
806if ENABLE_DRIVEDB
807if OS_WIN32_NSIS
808EXEFILES_WIN32 += \
809 $(exedir_win32)/update-smart-drivedb.exe
810endif
811endif
812
813FILES_WIN32 = \
814 $(EXEFILES_WIN32) \
815 $(docdir_win32)/AUTHORS.txt \
ee38a438
GI
816 $(docdir_win32)/ChangeLog.txt \
817 $(docdir_win32)/ChangeLog-5.0-6.0.txt \
cfbba5b9
GI
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 \
f4e463df 823 $(docdir_win32)/checksums$(win_bits).txt \
cfbba5b9
GI
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 \
a86ec89e 830 $(docdir_win32)/smartd.conf.5.txt
cfbba5b9
GI
831
832if ENABLE_DRIVEDB
833FILES_WIN32 += \
834 $(exedir_win32)/drivedb.h
835endif
836
837CLEANFILES += \
838 $(FILES_WIN32) \
a86ec89e
GI
839 defadmin.manifest \
840 distdir.mkdir \
841 runcmda.exe runcmdu.exe \
cfbba5b9 842 smartctl-nc.exe smartctl-nc.exe.tmp \
a86ec89e
GI
843 smartctl_res.rc smartd_res.rc \
844 syslogevt.h \
ee38a438 845 syslogevt.rc syslogevt_*.bin \
cfbba5b9 846 update-smart-drivedb.exe \
a86ec89e 847 wtssendmsg.exe
832b75ed 848
a86ec89e 849# Note: Only use without options to be compatible with all variants
7f0798ef 850UNIX2DOS = unix2dos
832b75ed
GG
851
852# Build Windows distribution
853
854dist-win32: $(distzip_win32)
855
4d59bff9
GG
856install-win32: $(distinst_win32)
857 ./$(distinst_win32)
858
859installer-win32: $(distinst_win32)
860
cfbba5b9 861distdir-win32: distdir.mkdir $(FILES_WIN32)
832b75ed 862
cfbba5b9 863$(distzip_win32): distdir.mkdir $(FILES_WIN32)
832b75ed 864 @rm -fv $(distzip_win32)
cfbba5b9
GI
865 cd $(distdir_win32) && zip -9 ../$(distzip_win32) bin/* doc/*
866 md5sum $@ > $@.md5
867 sha1sum $@ > $@.sha1
868 sha256sum $@ > $@.sha256
832b75ed 869
cfbba5b9
GI
870if OS_WIN32_NSIS
871# Build NSIS installer
7f0798ef 872# Note: Only option character '-' is also compatible with Linux version of makensis
cfbba5b9 873$(distinst_win32): os_win32/installer.nsi distdir.mkdir $(FILES_WIN32)
f4e463df 874 test -z '$(builddir_win64)' || ( cd $(builddir_win64) && make distdir-win32 )
a86ec89e
GI
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' $<" && \
f4e463df 880 '$(MAKENSIS)' -V2 -NOCD -DINPDIR=$(distdir_win32) $$d64 -DOUTFILE=$@ -DVERSTR="$$verstr" $<
cfbba5b9
GI
881 md5sum $@ > $@.md5
882 sha1sum $@ > $@.sha1
883 sha256sum $@ > $@.sha256
884
885# Build drivedb.h update tool
886update-smart-drivedb.exe: os_win32/update-smart-drivedb.nsi
887 "$(MAKENSIS)" -V2 -NOCD -DBRANCH=$(DRIVEDB_BRANCH) $<
888
889else
890$(distinst_win32):
891 @echo "makensis: command not found. Please install NSIS from http://nsis.sourceforge.net/" 1>&2
892 @exit 1
893endif
4d59bff9 894
832b75ed 895cleandist-win32:
cfbba5b9 896 rm -rf $(distdir_win32) distdir.mkdir
832b75ed
GG
897
898distdir.mkdir:
899 @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
900 @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
901 touch $@
902
832b75ed
GG
903$(exedir_win32)/%.exe: %.exe
904 cp -p $< $@
7f0798ef 905 if test -n '$(STRIP)'; then $(STRIP) -s $@; else strip -s $@; fi
832b75ed
GG
906 touch -r $< $@
907
cfbba5b9
GI
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
ee38a438
GI
916$(exedir_win32)/%.cmd: $(srcdir)/os_win32/%.cmd
917 $(UNIX2DOS) < $< > $@
918 touch -r $< $@
919
ba59cff1
GG
920$(docdir_win32)/%.html: %.html
921 $(UNIX2DOS) < $< > $@
922 touch -r $< $@
923
924$(docdir_win32)/%.txt: %.txt
832b75ed
GG
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
f4e463df 936$(docdir_win32)/checksums$(win_bits).txt: $(EXEFILES_WIN32)
cfbba5b9
GI
937 (cd $(exedir_win32) && md5sum *.exe && sha1sum *.exe && sha256sum *.exe) \
938 | $(UNIX2DOS) > $@
939
2127e193
GI
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
945smartctl-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
ee38a438 956# Build runcmd?.exe and wtssendmsg.exe
a86ec89e
GI
957runcmd.o: os_win32/runcmd.c
958 $(CC) -c -Os $<
959
960runcmdu.exe: runcmd.o $(os_win32_manifest)
961 $(CC) -o $@ $^
d008864d 962
a86ec89e
GI
963runcmda.exe: runcmd.o defadmin.manifest.o
964 $(CC) -o $@ $^
965
966wtssendmsg.exe: os_win32/wtssendmsg.c $(os_win32_manifest)
967 $(CC) -Os -o $@ $< $(os_win32_manifest) -lwtsapi32
cfbba5b9 968
ee38a438 969# Build os_win32/vc10/{config.h,smart*.rc,svnversion.h} for MSVC10 from MinGW files
cfbba5b9 970
ee38a438
GI
971config-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
2127e193 975
ee38a438
GI
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. */' \
e165493d 978 -e 's,^#define HAVE_\(ATTR_PACKED\|GETTIMEOFDAY\|INTTYPES_H\|[DK_]*NTDDDISK_H\|STRINGS_H\|STRTOULL\|UNISTD_H\|WORKING_SNPRINTF\) 1$$,/* #undef HAVE_\1 */,' \
d008864d 979 -e 's,^\(#define SMARTMONTOOLS_BUILD_HOST "[^-]*\)[^"]*,\1-pc-w32vc10,' $< > $@
2127e193 980
ee38a438
GI
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
d008864d 988 cp $< $@
832b75ed
GG
989
990endif
a86ec89e
GI
991if OS_DARWIN
992# Definitions for OSX distribution
993distdir_darwin = $(PACKAGE)-$(VERSION).darwin
994dmg_darwin = $(PACKAGE)-$(VERSION).dmg
995pkg_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
1027install-darwin: install-darwin-cleanup $(pkg_darwin) $(dmg_darwin)
1028
1029install-darwin-cleanup:
1030 @rm -rf $(distdir_darwin)
1031endif