From 4b9265371d96b2b6f94440ddc283fa7c1ac9172f Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Tue, 24 Jun 2025 09:57:35 -0400 Subject: [PATCH] Able to compile BOTH database --- Makefile | 2 +- app/Makefile | 4 ++++ lib/Makefile | 2 +- lib/subrou.h | 2 +- lib/unimar.c | 2 +- lib/unipos.c | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2b18f1c..80dea0c 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,7 @@ APPNAME = mailleur #-------------------------------------------------------------------- #to set the compiled default library ifeq ($(strip $(DB)),) -DB=1 +DB=0 endif #-------------------------------------------------------------------- #Managing testarea diff --git a/app/Makefile b/app/Makefile index b185af3..d454503 100644 --- a/app/Makefile +++ b/app/Makefile @@ -44,6 +44,10 @@ LIBMAIL= ../lib/libmail.a #linking according database #postgresql +ifeq ("$(DB)","0") +POSTGRESQL_LIB=-lpq +MYSQL_LIB=-lmysqlclient +endif ifeq ("$(DB)","1") POSTGRESQL_LIB=-lpq endif diff --git a/lib/Makefile b/lib/Makefile index d663038..a1d460e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -145,7 +145,7 @@ toremake: Makefile #-------------------------------------------------------------------- #to set the compiled default library ifeq ($(strip $(DB)),) -DB=1 +DB=0 endif #-------------------------------------------------------------------- CC = gcc diff --git a/lib/subrou.h b/lib/subrou.h index 90d256e..d79025e 100644 --- a/lib/subrou.h +++ b/lib/subrou.h @@ -20,7 +20,7 @@ #define ITSOK 0 //to check errno against no error //defining database #define -#define USE_NODB 0 //No data base to be linked +#define USE_ALLDB 0 //All database type need to be linked #define USE_POSTGRESQL 1 #define USE_MYSQL 2 diff --git a/lib/unimar.c b/lib/unimar.c index a3013c1..384b50d 100644 --- a/lib/unimar.c +++ b/lib/unimar.c @@ -16,7 +16,7 @@ #include "unimar.h" //checking if MYSQL database need to compiled -#if DATABASE==USE_MYSQL +#if DATABASE==USE_MYSQL || DATABSE==USE_ALLDB #define DB_MYSQL #endif diff --git a/lib/unipos.c b/lib/unipos.c index df2c23a..ada3471 100644 --- a/lib/unipos.c +++ b/lib/unipos.c @@ -12,7 +12,7 @@ #include "unipos.h" //checking if MYSQL database need to compiled -#if DATABASE==USE_POSTGRESQL +#if DATABASE==USE_POSTGRESQL || DATABSE==USE_ALLDB #define DB_POSTGRESQL #endif -- 2.47.3