diff --git a/Makefile b/Makefile index 5dc165f..fa87991 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,13 @@ libs: ./include/rule_type.h src/parser.c src/dialect.c $(SRC_FILES) src/Makefile cd src; $(MAKE) CC=$(CC) $@ .PHONY: libs +libs_so: ./include/rule_type.h src/parser.c src/dialect.c $(SRC_FILES) src/Makefile + cd src; $(MAKE) CC=$(CC) $@ +.PHONY: libs_so + .run: cli $(GHERKIN) $(GOOD_FEATURE_FILES) $(RUN_GHERKIN) $(GOOD_FEATURE_FILES) | jq . > /dev/null - touch .run + touch $@ ./include/rule_type.h: gherkin.berp gherkin-c-rule-type.razor mono berp/berp.exe -g gherkin.berp -t gherkin-c-rule-type.razor -o $@ @@ -96,3 +100,4 @@ acceptance/testdata/%.feature.source.ndjson: testdata/%.feature testdata/%.featu mkdir -p `dirname $@` $(RUN_GHERKIN) --no-ast --no-pickles $< | jq --sort-keys --compact-output "." > $@ diff --unified <(jq "." $<.source.ndjson) <(jq "." $@) + diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..32f3eaa --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +5.0.1 \ No newline at end of file diff --git a/src/error_list.h b/include/error_list.h similarity index 100% rename from src/error_list.h rename to include/error_list.h diff --git a/src/file_reader.h b/include/file_reader.h similarity index 100% rename from src/file_reader.h rename to include/file_reader.h diff --git a/src/Makefile b/src/Makefile index 3fccc6e..2e2659d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,12 @@ -GCC_FLAGS=-c -Wall -Werror -g -CLANG_FLAGS=-c -Wall -Werror -g +GCC_FLAGS=-c -Wall -Werror -g -fPIC +CLANG_FLAGS=-c -Wall -Werror -g -fPIC +GCC_SO_FLAGS=-shared +MINGW_FLAGS=-c -Wall -Werror -g ifeq ($(CC),i686-w64-mingw32-gcc) CC=i686-w64-mingw32-gcc LD=i686-w64-mingw32-gcc - CC_FLAGS=$(GCC_FLAGS) + CC_FLAGS=$(MINGW_FLAGS) AR=i686-w64-mingw32-ar EXT=.exe else ifeq ($(CC),clang) @@ -25,13 +27,22 @@ LD_LIBS=-lm RM_CMD=rm -rf MKDIR_CMD=mkdir -p +VERSION=$(shell cat ../VERSION) + all: \ - cli \ - ../bin/gherkin_generate_tokens$(EXT) + cli \ + ../bin/gherkin_generate_tokens$(EXT) \ + libs_so +.PHONY: all cli: ../bin/gherkin$(EXT) +.PHONY: cli libs: ../libs/libgherkin.a +.PHONY: libs + +libs_so: ../libs/libgherkin.so.$(VERSION) +.PHONY: libs_so clean: $(RM_CMD) ../bin ../objs ../libs @@ -121,6 +132,10 @@ GHERKIN_CLI_OBJS= \ $(MKDIR_CMD) $(dir $@) $(AR) $(AR_FLAGS) $@ $(UTILITIES_OBJS) $(PARSER_OBJS) $(AST_OBJS) $(COMPILER_OBJS) $(PICKLES_OBJS) $(EVENT_OBJS) +../libs/libgherkin.so.$(VERSION): $(UTILITIES_OBJS) $(PARSER_OBJS) $(AST_OBJS) $(COMPILER_OBJS) $(PICKLES_OBJS) $(EVENT_OBJS) Makefile + $(MKDIR_CMD) $(dir $@) + $(CC) $(GCC_SO_FLAGS) $(UTILITIES_OBJS) $(PARSER_OBJS) $(AST_OBJS) $(COMPILER_OBJS) $(PICKLES_OBJS) $(EVENT_OBJS) -o $@ + ../bin/gherkin_generate_tokens$(EXT): ../libs/libgherkin.a $(GENERATE_TOKEN_OBJS) Makefile $(MKDIR_CMD) $(dir $@) $(LD) $(LD_FLAGS) $(GENERATE_TOKEN_OBJS) -L../libs/ -lgherkin $(LD_LIBS) -o $@