aboutsummaryrefslogtreecommitdiff
path: root/include/Makefile.am
blob: 5b8443aee6bf172dd3eecf888d03edaae784e88f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
## Process this file with automake to produce Makefile.in
#
# include/Makefile.am
#

# Suppress 'echo' if './configure --enable-silent-rules' or 'make V=0' is used.
# Variables AM_V_* are provided by automake >= 1.13.
ECHO_V = ! $(AM_V_P) || echo
ECHO_V_GEN = @$(AM_V_P) || echo '  GEN      $@'; $(ECHO_V)

all: smartmon/smartmon_config.h smartmon/version.h

# Create 'smartmon_config.h' from 'config.h'.  Add prefix SMARTMON_ to each define
# if SMARTMON[TOOLS] is not already present.  Fail if an invalid line occurs.
smartmon/smartmon_config.h: ../config.h Makefile
	$(ECHO_V_GEN) ' $$(CONFIG_FILTER) < ../config.h > $@.tmp'
	$(AM_V_at)$(MKDIR_P) smartmon
	@echo '/* smartmon/smartmon_config.h.  Generated from config.h by Makefile.  */' > $@.tmp
	@echo '#ifndef _SMARTMON_CONFIG_H' >> $@.tmp
	@echo '#define _SMARTMON_CONFIG_H' >> $@.tmp
	@sed \
	  -e '/^./s/^/!!/' \
	  -e '/^!!\/\* [^#]/s/^!!//' \
	  -e '/^!!.*#.*def.*SMARTMON/s/^!!//' \
	  -e 's/^!!#define /#define SMARTMON_/' \
	  -e 's/^!!\/\* #undef /\/* #undef SMARTMON_/' \
	  -e 's/^!!\(.*#.*def.*\) \(AC_APPLE_UNIVERSAL_BUILD\)/\1 SMARTMON_\2/' \
	  -e 's/^!!\(.*#.*def.*\) \(WORDS_BIGENDIAN\)/\1 SMARTMON_\2/' \
	  -e '/^!!# *if.* __BIG_ENDIAN__/s/^!!//' \
	  -e '/^!!# *[defilns]*$$/s/^!!//' \
	  -e '/^!!   /s/^!!//' \
	  -e 's/^!!/error: config.h: invalid line: /' \
	  < ../config.h >> $@.tmp
	@echo '#endif // _SMARTMON_CONFIG_H' >> $@.tmp
	@if grep '^error: ' $@.tmp; then exit 1; fi
	$(AM_V_at)mv -f $@.tmp $@

# Get version info
smartmon/version.h: smartmon/version.sh
	$(AM_V_GEN)$(top_srcdir)/util/getversion.sh -i < smartmon/version.sh > $@.tmp
	$(AM_V_at)mv -f $@.tmp $@

smartmon/version.sh: ../util/getversion.sh ../config.h Makefile
	$(AM_V_at)$(MKDIR_P) smartmon
	$(AM_V_GEN)$(top_srcdir)/util/getversion.sh -s > $@.tmp
	$(AM_V_at)mv -f $@.tmp $@
	@if $(AM_V_P); then cat $@; fi

smartmon_headers = \
        smartmon/ata.h \
        smartmon/atacmds.h \
        smartmon/byteorder.h \
        smartmon/dev_interface.h \
        smartmon/farmcmds.h \
        smartmon/hexdump.h \
        smartmon/json.h \
        smartmon/knowndrives.h \
        smartmon/nvme.h \
        smartmon/nvmecmds.h \
        smartmon/scsicmds.h \
        smartmon/sg_unaligned.h \
        smartmon/smartmon_defs.h \
        smartmon/utility.h

if INSTALL_DEVEL_INC

incsmartmondir = $(includedir)/smartmon
incsmartmon_DATA = \
        $(smartmon_headers) \
        smartmon/smartmon_config.h \
        smartmon/version.h

if OS_WIN32
incsmartmonw32dir = $(incsmartmondir)/os_win32
incsmartmonw32_DATA = \
        smartmon/os_win32/wmiquery.h

if OS_WIN32_MINGW
incsmartmonw32_DATA += \
        smartmon/os_win32/popen.h
endif
endif

if NEED_REGEX
incsmartmonrexdir = $(incsmartmondir)/regex
incsmartmonrex_DATA = \
        smartmon/regex/regex.h
endif

endif

EXTRA_DIST = \
        $(smartmon_headers) \
        smartmon/os_win32/popen.h \
        smartmon/os_win32/wmiquery.h \
        smartmon/regex/regex.h

CLEANFILES = \
        smartmon/smartmon_config.h \
        smartmon/smartmon_config.h.tmp \
        smartmon/version.h \
        smartmon/version.h.tmp \
        smartmon/version.sh \
        smartmon/version.sh.tmp

# 'make maintainer-clean' also removes files generated by './autogen.sh'
MAINTAINERCLEANFILES = \
        $(srcdir)/Makefile.in