HyriseSQLParser/Makefile

83 lines
2.0 KiB
Makefile
Raw Normal View History

# directories
BIN = bin
SRC = src
SRCPARSER = src/parser
2014-12-15 18:32:46 +01:00
# files
PARSERCPP = $(SRCPARSER)/bison_parser.cpp $(SRCPARSER)/flex_lexer.cpp
LIBCPP = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(PARSERCPP)
LIBOBJ = $(LIBCPP:%.cpp=%.o)
TESTCPP = $(shell find test/ -name '*.cpp')
2016-02-27 15:01:06 +01:00
ALLLIB = $(shell find $(SRC) -name '*.cpp' -not -path "$(SRCPARSER)/*") $(shell find $(SRC) -name '*.h' -not -path "$(SRCPARSER)/*")
ALLTEST = $(shell find test/ -name '*.cpp') $(shell find test/ -name '*.h')
2016-02-27 15:01:06 +01:00
# compile & link flages
CFLAGS = -std=c++11 -Wall -fPIC -g
LIBFLAGS = -shared
TARGET = libsqlparser.so
INSTALL = /usr/local
2014-12-15 18:32:46 +01:00
CTESTFLAGS = -Wall -Isrc/ -Itest/ -L./ -std=c++11 -lstdc++ -g
2014-12-15 18:32:46 +01:00
all: library
2015-12-23 16:14:39 +01:00
library: $(TARGET)
2015-12-23 16:14:39 +01:00
$(TARGET): $(LIBOBJ)
2016-02-27 17:44:42 +01:00
$(CXX) $(LIBFLAGS) -o $(TARGET) $(LIBOBJ)
2014-12-15 18:32:46 +01:00
$(SRCPARSER)/flex_lexer.o: $(SRCPARSER)/flex_lexer.cpp
$(CXX) $(CFLAGS) -c -o $@ $< -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-deprecated-register
%.o: %.cpp $(PARSERCPP)
2016-02-27 17:44:42 +01:00
$(CXX) $(CFLAGS) -c -o $@ $<
$(SRCPARSER)/bison_parser.cpp: $(SRCPARSER)/bison_parser.y
make -C $(SRCPARSER)/ bison_parser.cpp
$(SRCPARSER)/flex_lexer.cpp: $(SRCPARSER)/flex_lexer.l
make -C $(SRCPARSER)/ flex_lexer.cpp
parser:
make -C $(SRCPARSER) all
clean:
2015-12-23 16:14:39 +01:00
rm -f $(TARGET)
rm -rf $(BIN)
find $(SRC) -type f -name '*.o' -delete
cleanparser:
make -C $(SRCPARSER)/ clean
2015-12-23 17:00:41 +01:00
cleanall: clean cleanparser
2015-12-23 16:14:39 +01:00
install:
cp $(TARGET) $(INSTALL)/lib/$(TARGET)
rm -rf $(INSTALL)/include/hsql
2017-03-11 13:47:35 +01:00
cp -r src $(INSTALL)/include/hsql
find $(INSTALL)/include/hsql -not -name '*.h' -type f | xargs rm
2016-02-27 15:01:06 +01:00
format:
astyle --options=astyle.options $(ALLLIB)
astyle --options=astyle.options $(ALLTEST)
run_benchmark:
make -C benchmark/ clean run
2015-12-23 16:14:39 +01:00
############
### Test ###
############
test: $(BIN)/sql_tests
2016-02-27 15:48:20 +01:00
bash test/test.sh
2015-12-23 16:14:39 +01:00
2016-02-27 16:40:24 +01:00
# test whete
test_install:
make -C example/
./example/example "SELECT * FROM students WHERE name = 'Max Mustermann';"
2015-12-23 16:14:39 +01:00
$(BIN)/sql_tests: library
@mkdir -p $(BIN)/
$(CXX) $(CTESTFLAGS) $(TESTCPP) -o $(BIN)/sql_tests -lsqlparser