Version number tracking.
This commit is contained in:
1 parent
976e4ff711
commit
c53e001973
4 files changed
+15
-4
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
CC=gcc -Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function
|
CC=gcc -Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
|
|
||||||
.PHONY: all clean releasedep tarball
|
.PHONY: all clean releasedep tarball install uninstall test releasetag
|
||||||
all: jq
|
all: jq
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@@ -22,6 +22,10 @@ jv_utf8_tables.gen.h: gen_utf8_tables.py
|
|||||||
python $^ > $@
|
python $^ > $@
|
||||||
jv_unicode.c: jv_utf8_tables.gen.h
|
jv_unicode.c: jv_utf8_tables.gen.h
|
||||||
|
|
||||||
|
version.gen.h: VERSION
|
||||||
|
sed 's/.*/#define JQ_VERSION "&"/' $^ > $@
|
||||||
|
main.c: version.gen.h
|
||||||
|
|
||||||
JQ_SRC=parser.gen.c lexer.gen.c opcode.c bytecode.c compile.c execute.c builtin.c jv.c jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c
|
JQ_SRC=parser.gen.c lexer.gen.c opcode.c bytecode.c compile.c execute.c builtin.c jv.c jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c
|
||||||
|
|
||||||
|
|
||||||
@@ -31,13 +35,15 @@ jq_test: $(JQ_SRC) jq_test.c
|
|||||||
jq: $(JQ_SRC) main.c
|
jq: $(JQ_SRC) main.c
|
||||||
$(CC) -O -DJQ_DEBUG=0 -o $@ $^
|
$(CC) -O -DJQ_DEBUG=0 -o $@ $^
|
||||||
|
|
||||||
|
|
||||||
test: jq_test
|
test: jq_test
|
||||||
valgrind --error-exitcode=1 -q --leak-check=full ./jq_test >/dev/null
|
valgrind --error-exitcode=1 -q --leak-check=full ./jq_test >/dev/null
|
||||||
|
|
||||||
|
|
||||||
releasedep: lexer.gen.c parser.gen.c jv_utf8_tables.gen.h
|
releasedep: lexer.gen.c parser.gen.c jv_utf8_tables.gen.h
|
||||||
|
|
||||||
|
releasetag:
|
||||||
|
git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
|
||||||
|
|
||||||
docs/content/2.download/source/jq.tgz: jq
|
docs/content/2.download/source/jq.tgz: jq
|
||||||
mkdir -p `dirname $@`
|
mkdir -p `dirname $@`
|
||||||
tar -czvf $@ `git ls-files; ls *.gen.*`
|
tar -czvf $@ `git ls-files; ls *.gen.*`
|
||||||
|
|||||||
@@ -555,7 +555,7 @@ sections:
|
|||||||
results as `a`, if `a` produces results other than `false`
|
results as `a`, if `a` produces results other than `false`
|
||||||
and `null`. Otherwise, `a // b` produces the same results as `b`.
|
and `null`. Otherwise, `a // b` produces the same results as `b`.
|
||||||
|
|
||||||
This is useful for providing defaults: `.foo or 1` will
|
This is useful for providing defaults: `.foo // 1` will
|
||||||
evaluate to `1` if there's no `.foo` element in the
|
evaluate to `1` if there's no `.foo` element in the
|
||||||
input. It's similar to how `or` is sometimes used in Python
|
input. It's similar to how `or` is sometimes used in Python
|
||||||
(jq's `or` operator is reserved for strictly Boolean
|
(jq's `or` operator is reserved for strictly Boolean
|
||||||
|
|||||||
@@ -8,11 +8,12 @@
|
|||||||
#include "locfile.h"
|
#include "locfile.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
|
#include "version.gen.h"
|
||||||
|
|
||||||
static const char* progname;
|
static const char* progname;
|
||||||
|
|
||||||
static void usage() {
|
static void usage() {
|
||||||
fprintf(stderr, "\njq - commandline JSON processor\n");
|
fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", JQ_VERSION);
|
||||||
fprintf(stderr, "Usage: %s [options] <jq filter>\n\n", progname);
|
fprintf(stderr, "Usage: %s [options] <jq filter>\n\n", progname);
|
||||||
fprintf(stderr, "For a description of the command line options and\n");
|
fprintf(stderr, "For a description of the command line options and\n");
|
||||||
fprintf(stderr, "how to write jq filters (and why you might want to)\n");
|
fprintf(stderr, "how to write jq filters (and why you might want to)\n");
|
||||||
@@ -92,6 +93,9 @@ int main(int argc, char* argv[]) {
|
|||||||
options |= PROVIDE_NULL;
|
options |= PROVIDE_NULL;
|
||||||
} else if (isoption(argv[i], 'h', "help")) {
|
} else if (isoption(argv[i], 'h', "help")) {
|
||||||
usage();
|
usage();
|
||||||
|
} else if (isoption(argv[i], 'V', "version")) {
|
||||||
|
fprintf(stderr, "jq version %s\n", JQ_VERSION);
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: Unknown option %s\n", progname, argv[i]);
|
fprintf(stderr, "%s: Unknown option %s\n", progname, argv[i]);
|
||||||
die();
|
die();
|
||||||
|
|||||||
Reference in new issue
Block a user