# ============================================================================ # FiveSql2 Makefile — SQL Engine with Pratt Parser (TSqlParser2) # # Usage: # make Build all tests # make test Run all tests # make bench Run parser benchmark # make clean Remove built files # # Requirements: # - Harbour compiler (hbmk2) in PATH # - Set HB_INSTALL_PREFIX to harbour-core root # # Example: # export PATH="/path/to/harbour-core/bin/linux/gcc:$PATH" # export HB_INSTALL_PREFIX="/path/to/harbour-core" # make test # ============================================================================ SRCDIR = src TESTDIR = test OUTDIR = bin HB = hbmk2 HBFLAGS = -n -gtcgi -rebuild -I$(SRCDIR) # Source files (order matters for Harbour compilation) SOURCES = \ $(SRCDIR)/TSqlAlias.prg \ $(SRCDIR)/TSqlParser2.prg \ $(SRCDIR)/TFiveSQL.prg \ $(SRCDIR)/TSqlLexer.prg \ $(SRCDIR)/TSqlExpr.prg \ $(SRCDIR)/TSqlFunc.prg \ $(SRCDIR)/TSqlExecutor.prg \ $(SRCDIR)/TSqlIndex.prg \ $(SRCDIR)/TSqlAgg.prg \ $(SRCDIR)/TSqlSort.prg \ $(SRCDIR)/TSqlDDL.prg \ $(SRCDIR)/TSqlTxn.prg \ $(SRCDIR)/FiveSqlCls.prg \ $(SRCDIR)/FiveSqlDef.ch # ============================================================================ # Build targets # ============================================================================ all: $(OUTDIR) test_basic test_1999 test_hard test_standards test_challenge test_extreme $(OUTDIR): mkdir -p $(OUTDIR) test_basic: $(OUTDIR) $(HB) $(TESTDIR)/test_parser2.prg $(SOURCES) -o$(OUTDIR)/test_basic $(HBFLAGS) test_1999: $(OUTDIR) $(HB) $(TESTDIR)/test_sql1999.prg $(SOURCES) -o$(OUTDIR)/test_1999 $(HBFLAGS) test_hard: $(OUTDIR) $(HB) $(TESTDIR)/test_sql1999_hard.prg $(SOURCES) -o$(OUTDIR)/test_hard $(HBFLAGS) test_standards: $(OUTDIR) $(HB) $(TESTDIR)/test_sql_standards.prg $(SRCDIR)/TSqlParser2.prg $(SRCDIR)/TSqlLexer.prg $(SRCDIR)/TSqlExpr.prg $(SRCDIR)/TSqlFunc.prg $(SRCDIR)/FiveSqlDef.ch -o$(OUTDIR)/test_standards $(HBFLAGS) test_challenge: $(OUTDIR) $(HB) $(TESTDIR)/test_sql_challenge.prg $(SOURCES) -o$(OUTDIR)/test_challenge $(HBFLAGS) test_extreme: $(OUTDIR) $(HB) $(TESTDIR)/test_sql_extreme.prg $(SOURCES) -o$(OUTDIR)/test_extreme $(HBFLAGS) # ============================================================================ # Run tests # ============================================================================ test: all @echo "" @echo "================================================================" @echo " FiveSql2 — Full Test Suite" @echo "================================================================" @echo "" @echo "--- Basic (10 tests) ---" @$(OUTDIR)/test_basic < /dev/null 2>&1 | tail -2 @echo "" @echo "--- SQL:1999 (43 tests) ---" @$(OUTDIR)/test_1999 < /dev/null 2>&1 | strings | grep "Rate" @echo "" @echo "--- Complex (10 tests) ---" @$(OUTDIR)/test_hard < /dev/null 2>&1 | strings | grep "Rate" @echo "" @echo "--- Standards SQL:2003-2023 (64 tests) ---" @$(OUTDIR)/test_standards < /dev/null 2>&1 | strings | grep "Rate" @echo "" @echo "--- Challenge (15 tests) ---" @$(OUTDIR)/test_challenge < /dev/null 2>&1 | strings | grep "Rate" @echo "" @echo "--- Extreme (15 tests) ---" @$(OUTDIR)/test_extreme < /dev/null 2>&1 | strings | grep "Rate" @echo "" @echo "================================================================" @echo " All test suites completed." @echo "================================================================" # ============================================================================ # Clean # ============================================================================ clean: rm -rf $(OUTDIR) rm -f *.dbf *.ntx *.cdx __cte_*.dbf .PHONY: all test bench clean