aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-10-10 15:14:02 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-10-10 15:22:27 -0300
commit46c653293381dcc1188013d3e2c3f7587a199dc4 (patch)
tree0b9776f73d6e2afcd9104cf400dc5e345fcdcbea /Makefile
parentcc4873e33866ba86561774a7e55449d59367661e (diff)
downloadquerymanager-46c653293381dcc1188013d3e2c3f7587a199dc4.tar.gz
querymanager-46c653293381dcc1188013d3e2c3f7587a199dc4.zip
organize database configs and schema files + compilation guards
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 13 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 0ba1f30..0fca315 100644
--- a/Makefile
+++ b/Makefile
@@ -23,11 +23,17 @@ endif
DATABASE ?= sqlite
ifeq ($(DATABASE), sqlite)
DATABASEOBJ = $(BUILDDIR)/database_sqlite.obj $(BUILDDIR)/sqlite3.obj
+ CFLAGS += -DDATABASE_SQLITE=1
else ifeq ($(DATABASE), postgres)
- DATABASEOBJ = $(BUILDDIR)/database_pq.obj
+ DATABASEOBJ = $(BUILDDIR)/database_postgres.obj
+ CFLAGS += -DDATABASE_POSTGRESQL=1
LFLAGS += -lpq
+else ifeq ($(DATABASE), mariadb)
+ DATABASEOBJ = $(BUILDDIR)/database_mysql.obj
+ CFLAGS += -DDATABASE_MYSQL=1 -DDATABASE_MARIADB=1
+ LFLAGS += -lmariadb
else
- $(error Unsupported DATABASE: `$(DATABASE)`. Valid options are `sqlite` or `postgres`)
+ $(error Unsupported DATABASE: `$(DATABASE)`. Valid options are `sqlite`, `postgres`, or `mariadb`)
endif
$(BUILDDIR)/$(OUTPUTEXE): $(BUILDDIR)/connections.obj $(BUILDDIR)/hostcache.obj $(BUILDDIR)/query.obj $(BUILDDIR)/querymanager.obj $(BUILDDIR)/sha256.obj $(DATABASEOBJ)
@@ -58,7 +64,11 @@ $(BUILDDIR)/database_sqlite.obj: $(SRCDIR)/database_sqlite.cc $(SRCDIR)/queryman
@mkdir -p $(@D)
$(CXX) -c $(CXXFLAGS) -o $@ $<
-$(BUILDDIR)/database_pq.obj: $(SRCDIR)/database_pq.cc $(SRCDIR)/querymanager.hh
+$(BUILDDIR)/database_postgres.obj: $(SRCDIR)/database_postgres.cc $(SRCDIR)/querymanager.hh
+ @mkdir -p $(@D)
+ $(CXX) -c $(CXXFLAGS) -o $@ $<
+
+$(BUILDDIR)/database_mysql.obj: $(SRCDIR)/database_mysql.cc $(SRCDIR)/querymanager.hh
@mkdir -p $(@D)
$(CXX) -c $(CXXFLAGS) -o $@ $<