From 0c93eb3379241dc4775718a9d39f54a6c4de20d6 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 23 Aug 2015 20:36:11 -0700 Subject: [PATCH] Move source files to src/ --- .gitignore | 1 + .travis.yml | 7 ++-- Makefile.am | 46 +++++++++++++----------- configure.ac | 2 +- builtin.c => src/builtin.c | 0 builtin.h => src/builtin.h | 0 bytecode.c => src/bytecode.c | 0 bytecode.h => src/bytecode.h | 0 compile.c => src/compile.c | 0 compile.h => src/compile.h | 0 exec_stack.h => src/exec_stack.h | 0 execute.c => src/execute.c | 0 inject_errors.c => src/inject_errors.c | 0 jq.h => src/jq.h | 0 jq_parser.h => src/jq_parser.h | 0 jq_test.c => src/jq_test.c | 0 jv.c => src/jv.c | 0 jv.h => src/jv.h | 0 jv_alloc.c => src/jv_alloc.c | 0 jv_alloc.h => src/jv_alloc.h | 0 jv_aux.c => src/jv_aux.c | 0 jv_dtoa.c => src/jv_dtoa.c | 0 jv_dtoa.h => src/jv_dtoa.h | 0 jv_file.c => src/jv_file.c | 0 jv_parse.c => src/jv_parse.c | 0 jv_print.c => src/jv_print.c | 0 jv_unicode.c => src/jv_unicode.c | 0 jv_unicode.h => src/jv_unicode.h | 0 jv_utf8_tables.h => src/jv_utf8_tables.h | 0 lexer.c => src/lexer.c | 0 lexer.h => src/lexer.h | 0 lexer.l => src/lexer.l | 0 libm.h => src/libm.h | 0 linker.c => src/linker.c | 0 linker.h => src/linker.h | 0 locfile.c => src/locfile.c | 0 locfile.h => src/locfile.h | 0 main.c => src/main.c | 0 opcode_list.h => src/opcode_list.h | 0 parser.c => src/parser.c | 0 parser.h => src/parser.h | 0 parser.y => src/parser.y | 0 util.c => src/util.c | 0 util.h => src/util.h | 0 44 files changed, 31 insertions(+), 25 deletions(-) rename builtin.c => src/builtin.c (100%) rename builtin.h => src/builtin.h (100%) rename bytecode.c => src/bytecode.c (100%) rename bytecode.h => src/bytecode.h (100%) rename compile.c => src/compile.c (100%) rename compile.h => src/compile.h (100%) rename exec_stack.h => src/exec_stack.h (100%) rename execute.c => src/execute.c (100%) rename inject_errors.c => src/inject_errors.c (100%) rename jq.h => src/jq.h (100%) rename jq_parser.h => src/jq_parser.h (100%) rename jq_test.c => src/jq_test.c (100%) rename jv.c => src/jv.c (100%) rename jv.h => src/jv.h (100%) rename jv_alloc.c => src/jv_alloc.c (100%) rename jv_alloc.h => src/jv_alloc.h (100%) rename jv_aux.c => src/jv_aux.c (100%) rename jv_dtoa.c => src/jv_dtoa.c (100%) rename jv_dtoa.h => src/jv_dtoa.h (100%) rename jv_file.c => src/jv_file.c (100%) rename jv_parse.c => src/jv_parse.c (100%) rename jv_print.c => src/jv_print.c (100%) rename jv_unicode.c => src/jv_unicode.c (100%) rename jv_unicode.h => src/jv_unicode.h (100%) rename jv_utf8_tables.h => src/jv_utf8_tables.h (100%) rename lexer.c => src/lexer.c (100%) rename lexer.h => src/lexer.h (100%) rename lexer.l => src/lexer.l (100%) rename libm.h => src/libm.h (100%) rename linker.c => src/linker.c (100%) rename linker.h => src/linker.h (100%) rename locfile.c => src/locfile.c (100%) rename locfile.h => src/locfile.h (100%) rename main.c => src/main.c (100%) rename opcode_list.h => src/opcode_list.h (100%) rename parser.c => src/parser.c (100%) rename parser.h => src/parser.h (100%) rename parser.y => src/parser.y (100%) rename util.c => src/util.c (100%) rename util.h => src/util.h (100%) diff --git a/.gitignore b/.gitignore index ef64ea1880..0e6c3362ed 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ jq.1 # Autotools junk .libs .deps +.dirstamp libtool *.log stamp-h1 diff --git a/.travis.yml b/.travis.yml index 32074e25ac..0dbcd9c0b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ addons: - valgrind before_install: - - rm lexer.h lexer.c parser.h parser.c + - rm src/{lexer,parser}.{c,h} install: - bundle install --gemfile=docs/Gemfile @@ -41,8 +41,9 @@ script: after_script: - | if [ -n "$COVERAGE" ]; then - rm -rf .libs usr # don't care about coverage for libjq and bison - coveralls -e lexer.c -e parser.c -e jv_dtoa.c --gcov-options '\-lp' + rm -rf src/.libs usr # don't care about coverage for libjq and bison + coveralls --gcov-options '\-lp' \ + -e src/lexer.c -e src/parser.c -e src/jv_dtoa.c fi after_failure: diff --git a/Makefile.am b/Makefile.am index b4f0e3aa80..60d6de934c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,13 +1,17 @@ ### C source files to be built and distributed. -LIBJQ_INCS = builtin.h bytecode.h compile.h exec_stack.h jq_parser.h \ - jv_alloc.h jv_dtoa.h jv_unicode.h jv_utf8_tables.h lexer.l \ - libm.h linker.h locfile.h opcode_list.h parser.y util.h - -LIBJQ_SRC = builtin.c bytecode.c compile.c execute.c jq_test.c jv.c \ - jv_alloc.c jv_aux.c jv_dtoa.c jv_file.c jv_parse.c jv_print.c \ - jv_unicode.c linker.c locfile.c util.c ${LIBJQ_INCS} +LIBJQ_INCS = src/builtin.h src/bytecode.h src/compile.h \ + src/exec_stack.h src/jq_parser.h src/jv_alloc.h src/jv_dtoa.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 \ + src/util.h + +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 @@ -21,10 +25,10 @@ ACLOCAL_AMFLAGS = -I config/m4 # While there is some autoconf macro support for lex/flex, it doesn't support # header file creation so we'll use good old make if MAINTAINER_MODE -BUILT_SOURCES = lexer.h lexer.c parser.h parser.c version.h -lexer.c: lexer.l - $(AM_V_LEX) flex -o lexer.c --header-file=lexer.h $< -lexer.h: lexer.c +BUILT_SOURCES = src/lexer.h src/lexer.c src/parser.h src/parser.c src/version.h +src/lexer.c: src/lexer.l + $(AM_V_LEX) flex -o src/lexer.c --header-file=src/lexer.h $< +src/lexer.h: src/lexer.c else BUILT_SOURCES = .y.c: @@ -45,7 +49,7 @@ libjq_la_SOURCES = ${LIBJQ_SRC} libjq_la_LIBADD = -lm libjq_la_LDFLAGS = -export-symbols-regex '^j[qv]_' -version-info 1:4:0 -include_HEADERS = jv.h jq.h +include_HEADERS = src/jv.h src/jq.h ### Running tests under Valgrind @@ -65,7 +69,7 @@ endif if ENABLE_ERROR_INJECTION 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_LDFLAGS = -module endif @@ -77,13 +81,13 @@ endif .FORCE: generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | sed 's/.*/\#define JQ_VERSION \"&\"/'`" .remake-version-h: .FORCE - @ $(generate_ver); test "x`cat version.h 2>/dev/null`" = "x$$ver" || touch .remake-version-h -version.h: .remake-version-h + @ $(generate_ver); test "x`cat src/version.h 2>/dev/null`" = "x$$ver" || touch .remake-version-h +src/version.h: .remake-version-h $(AM_V_GEN) $(generate_ver); echo "$$ver" > $@ -main.c: version.h +src/main.c: src/version.h bin_PROGRAMS = jq -jq_SOURCES = main.c version.h +jq_SOURCES = src/main.c src/version.h jq_LDFLAGS = -static-libtool-libs jq_LDADD = libjq.la -lm @@ -146,8 +150,8 @@ DOC_FILES = docs/content docs/public docs/templates docs/site.yml \ docs/default_manpage.md jq.1.default EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \ - jq.1.prebuilt jq.spec lexer.c lexer.h parser.c parser.h \ - scripts/version tests/jq.test tests/modules/.jq \ + jq.1.prebuilt jq.spec src/lexer.c src/lexer.h src/parser.c \ + src/parser.h scripts/version tests/jq.test tests/modules/.jq \ tests/modules/a.jq tests/modules/b/b.jq tests/modules/c/c.jq \ tests/modules/c/d.jq tests/modules/data.json \ tests/modules/lib/jq/e/e.jq tests/modules/lib/jq/f.jq \ @@ -185,9 +189,9 @@ if ENABLE_DOCS endif clean-local-gcov: - rm -f *.gcno *.gcda *.gcov + rm -f src/*.gcno src/*.gcda src/*.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 diff --git a/configure.ac b/configure.ac index b8aaa70688..93a2fb6e4b 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ m4_include([m4/ax_prog_bison_version.m4]) dnl Created autoconf implementation thompson@dtosolutions, 26NOV12 AC_PREREQ([2.64]) AC_CONFIG_AUX_DIR([config]) -AM_INIT_AUTOMAKE([1.11.2 parallel-tests foreign -Wall]) +AM_INIT_AUTOMAKE([1.11.2 subdir-objects parallel-tests foreign -Wall]) AM_SILENT_RULES([yes]) AM_PROG_AR AM_MAINTAINER_MODE([enable]) diff --git a/builtin.c b/src/builtin.c similarity index 100% rename from builtin.c rename to src/builtin.c diff --git a/builtin.h b/src/builtin.h similarity index 100% rename from builtin.h rename to src/builtin.h diff --git a/bytecode.c b/src/bytecode.c similarity index 100% rename from bytecode.c rename to src/bytecode.c diff --git a/bytecode.h b/src/bytecode.h similarity index 100% rename from bytecode.h rename to src/bytecode.h diff --git a/compile.c b/src/compile.c similarity index 100% rename from compile.c rename to src/compile.c diff --git a/compile.h b/src/compile.h similarity index 100% rename from compile.h rename to src/compile.h diff --git a/exec_stack.h b/src/exec_stack.h similarity index 100% rename from exec_stack.h rename to src/exec_stack.h diff --git a/execute.c b/src/execute.c similarity index 100% rename from execute.c rename to src/execute.c diff --git a/inject_errors.c b/src/inject_errors.c similarity index 100% rename from inject_errors.c rename to src/inject_errors.c diff --git a/jq.h b/src/jq.h similarity index 100% rename from jq.h rename to src/jq.h diff --git a/jq_parser.h b/src/jq_parser.h similarity index 100% rename from jq_parser.h rename to src/jq_parser.h diff --git a/jq_test.c b/src/jq_test.c similarity index 100% rename from jq_test.c rename to src/jq_test.c diff --git a/jv.c b/src/jv.c similarity index 100% rename from jv.c rename to src/jv.c diff --git a/jv.h b/src/jv.h similarity index 100% rename from jv.h rename to src/jv.h diff --git a/jv_alloc.c b/src/jv_alloc.c similarity index 100% rename from jv_alloc.c rename to src/jv_alloc.c diff --git a/jv_alloc.h b/src/jv_alloc.h similarity index 100% rename from jv_alloc.h rename to src/jv_alloc.h diff --git a/jv_aux.c b/src/jv_aux.c similarity index 100% rename from jv_aux.c rename to src/jv_aux.c diff --git a/jv_dtoa.c b/src/jv_dtoa.c similarity index 100% rename from jv_dtoa.c rename to src/jv_dtoa.c diff --git a/jv_dtoa.h b/src/jv_dtoa.h similarity index 100% rename from jv_dtoa.h rename to src/jv_dtoa.h diff --git a/jv_file.c b/src/jv_file.c similarity index 100% rename from jv_file.c rename to src/jv_file.c diff --git a/jv_parse.c b/src/jv_parse.c similarity index 100% rename from jv_parse.c rename to src/jv_parse.c diff --git a/jv_print.c b/src/jv_print.c similarity index 100% rename from jv_print.c rename to src/jv_print.c diff --git a/jv_unicode.c b/src/jv_unicode.c similarity index 100% rename from jv_unicode.c rename to src/jv_unicode.c diff --git a/jv_unicode.h b/src/jv_unicode.h similarity index 100% rename from jv_unicode.h rename to src/jv_unicode.h diff --git a/jv_utf8_tables.h b/src/jv_utf8_tables.h similarity index 100% rename from jv_utf8_tables.h rename to src/jv_utf8_tables.h diff --git a/lexer.c b/src/lexer.c similarity index 100% rename from lexer.c rename to src/lexer.c diff --git a/lexer.h b/src/lexer.h similarity index 100% rename from lexer.h rename to src/lexer.h diff --git a/lexer.l b/src/lexer.l similarity index 100% rename from lexer.l rename to src/lexer.l diff --git a/libm.h b/src/libm.h similarity index 100% rename from libm.h rename to src/libm.h diff --git a/linker.c b/src/linker.c similarity index 100% rename from linker.c rename to src/linker.c diff --git a/linker.h b/src/linker.h similarity index 100% rename from linker.h rename to src/linker.h diff --git a/locfile.c b/src/locfile.c similarity index 100% rename from locfile.c rename to src/locfile.c diff --git a/locfile.h b/src/locfile.h similarity index 100% rename from locfile.h rename to src/locfile.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/opcode_list.h b/src/opcode_list.h similarity index 100% rename from opcode_list.h rename to src/opcode_list.h diff --git a/parser.c b/src/parser.c similarity index 100% rename from parser.c rename to src/parser.c diff --git a/parser.h b/src/parser.h similarity index 100% rename from parser.h rename to src/parser.h diff --git a/parser.y b/src/parser.y similarity index 100% rename from parser.y rename to src/parser.y diff --git a/util.c b/src/util.c similarity index 100% rename from util.c rename to src/util.c diff --git a/util.h b/src/util.h similarity index 100% rename from util.h rename to src/util.h