summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/Makemodule.am
blob: 377888e81ed944110509b78e598a1753c2235b5f (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# smartcols.h is generated, so it's stored in builddir!
smartcolsincdir = $(includedir)/libsmartcols
nodist_smartcolsinc_HEADERS = libsmartcols/src/libsmartcols.h

usrlib_exec_LTLIBRARIES += libsmartcols.la
libsmartcols_la_SOURCES= \
	include/list.h \
	\
	libsmartcols/src/smartcolsP.h \
	libsmartcols/src/iter.c \
	libsmartcols/src/symbols.c \
	libsmartcols/src/cell.c \
	libsmartcols/src/column.c \
	libsmartcols/src/line.c \
	libsmartcols/src/table.c \
	libsmartcols/src/print.c \
	libsmartcols/src/print-api.c \
	libsmartcols/src/version.c \
	libsmartcols/src/calculate.c \
	libsmartcols/src/grouping.c \
	libsmartcols/src/walk.c \
	libsmartcols/src/init.c \
	\
	libsmartcols/src/filter-parser.c \
	libsmartcols/src/filter-scanner.c \
	libsmartcols/src/filter-parser.h \
	libsmartcols/src/filter-scanner.h \
	\
	libsmartcols/src/filter.c \
	libsmartcols/src/filter-param.c \
	libsmartcols/src/filter-expr.c

BUILT_SOURCES += libsmartcols/src/filter-parser.c \
		 libsmartcols/src/filter-parser.h \
		 libsmartcols/src/filter-scanner.c \
		 libsmartcols/src/filter-scanner.h

EXTRA_DIST += libsmartcols/src/filter-parser.y \
	      libsmartcols/src/filter-scanner.l

## Generate filter parser (YACC) and tokenizer (LEX) .c and .h files.
#
# Note that we need advanced bison and flex features and configuration
# directives to generated thread safe parser (usable in stared library), so
# it's probably a bad idea to use "-y" (posix compatible) as default in
# autotools. We also need to generate .c and .h files in the same time to avoid
# duplicate stuff.
#
SCOLS_YACC_BASENAME = libsmartcols/src/filter-parser
SCOLS_YACC_STEMP = $(SCOLS_YACC_BASENAME).stamp

SCOLS_LEX_BASENAME = libsmartcols/src/filter-scanner
SCOLS_LEX_STEMP = $(SCOLS_LEX_BASENAME).stamp


$(SCOLS_YACC_STEMP): $(SCOLS_YACC_BASENAME).y
	@rm -f $(SCOLS_YACC_STEMP).tmp
	@touch -f $(SCOLS_YACC_STEMP).tmp
	$(AM_V_YACC) $(BISON) $< --output=${basename $@}.c --defines=${basename $@}.h
	@mv -f $(SCOLS_YACC_STEMP).tmp $@

$(SCOLS_YACC_BASENAME).c $(SCOLS_YACC_BASENAME).h: $(SCOLS_YACC_STEMP)
	@test -f $@ || rm -f $(SCOLS_YACC_STEMP)
	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(SCOLS_YACC_STEMP)


$(SCOLS_LEX_STEMP): $(SCOLS_LEX_BASENAME).l
	@rm -f $(SCOLS_LEX_STEMP).tmp
	@touch -f $(SCOLS_LEX_STEMP).tmp
	$(AM_V_GEN) $(FLEX) --header-file=${basename $@}.h --outfile=${basename $@}.c $<
	@mv -f $(SCOLS_LEX_STEMP).tmp $@

$(SCOLS_LEX_BASENAME).c $(SCOLS_LEX_BASENAME).h: $(SCOLS_LEX_STEMP)
	@test -f $@ || rm -f $(SCOLS_LEX_STEMP)
	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(SCOLS_LEX_STEMP)

# Each part of the parser depends on the header files
$(SCOLS_LEX_BASENAME).c: $(SCOLS_YACC_BASENAME).h
$(SCOLS_YACC_BASENAME).c: $(SCOLS_LEX_BASENAME).h

# Don't re-generate parser when use sources from tarball
EXTRA_DIST += $(SCOLS_YACC_STEMP) $(SCOLS_LEX_STEMP)


libsmartcols_la_LIBADD = $(LDADD) libcommon.la

libsmartcols_la_CFLAGS = \
	$(AM_CFLAGS) \
	$(SOLIB_CFLAGS) \
	-I$(ul_libsmartcols_incdir) \
	-I$(top_srcdir)/libsmartcols/src

EXTRA_libsmartcols_la_DEPENDENCIES = \
	libsmartcols/src/libsmartcols.sym

libsmartcols_la_LDFLAGS = $(SOLIB_LDFLAGS)
if HAVE_VSCRIPT
libsmartcols_la_LDFLAGS += $(VSCRIPT_LDFLAGS),$(top_srcdir)/libsmartcols/src/libsmartcols.sym
endif
libsmartcols_la_LDFLAGS += -version-info $(LIBSMARTCOLS_VERSION_INFO)

EXTRA_DIST += \
	libsmartcols/src/libsmartcols.sym

# move lib from $(usrlib_execdir) to $(libdir) if needed
install-exec-hook-libsmartcols:
	if test "$(usrlib_execdir)" != "$(libdir)" -a -f "$(DESTDIR)$(usrlib_execdir)/libsmartcols.so"; then \
		$(MKDIR_P) $(DESTDIR)$(libdir); \
		mv $(DESTDIR)$(usrlib_execdir)/libsmartcols.so.* $(DESTDIR)$(libdir); \
		so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libsmartcols.so); \
		so_img_rel_target=$$(echo $(usrlib_execdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
		(cd $(DESTDIR)$(usrlib_execdir) && \
			rm -f libsmartcols.so && \
			$(LN_S) $$so_img_rel_target$(libdir)/$$so_img_name libsmartcols.so); \
	fi

uninstall-hook-libsmartcols:
	rm -f $(DESTDIR)$(libdir)/libsmartcols.so*

INSTALL_EXEC_HOOKS += install-exec-hook-libsmartcols
UNINSTALL_HOOKS += uninstall-hook-libsmartcols