Makefile.am (jq-1.5) | : | Makefile.am (jq-1.6) | ||
---|---|---|---|---|
### C source files to be built and distributed. | ### C source files to be built and distributed. | |||
LIBJQ_INCS = jq_parser.h builtin.h bytecode.h compile.h exec_stack.h \ | LIBJQ_INCS = src/builtin.h src/bytecode.h src/compile.h \ | |||
libm.h jv_alloc.h jv_dtoa.h jv_unicode.h locfile.h \ | src/exec_stack.h src/jq_parser.h src/jv_alloc.h src/jv_dtoa.h \ | |||
opcode_list.h parser.y jv_utf8_tables.h lexer.l util.h linker.h | src/jv_unicode.h src/jv_utf8_tables.h src/lexer.l src/libm.h \ | |||
src/linker.h src/locfile.h src/opcode_list.h src/parser.y \ | ||||
LIBJQ_SRC = locfile.c bytecode.c compile.c execute.c builtin.c jv.c \ | src/util.h | |||
jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c jv_aux.c jv_file.c \ | ||||
jv_alloc.c jq_test.c util.c linker.c ${LIBJQ_INCS} | LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \ | |||
src/jq_test.c src/jv.c src/jv_alloc.c src/jv_aux.c \ | ||||
src/jv_dtoa.c src/jv_file.c src/jv_parse.c src/jv_print.c \ | ||||
src/jv_unicode.c src/linker.c src/locfile.c src/util.c \ | ||||
${LIBJQ_INCS} | ||||
### C build options | ### C build options | |||
AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \ | AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \ | |||
-Wno-unused-parameter -Wno-unused-function | -Wno-unused-parameter -Wno-unused-function | |||
ACLOCAL_AMFLAGS = -I config/m4 | ACLOCAL_AMFLAGS = -I config/m4 | |||
### Generating the lexer and parser | ### Generating the lexer and parser | |||
# While there is some autoconf macro support for lex/flex, it doesn't support | # While there is some autoconf macro support for lex/flex, it doesn't support | |||
# header file creation so we'll use good old make | # header file creation so we'll use good old make | |||
if MAINTAINER_MODE | if MAINTAINER_MODE | |||
BUILT_SOURCES = lexer.h lexer.c parser.h parser.c version.h | BUILT_SOURCES = src/lexer.h src/lexer.c src/parser.h src/parser.c \ | |||
lexer.c: lexer.l | src/builtin.inc src/version.h | |||
$(AM_V_LEX) flex -o lexer.c --header-file=lexer.h $< | src/lexer.c: src/lexer.l | |||
lexer.h: lexer.c | $(AM_V_LEX) flex -o src/lexer.c --header-file=src/lexer.h $< | |||
src/lexer.h: src/lexer.c | ||||
else | else | |||
BUILT_SOURCES = | BUILT_SOURCES = src/builtin.inc src/version.h | |||
.y.c: | .y.c: | |||
$(AM_V_YACC) echo "NOT building parser.c!" | $(AM_V_YACC) echo "NOT building parser.c!" | |||
.l.c: | .l.c: | |||
$(AM_V_LEX) echo "NOT building lexer.c!" | $(AM_V_LEX) echo "NOT building lexer.c!" | |||
endif | endif | |||
# Tell YACC (bison) autoconf macros that you want a header file created. | # Tell YACC (bison) autoconf macros that you want a header file created. | |||
# If the --warnings=all fails, you probably have an old version of bison | # If the --warnings=all fails, you probably have an old version of bison | |||
# OSX ships an old bison, so update with homebrew or macports | # OSX ships an old bison, so update with homebrew or macports | |||
AM_YFLAGS = --warnings=all -d | AM_YFLAGS = --warnings=all -d | |||
### libjq | ### libjq | |||
lib_LTLIBRARIES = libjq.la | lib_LTLIBRARIES = libjq.la | |||
libjq_la_SOURCES = ${LIBJQ_SRC} | libjq_la_SOURCES = ${LIBJQ_SRC} | |||
libjq_la_LIBADD = -lm | libjq_la_LIBADD = -lm | |||
libjq_la_LDFLAGS = -export-symbols-regex '^j[qv]_' -version-info 1:4:0 | libjq_la_LDFLAGS = $(onig_LDFLAGS) -export-symbols-regex '^j[qv]_' -version-info 1:4:0 | |||
include_HEADERS = jv.h jq.h | if WIN32 | |||
libjq_la_LIBADD += -lshlwapi | ||||
endif | ||||
include_HEADERS = src/jv.h src/jq.h | ||||
if ENABLE_UBSAN | ||||
AM_CFLAGS += -fsanitize=undefined | ||||
endif | ||||
### Running tests under Valgrind | ### Running tests under Valgrind | |||
if ENABLE_ASAN | ||||
AM_CFLAGS += -fsanitize=address | ||||
NO_VALGRIND = 1 | ||||
else | ||||
if ENABLE_VALGRIND | if ENABLE_VALGRIND | |||
NO_VALGRIND = | NO_VALGRIND = | |||
else | else | |||
NO_VALGRIND = 1 | NO_VALGRIND = 1 | |||
endif | endif | |||
endif | ||||
### Code coverage with gcov | ### Code coverage with gcov | |||
if ENABLE_GCOV | if ENABLE_GCOV | |||
AM_CFLAGS += --coverage --no-inline | AM_CFLAGS += --coverage --no-inline | |||
endif | endif | |||
### Error injection for testing | ### Error injection for testing | |||
if ENABLE_ERROR_INJECTION | if ENABLE_ERROR_INJECTION | |||
lib_LTLIBRARIES += libinject_errors.la | lib_LTLIBRARIES += libinject_errors.la | |||
libinject_errors_la_SOURCES = inject_errors.c | libinject_errors_la_SOURCES = src/inject_errors.c | |||
libinject_errors_la_LIBADD = -ldl | libinject_errors_la_LIBADD = -ldl | |||
libinject_errors_la_LDFLAGS = -module | libinject_errors_la_LDFLAGS = -module | |||
endif | endif | |||
### Building the jq binary | ### Building the jq binary | |||
# Remake the version.h header file if, and only if, the git ID has changed | # Remake the version.h header file if, and only if, the git ID has changed | |||
.PHONY: .FORCE | .PHONY: .FORCE | |||
.FORCE: | .FORCE: | |||
generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | sed 's/.*/\#define JQ_VERSION \"&\"/'`" | generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | sed 's/.*/\#define JQ_VERSION \"&\"/'`" | |||
.remake-version-h: .FORCE | .remake-version-h: .FORCE | |||
@ $(generate_ver); test "x`cat version.h 2>/dev/null`" = "x$$ver" || touc | @ $(generate_ver); test "x`cat src/version.h 2>/dev/null`" = "x$$ver" || | |||
h .remake-version-h | touch .remake-version-h | |||
version.h: .remake-version-h | src/version.h: .remake-version-h | |||
$(AM_V_GEN) $(generate_ver); echo "$$ver" > $@ | $(AM_V_GEN) $(generate_ver); echo "$$ver" > $@ | |||
main.c: version.h | src/main.c: src/version.h | |||
src/builtin.inc: src/builtin.jq | ||||
$(AM_V_GEN) sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n" | ||||
/' $^ > $@ | ||||
src/builtin.o: src/builtin.inc | ||||
bin_PROGRAMS = jq | bin_PROGRAMS = jq | |||
jq_SOURCES = main.c version.h | jq_SOURCES = src/main.c src/version.h | |||
jq_LDFLAGS = -static-libtool-libs | jq_LDFLAGS = -static-libtool-libs | |||
jq_LDADD = libjq.la -lm | jq_LDADD = libjq.la -lm | |||
if WIN32 | ||||
jq_LDADD += -lshlwapi | ||||
endif | ||||
if ENABLE_ALL_STATIC | if ENABLE_ALL_STATIC | |||
jq_LDFLAGS += -all-static | jq_LDFLAGS += -all-static | |||
endif | endif | |||
### Tests (make check) | ### Tests (make check) | |||
TESTS = tests/mantest tests/jqtest tests/onigtest tests/shtest | TESTS = tests/optionaltest tests/mantest tests/jqtest tests/onigtest tests/shtes t tests/utf8test tests/base64test | |||
TESTS_ENVIRONMENT = NO_VALGRIND=$(NO_VALGRIND) | TESTS_ENVIRONMENT = NO_VALGRIND=$(NO_VALGRIND) | |||
### Building the manpage | ### Building the manpage | |||
# If ENABLE_DOCS is not set, just copy jq.1.default to jq.1 | ||||
# The real_docs target succeeds (possibly after building jq.1) only if ENABLE_DO | ||||
CS is set | ||||
# Thus, making "dist" depend on "real_docs" ensures that we never build a tarbal | ||||
l with | ||||
# a stub manpage. | ||||
man_MANS = jq.1 | man_MANS = jq.1 | |||
.PHONY: real_docs | ||||
if ENABLE_DOCS | if ENABLE_DOCS | |||
jq.1: $(srcdir)/docs/content/3.manual/manual.yml | jq.1: $(srcdir)/docs/content/3.manual/manual.yml | |||
$(AM_V_GEN) ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage ) > $ @ || { rm -f $@; false; } | $(AM_V_GEN) ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage ) > $ @ || { rm -f $@; false; } | |||
jq.1.prebuilt: jq.1 | jq.1.prebuilt: jq.1 | |||
$(AM_V_GEN) cp $^ $@ || { rm -f $@; false; } | $(AM_V_GEN) cp $^ $@ || { rm -f $@; false; } | |||
jq.1.default: $(srcdir)/docs/default_manpage.md | ||||
$(AM_V_GEN) ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage_defau | ||||
lt ) > $@ || { rm -f $@; false; } | ||||
real_docs: jq.1 jq.1.prebuilt | ||||
@if cmp jq.1 $(srcdir)/jq.1.default > /dev/null; then\ | ||||
rm -f jq.1; $(MAKE) $(AM_MAKEFLAGS) jq.1;\ | ||||
fi | ||||
else | else | |||
jq.1: $(srcdir)/jq.1.prebuilt | jq.1: $(srcdir)/jq.1.prebuilt | |||
$(AM_V_GEN) cp $^ $@ | $(AM_V_GEN) cp $^ $@ | |||
real_docs: | ||||
@echo "Ruby dependencies not found, cannot build manpage." > /dev/stderr | ||||
@echo "Follow the instructions in docs/README.md to install them" > /dev/ | ||||
stderr | ||||
@echo "and then rerun ./configure" > /dev/stderr | ||||
@echo "A pre-built, possibly out-of-date manpage used." > /dev/stderr | ||||
false | ||||
endif | endif | |||
### Build oniguruma | ||||
if BUILD_ONIGURUMA | ||||
libjq_la_LIBADD += modules/oniguruma/src/.libs/libonig.la | ||||
SUBDIRS = modules/oniguruma | ||||
endif | ||||
AM_CFLAGS += $(onig_CFLAGS) | ||||
### Packaging | ### Packaging | |||
docs/site.yml: configure.ac | docs/site.yml: configure.ac | |||
sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new | sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new | |||
mv $@.new $@ | mv $@.new $@ | |||
install-binaries: $(BUILT_SOURCES) | install-binaries: $(BUILT_SOURCES) | |||
$(MAKE) $(AM_MAKEFLAGS) install-exec | $(MAKE) $(AM_MAKEFLAGS) install-exec | |||
# Ensure "make dist" fails when we can't build the real manpage | DOC_FILES = docs/content docs/public docs/templates docs/site.yml \ | |||
dist-hook: real_docs | docs/Gemfile docs/Gemfile.lock docs/Rakefile docs/README.md \ | |||
jq.1.prebuilt | ||||
DOC_FILES = docs/content docs/public docs/templates docs/site.yml \ | ||||
docs/Gemfile docs/Gemfile.lock docs/Rakefile docs/README.md \ | EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \ | |||
docs/default_manpage.md jq.1.default | jq.1.prebuilt jq.spec src/lexer.c src/lexer.h src/parser.c \ | |||
src/parser.h src/version.h src/builtin.jq \ | ||||
# setup is only used by distribution developers, not package developers. | scripts/version tests/jq.test tests/modules/.jq \ | |||
# Still, as a matter of allowing patching, its not a bad idea to distribute | tests/modules/a.jq tests/modules/b/b.jq tests/modules/c/c.jq \ | |||
# the developer setup script in the tarball. | tests/modules/c/d.jq tests/modules/data.json \ | |||
EXTRA_DIST = $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) jq.spec \ | tests/modules/lib/jq/e/e.jq tests/modules/lib/jq/f.jq \ | |||
$(DOC_FILES) scripts/version parser.h parser.c lexer.h \ | tests/modules/syntaxerror/syntaxerror.jq \ | |||
lexer.c tests/onig.supp tests/torture/input0.json \ | tests/modules/test_bind_order.jq \ | |||
tests/modules/.jq tests/modules/a.jq tests/modules/b/b.jq \ | tests/modules/test_bind_order0.jq \ | |||
tests/modules/c/c.jq tests/modules/c/d.jq \ | tests/modules/test_bind_order1.jq \ | |||
tests/modules/lib/jq/e/e.jq tests/modules/lib/jq/f.jq \ | tests/modules/test_bind_order2.jq tests/onig.supp \ | |||
tests/setup tests/jq.test tests/onig.test \ | tests/onig.test tests/setup tests/torture/input0.json \ | |||
tests/modules/data.json \ | tests/optional.test tests/optionaltest \ | |||
tests/modules/syntaxerror/syntaxerror.jq \ | tests/utf8-truncate.jq tests/utf8test \ | |||
tests/modules/test_bind_order.jq \ | tests/base64.test tests/base64test \ | |||
tests/modules/test_bind_order0.jq \ | tests/jq-f-test.sh tests/shtest | |||
tests/modules/test_bind_order1.jq \ | ||||
tests/modules/test_bind_order2.jq \ | ||||
jq.1.prebuilt | ||||
# README.md is expected in Github projects, good stuff in it, so we'll | # README.md is expected in Github projects, good stuff in it, so we'll | |||
# distribute it and install it with the package in the doc directory. | # distribute it and install it with the package in the doc directory. | |||
docdir = ${datadir}/doc/${PACKAGE} | docdir = ${datadir}/doc/${PACKAGE} | |||
dist_doc_DATA = README.md COPYING AUTHORS README | dist_doc_DATA = README.md COPYING AUTHORS README | |||
RELEASE ?= 1 | RELEASE ?= 1 | |||
rpm: dist jq.spec | rpm: dist jq.spec | |||
@echo "Packaging jq as an RPM ..." | @echo "Packaging jq as an RPM ..." | |||
mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS | mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS | |||
skipping to change at line 190 | skipping to change at line 204 | |||
# Not sure why this doesn't get cleaned up automatically, guess | # Not sure why this doesn't get cleaned up automatically, guess | |||
# automake used to man pages which are hand coded? | # automake used to man pages which are hand coded? | |||
# 'make clean' doesn't delete the manpage if it can't be rebuilt | # 'make clean' doesn't delete the manpage if it can't be rebuilt | |||
clean-local-docs: | clean-local-docs: | |||
if ENABLE_DOCS | if ENABLE_DOCS | |||
rm -f jq.1 | rm -f jq.1 | |||
endif | endif | |||
clean-local-gcov: | clean-local-gcov: | |||
rm -f *.gcno *.gcda *.gcov | rm -f src/*.gcno src/*.gcda src/*.gcov | |||
clean-local: clean-local-docs clean-local-gcov | clean-local: clean-local-docs clean-local-gcov | |||
rm -f version.h .remake-version-h | rm -f src/version.h .remake-version-h | |||
.PHONY: clean-local-docs clean-local-gcov | .PHONY: clean-local-docs clean-local-gcov | |||
End of changes. 22 change blocks. | ||||
71 lines changed or deleted | 82 lines changed or added |