Merge pull request #71 from hyrise/build/static_library

Static Library Build
This commit is contained in:
mrks 2017-10-20 14:12:43 +02:00 committed by GitHub
commit bbf502f104
2 changed files with 21 additions and 6 deletions

View File

@ -33,12 +33,22 @@ GMAKE = make mode=$(mode)
####################################### #######################################
############### Library ############### ############### Library ###############
####################################### #######################################
NAME := sqlparser
PARSER_CPP = $(SRCPARSER)/bison_parser.cpp $(SRCPARSER)/flex_lexer.cpp PARSER_CPP = $(SRCPARSER)/bison_parser.cpp $(SRCPARSER)/flex_lexer.cpp
PARSER_H = $(SRCPARSER)/bison_parser.h $(SRCPARSER)/flex_lexer.h PARSER_H = $(SRCPARSER)/bison_parser.h $(SRCPARSER)/flex_lexer.h
LIB_CFLAGS = -std=c++1z -Wall -Werror $(OPT_FLAG)
LIB_BUILD = libsqlparser.so static ?= no
LIB_CFLAGS = -std=c++1z -Wall -Werror -fPIC $(OPT_FLAG) ifeq ($(static), yes)
LIB_LFLAGS = -shared $(OPT_FLAG) LIB_BUILD = lib$(NAME).a
LIBLINKER = $(AR)
LIB_LFLAGS = rs
else
LIB_BUILD = lib$(NAME).so
LIBLINKER = $(CXX)
LIB_CFLAGS += -fPIC
LIB_LFLAGS = -shared -o
endif
LIB_CPP = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(PARSER_CPP) LIB_CPP = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(PARSER_CPP)
LIB_H = $(shell find $(SRC) -name '*.h' -not -path "$(SRCPARSER)/*") $(PARSER_H) LIB_H = $(shell find $(SRC) -name '*.h' -not -path "$(SRCPARSER)/*") $(PARSER_H)
LIB_ALL = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(shell find $(SRC) -name '*.h' -not -path "$(SRCPARSER)/*") LIB_ALL = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(shell find $(SRC) -name '*.h' -not -path "$(SRCPARSER)/*")
@ -47,7 +57,7 @@ LIB_OBJ = $(LIB_CPP:%.cpp=%.o)
library: $(LIB_BUILD) library: $(LIB_BUILD)
$(LIB_BUILD): $(LIB_OBJ) $(LIB_BUILD): $(LIB_OBJ)
$(CXX) $(LIB_LFLAGS) -o $(LIB_BUILD) $(LIB_OBJ) $(LIBLINKER) $(LIB_LFLAGS) $(LIB_BUILD) $(LIB_OBJ)
$(SRCPARSER)/flex_lexer.o: $(SRCPARSER)/flex_lexer.cpp $(SRCPARSER)/bison_parser.cpp $(SRCPARSER)/flex_lexer.o: $(SRCPARSER)/flex_lexer.cpp $(SRCPARSER)/bison_parser.cpp
$(CXX) $(LIB_CFLAGS) -c -o $@ $< -Wno-sign-compare -Wno-unneeded-internal-declaration $(CXX) $(LIB_CFLAGS) -c -o $@ $< -Wno-sign-compare -Wno-unneeded-internal-declaration
@ -65,7 +75,7 @@ $(SRCPARSER)/bison_parser.h: $(SRCPARSER)/bison_parser.cpp
$(SRCPARSER)/flex_lexer.h: $(SRCPARSER)/flex_lexer.cpp $(SRCPARSER)/flex_lexer.h: $(SRCPARSER)/flex_lexer.cpp
clean: clean:
rm -f $(LIB_BUILD) rm -f lib$(NAME).a lib$(NAME).so
rm -rf $(BIN) rm -rf $(BIN)
find $(SRC) -type f -name '*.o' -delete find $(SRC) -type f -name '*.o' -delete

View File

@ -14,7 +14,12 @@ namespace hsql {
select(nullptr), select(nullptr),
name(nullptr), name(nullptr),
table(nullptr), table(nullptr),
alias(nullptr) {}; alias(nullptr),
fval(0),
ival(0),
ival2(0),
opType(kOpNone),
distinct(false) {};
Expr::~Expr() { Expr::~Expr() {
delete expr; delete expr;