-
-
Notifications
You must be signed in to change notification settings - Fork 12
Libs so #6
Libs so #6
Changes from 5 commits
22762f9
65ab06d
b974507
b0ade5f
621dd46
8325fb2
7a63949
9e73887
9ca47fa
05c5675
9f1cd4d
0bd23be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,22 @@ 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 | ||
|
||
install: libs_so | ||
cp ./libs/libgherkin.so.1.0 /usr/lib/libgherkin.so.1.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .1.0? Shouldn't it rather be the gherkin version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we add a |
||
ln -s /usr/lib/libgherkin.so.1.0 /usr/lib/libgherkin.so | ||
mkdir -p /usr/include/gherkin | ||
cp ./include/*.h /usr/include/gherkin | ||
.PHONY: install | ||
|
||
uninstall: | ||
rm /usr/lib/libgherkin.so /usr/lib/libgherkin.so.1.0 | ||
rm -rf /usr/include/gherkin | ||
.PHONY: uninstall | ||
|
||
.run: cli $(GHERKIN) $(GOOD_FEATURE_FILES) | ||
$(RUN_GHERKIN) $(GOOD_FEATURE_FILES) | jq . > /dev/null | ||
touch .run | ||
|
@@ -96,3 +112,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 "." $@) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 -Wl,-soname,libgherkin.so.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ".1"? not ".1.0" as everywhere else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or better - take the version from a |
||
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) | ||
|
@@ -33,6 +35,8 @@ cli: ../bin/gherkin$(EXT) | |
|
||
libs: ../libs/libgherkin.a | ||
|
||
libs_so: ../libs/libgherkin.so | ||
|
||
clean: | ||
$(RM_CMD) ../bin ../objs ../libs | ||
.PHONY: clean | ||
|
@@ -121,10 +125,14 @@ GHERKIN_CLI_OBJS= \ | |
$(MKDIR_CMD) $(dir $@) | ||
$(AR) $(AR_FLAGS) $@ $(UTILITIES_OBJS) $(PARSER_OBJS) $(AST_OBJS) $(COMPILER_OBJS) $(PICKLES_OBJS) $(EVENT_OBJS) | ||
|
||
../libs/libgherkin.so: $(UTILITIES_OBJS) $(PARSER_OBJS) $(AST_OBJS) $(COMPILER_OBJS) $(PICKLES_OBJS) $(EVENT_OBJS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless declared ".PHONY", make rules shall create their target, so the make target should be "../libs/libgherkin.so". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand what you mean (again, my make experience is not great) so I am unable to comply. If you can make the change so I can see what you mean, that would be very helpful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "A phony target is one that is not really the name of a file". " |
||
$(MKDIR_CMD) $(dir $@) | ||
$(CC) $(GCC_SO_FLAGS) -o ../libs/libgherkin.so.1.0 $(UTILITIES_OBJS) $(PARSER_OBJS) $(AST_OBJS) $(COMPILER_OBJS) $(PICKLES_OBJS) $(EVENT_OBJS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use "-o $@" (after the make target has been fixed). |
||
|
||
../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 $@ | ||
|
||
../bin/gherkin$(EXT): ../libs/libgherkin.a $(GHERKIN_CLI_OBJS) Makefile | ||
../bin/gherkin$(EXT): ../libs/libgherkin.a ../libs/libgherkin.so $(GHERKIN_CLI_OBJS) Makefile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "../libs/libgherkin.so" is not used for building "../bin/gherkin$(EXT)", so it should not be a dependency of the make rule. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I do not understand. ../libs/libgherkin.so does build its target because it calls CC to build the actual shared object so I do not know what to do to address your comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "../bin/gherkin" binary is statically linking the gherkin library. It does so using by using the "../libs/libgherkin.a" archive file. When you execute I think you added this to get "../libs/libgherkin.so" build when running |
||
$(MKDIR_CMD) $(dir $@) | ||
$(LD) $(LD_FLAGS) $(GHERKIN_CLI_OBJS) -L../libs/ -lgherkin $(LD_LIBS) -o $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that the install and uninstall should be part of this makefile and make assumptions on where to install. If so the install and include directory should be defined in variables, so the they can be edited in one place (or overridden from the command line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are install and uninstall rules, then shouldn't they also install the "bin/gherkin" CLI-binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. This was requested by @aslakhellesoy because of things I said in the README file for Cucumber.ml project. I am not wedded to it because I have not used make in years and am (as you can see) fairly rusty at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove install and uninstall, but I thought having them would simplify consumption for other developers and users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding things like "/usr/lib/" on several lines deep in makefile rules is not a good idea. The
src/Makefile
is deliberately written with make variable at the top, so that is should be straight forward for a user to modify those make variables for the special c compiler that the user might use. Any install/uninstall rules should also be appropriately parameterized ("/usr/lib/" does not work on Windows for instance).