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