1
2include $(top_srcdir)/aminclude_static.am
3
4SUBDIRS = tools fmtlib pcrepp base tailer pugixml yajl yajlpp formats/logfmt .
5
6bin_PROGRAMS = lnav
7
8noinst_PROGRAMS = lnav-test
9
10noinst_LIBRARIES = libdiag.a
11
12PTIME_V = $(PTIME_V_@AM_V@)
13PTIME_V_ = $(PTIME_V_@AM_DEFAULT_V@)
14PTIME_V_0 = @echo "  TIMEFMT " $@;
15
16BIN2C_V = $(BIN2C_V_@AM_V@)
17BIN2C_V_ = $(BIN2C_V_@AM_DEFAULT_V@)
18BIN2C_V_0 = @echo "  BIN2C   " $@;
19
20RE2C_V = $(RE2C_V_@AM_V@)
21RE2C_V_ = $(RE2C_V_@AM_DEFAULT_V@)
22RE2C_V_0 = @echo "  RE2C   " $@;
23
24include formats/formats.am
25
26default-formats.h default-formats.cc: tools/bin2c$(BUILD_EXEEXT) $(FORMAT_FILES)
27	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) -n lnav_format_json default-formats $(FORMAT_FILES)
28
29include keymaps/keymaps.am
30include themes/themes.am
31
32CONFIG_FILES = \
33    $(srcdir)/root-config.json \
34    $(KEYMAP_FILES) \
35    $(THEME_FILES) \
36    $()
37
38default-config.h default-config.cc: tools/bin2c$(BUILD_EXEEXT) $(CONFIG_FILES)
39	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) -n lnav_config_json default-config $(CONFIG_FILES)
40
41include scripts/scripts.am
42
43builtin-scripts.h builtin-scripts.cc: tools/bin2c$(BUILD_EXEEXT) $(BUILTIN_LNAVSCRIPTS)
44	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) -n lnav_scripts builtin-scripts $(BUILTIN_LNAVSCRIPTS)
45
46builtin-sh-scripts.h builtin-sh-scripts.cc: tools/bin2c$(BUILD_EXEEXT) $(BUILTIN_SHSCRIPTS)
47	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) -n lnav_sh_scripts builtin-sh-scripts $(BUILTIN_SHSCRIPTS)
48
49%-sh.cc: $(srcdir)/%.sh tools/bin2c$(BUILD_EXEEXT)
50	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) $(*)-sh $<
51
52%-txt.cc %-txt.h: $(srcdir)/%.txt tools/bin2c$(BUILD_EXEEXT)
53	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) $(*)-txt $<
54
55%-sql.cc %-sql.h: $(srcdir)/%.sql tools/bin2c$(BUILD_EXEEXT)
56	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) $(*)-sql $<
57
58%-lnav.cc %-lnav.h: $(srcdir)/%.lnav tools/bin2c$(BUILD_EXEEXT)
59	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) $(*)-lnav $<
60
61%-json.cc %-json.h: $(srcdir)/%.json tools/bin2c$(BUILD_EXEEXT)
62	$(BIN2C_V)tools/bin2c$(BUILD_EXEEXT) $(*)-json $<
63
64include time_formats.am
65
66time_fmts.cc: ptimec$(BUILD_EXEEXT)
67	$(PTIME_V)./ptimec$(BUILD_EXEEXT) $(TIME_FORMATS) > $@
68
69if HAVE_RE2C
70%.cc: %.re
71	$(RE2C_V)$(RE2C_CMD) --tags -8 -o $@ $<
72	$(REC2_V)test $@ -ef $(srcdir)/$*.cc || cp $@ $(srcdir)/$*.cc
73endif
74
75lnav_config.$(OBJEXT): default-config.h
76
77log_format_loader.$(OBJEXT): \
78	builtin-scripts.h \
79	builtin-sh-scripts.h \
80	default-formats.h
81
82styling.$(OBJEXT): ansi-palette-json.h xterm-palette-json.h
83
84view_helpers.$(OBJEXT): help-txt.h
85
86LNAV_BUILT_FILES = \
87    ansi-palette-json.h \
88    ansi-palette-json.cc \
89    builtin-scripts.h \
90    builtin-scripts.cc \
91    builtin-sh-scripts.h \
92    builtin-sh-scripts.cc \
93    default-config.h \
94    default-config.cc \
95    default-formats.h \
96    default-formats.cc \
97    help-txt.h \
98    help-txt.cc \
99    init-sql.h \
100    init-sql.cc \
101    time_fmts.cc \
102    xterm-palette-json.h \
103    xterm-palette-json.cc
104
105AM_LIBS = $(CODE_COVERAGE_LIBS)
106AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
107AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS)
108
109AM_LDFLAGS = \
110	$(STATIC_LDFLAGS) \
111	$(LIBARCHIVE_LDFLAGS) \
112	$(READLINE_LDFLAGS) \
113	$(SQLITE3_LDFLAGS) \
114	$(PCRE_LDFLAGS)
115
116AM_CPPFLAGS = \
117	-DSYSCONFDIR='"$(sysconfdir)"' \
118	-DSQLITE_OMIT_LOAD_EXTENSION \
119	-I$(srcdir)/fmtlib \
120	-I$(srcdir)/third-party \
121	-Wall \
122	$(CODE_COVERAGE_CPPFLAGS) \
123	$(LIBARCHIVE_CFLAGS) \
124	$(READLINE_CFLAGS) \
125	$(SQLITE3_CFLAGS) \
126	$(LIBCURL_CPPFLAGS)
127
128LDADD = \
129	libdiag.a \
130	base/libbase.a \
131	formats/logfmt/liblogfmt.a \
132	fmtlib/libcppfmt.a \
133	pcrepp/libpcrepp.a \
134	pugixml/libpugixml.a \
135	tailer/libtailerservice.a \
136	tailer/libtailercommon.a \
137	tailer/libtailerpp.a \
138	yajl/libyajl.a \
139	yajlpp/libyajlpp.a \
140	$(READLINE_LIBS) \
141	$(CURSES_LIB) \
142	$(SQLITE3_LIBS) \
143	$(LIBARCHIVE_LIBS) \
144	$(LIBCURL)
145
146dist_noinst_DATA = \
147	alpha-release.sh \
148	ansi-palette.json \
149	$(BUILTIN_LNAVSCRIPTS) \
150	$(BUILTIN_SHSCRIPTS) \
151	$(CONFIG_FILES) \
152	$(FORMAT_FILES) \
153	xterm-palette.json
154
155noinst_HEADERS = \
156	all_logs_vtab.hh \
157	ansi_scrubber.hh \
158	archive_manager.hh \
159	archive_manager.cfg.hh \
160	attr_line.hh \
161	auto_fd.hh \
162	auto_mem.hh \
163	big_array.hh \
164	bin2c.hh \
165	bookmarks.hh \
166	bottom_status_source.hh \
167	bound_tags.hh \
168	byte_array.hh \
169	column_namer.hh \
170	command_executor.hh \
171	curl_looper.hh \
172	data_scanner.hh \
173	data_scanner_re.re \
174	data_parser.hh \
175	db_sub_source.hh \
176	doc_status_source.hh \
177	elem_to_json.hh \
178	environ_vtab.hh \
179	field_overlay_source.hh \
180	file_collection.hh \
181	file_format.hh \
182	file_vtab.cfg.hh \
183	files_sub_source.hh \
184	filter_observer.hh \
185	filter_status_source.hh \
186	filter_sub_source.hh \
187	fstat_vtab.hh \
188	fts_fuzzy_match.hh \
189	grep_highlighter.hh \
190	grep_proc.hh \
191	help.txt \
192	help_text.hh \
193	help_text_formatter.hh \
194	highlighter.hh \
195	hist_source.hh \
196	hotkeys.hh \
197	init.sql \
198	input_dispatcher.hh \
199	k_merge_tree.h \
200	line_buffer.hh \
201	listview_curses.hh \
202	lnav.hh \
203	lnav_commands.hh \
204	lnav_config.hh \
205	lnav_config_fwd.hh \
206	lnav_util.hh \
207	log_accel.hh \
208	log_actions.hh \
209    log_data_helper.hh \
210    log_data_table.hh \
211	log_format.hh \
212	log_format_ext.hh \
213	log_format_fwd.hh \
214	log_format_loader.hh \
215	log_gutter_source.hh \
216	log_level.hh \
217	log_level_re.re \
218	log_search_table.hh \
219	logfile.hh \
220	logfile.cfg.hh \
221	logfile_fwd.hh \
222	logfile_sub_source.hh \
223	mapbox/recursive_wrapper.hpp \
224	mapbox/variant.hpp \
225	mapbox/variant_io.hpp \
226	mapbox/variant_visitor.hpp \
227	optional.hpp \
228	papertrail_proc.hh \
229	piper_proc.hh \
230	plain_text_source.hh \
231	pretty_printer.hh \
232	preview_status_source.hh \
233	ptimec.hh \
234	readline_callbacks.hh \
235	readline_curses.hh \
236	readline_highlighters.hh \
237	readline_possibilities.hh \
238	regexp_vtab.hh \
239	relative_time.hh \
240	ring_span.hh \
241	safe/accessmode.h \
242	safe/defaulttypes.h \
243	safe/mutableref.h \
244	safe/safe.h \
245	sequence_matcher.hh \
246	sequence_sink.hh \
247	service_tags.hh \
248	session_data.hh \
249	shared_buffer.hh \
250	shlex.hh \
251	simdutf8check.h \
252	spectro_source.hh \
253	sql_util.hh \
254	sqlite-extension-func.hh \
255	styling.hh \
256	statusview_curses.hh \
257	string_attr_type.hh \
258	strong_int.hh \
259	sysclip.hh \
260	sysclip.cfg.hh \
261	termios_guard.hh \
262	term_extra.hh \
263	text_format.hh \
264	textfile_highlighters.hh \
265	textfile_sub_source.hh \
266	textview_curses.hh \
267	textview_curses_fwd.hh \
268	time_T.hh \
269	timer.hh \
270	top_status_source.hh \
271	unique_path.hh \
272	url_loader.hh \
273	view_curses.hh \
274	view_helpers.hh \
275	views_vtab.hh \
276	vis_line.hh \
277	vt52_curses.hh \
278	vtab_module.hh \
279	vtab_module_json.hh \
280	log_vtab_impl.hh \
281	log_format_impls.cc \
282	xml_util.hh \
283	xpath_vtab.hh \
284	xterm_mouse.hh \
285	spookyhash/SpookyV2.h \
286	ghc/filesystem.hpp \
287	ghc/fs_fwd.hpp \
288	ghc/fs_impl.hpp \
289	ghc/fs_std.hpp \
290	ghc/fs_std_fwd.hpp \
291	ghc/fs_std_impl.hpp \
292    ww898/cp_utf8.hpp
293
294nodist_libdiag_a_SOURCES = \
295	$(LNAV_BUILT_FILES)
296
297THIRD_PARTY_SRCS = \
298    third-party/backward-cpp/backward.hpp \
299    third-party/doctest-root/doctest/doctest.h \
300	third-party/sqlite/ext/dbdump.c \
301	third-party/sqlite/ext/series.c
302
303libdiag_a_SOURCES = \
304	$(THIRD_PARTY_SRCS) \
305	all_logs_vtab.cc \
306	ansi_scrubber.cc \
307	archive_manager.cc \
308	attr_line.cc \
309	bookmarks.cc \
310	bottom_status_source.cc \
311	collation-functions.cc \
312	column_namer.cc \
313	command_executor.cc \
314	curl_looper.cc \
315	data_scanner.cc \
316	data_scanner_re.cc \
317	db_sub_source.cc \
318	elem_to_json.cc \
319	environ_vtab.cc \
320	extension-functions.cc \
321	field_overlay_source.cc \
322	file_collection.cc \
323	file_format.cc \
324	files_sub_source.cc \
325	filter_observer.cc \
326	filter_status_source.cc \
327	filter_sub_source.cc \
328	fstat_vtab.cc \
329    fs-extension-functions.cc \
330    fts_fuzzy_match.cc \
331	grep_proc.cc \
332	help_text.cc \
333	help_text_formatter.cc \
334	highlighter.cc \
335	hist_source.cc \
336	hotkeys.cc \
337	input_dispatcher.cc \
338	json-extension-functions.cc \
339	line_buffer.cc \
340	listview_curses.cc \
341	lnav_commands.cc \
342	lnav_config.cc \
343	lnav_util.cc \
344	log_accel.cc \
345	log_actions.cc \
346	log_data_helper.cc \
347	log_data_table.cc \
348	log_format.cc \
349	log_format_loader.cc \
350	log_level.cc \
351	log_level_re.cc \
352	log_search_table.cc \
353	logfile.cc \
354	logfile_sub_source.cc \
355	network-extension-functions.cc \
356	data_parser.cc \
357	papertrail_proc.cc \
358	pretty_printer.cc \
359	ptimec_rt.cc \
360	readline_callbacks.cc \
361	readline_curses.cc \
362	readline_highlighters.cc \
363	readline_possibilities.cc \
364	regexp_vtab.cc \
365	relative_time.cc \
366	session_data.cc \
367	sequence_matcher.cc \
368	shared_buffer.cc \
369	shlex.cc \
370	spectro_source.cc \
371	sqlite-extension-func.cc \
372	statusview_curses.cc \
373	string-extension-functions.cc \
374	string_attr_type.cc \
375	styling.cc \
376	text_format.cc \
377	textfile_sub_source.cc \
378	timer.cc \
379	piper_proc.cc \
380	sql_commands.cc \
381	sql_util.cc \
382	state-extension-functions.cc \
383	sysclip.cc \
384	textfile_highlighters.cc \
385	textview_curses.cc \
386	time-extension-functions.cc \
387	top_status_source.cc \
388	unique_path.cc \
389	view_curses.cc \
390	view_helpers.cc \
391	views_vtab.cc \
392	vt52_curses.cc \
393	vtab_module.cc \
394	log_vtab_impl.cc \
395	xml_util.cc \
396	xpath_vtab.cc \
397	xterm_mouse.cc \
398	spookyhash/SpookyV2.cpp
399
400PLUGIN_SRCS = \
401	file_vtab.cc
402
403lnav.$(OBJEXT): help-txt.h init-sql.h
404
405lnav_SOURCES = lnav.cc $(PLUGIN_SRCS)
406
407lnav_test_SOURCES = lnav.cc test_override.c $(PLUGIN_SRCS)
408
409ptimec$(BUILD_EXEEXT): ptimec.c
410	$(AM_V_CC) $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -g3 -o $@ $?
411
412if HAVE_RE2C
413RE2C_FILES = data_scanner_re.cc log_level_re.cc
414endif
415
416EXTRA_DIST = \
417	ptimec.c
418
419CLEANFILES = \
420	ptimec$(BUILD_EXEEXT)
421
422DISTCLEANFILES = \
423    $(LNAV_BUILT_FILES) \
424	$(RE2C_FILES)
425
426uncrusty:
427	(cd $(srcdir) && uncrustify -c ../lnav.cfg --replace $(SOURCES) \
428		$(HEADERS))
429
430if !DISABLE_DOCUMENTATION
431all-local: lnav
432	if test -w $(srcdir)/internals; then \
433		env DUMP_INTERNALS_DIR=$(srcdir)/internals DUMP_CRASH=1 ./lnav Makefile; \
434		mv $(srcdir)/internals/*.schema.json $(top_srcdir)/docs/schemas; \
435	fi
436endif
437
438install-exec-hook:
439	bash $(srcdir)/alpha-release.sh
440