]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to produce SQL different library
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 24 Jun 2025 18:13:50 +0000 (14:13 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 24 Jun 2025 18:13:50 +0000 (14:13 -0400)
lib/Makefile
lib/subrou.h
lib/unimar.c
sql/mailleur.mysql [deleted file]
sql/mailleur.postg [deleted file]

index a1d460e504a54f5d0f0b5a5feea69191160f474a..653557935954da124f8b47f3658f6344f92550e8 100644 (file)
@@ -27,8 +27,13 @@ OBJS=                                                \
          unipos.o uniprc.o unisig.o unitls.o   \
          subafn.o subrou.o 
 
-objs   : $(OBJS)
-         @ ar -cr $(LIBMAIL) $(OBJS)
+LIBS=                                          \
+         libmar.o libpos.o
+
+objs   : $(OBJS) $(LIBS)
+         @ ar -cr libmail.a $(OBJS)
+         @ ar -cr libpos.a libpos.o
+         @ ar -cr libmar.a libmar.o
 
 #--------------------------------------------------------------------
 #Dependances
@@ -134,6 +139,24 @@ uniprc.h:                                  \
 unitls.h:                                      \
           subafn.h
 
+libpos.o:  subrou.h                            \
+           unipos.h unipos.c
+          @ $(CC)                              \
+               -DDATABASE=1                    \
+               -Dwith_postgres                 \
+               -c                              \
+               -g                              \
+               -o $@ unipos.c
+
+libmar.o:  subrou.h                            \
+           unimar.h unimar.c
+          @ $(CC)                              \
+               -DDATABASE=2                    \
+               -Dwith_mysql                    \
+               -c                              \
+               -g                              \
+               -o $@ unimar.c
+
 #--------------------------------------------------------------------
 
 toremake:  Makefile
@@ -143,18 +166,12 @@ toremake:  Makefile
 #--------------------------------------------------------------------
 .PHONY:        clean
 #--------------------------------------------------------------------
-#to set the compiled default library
-ifeq ($(strip $(DB)),)
-DB=0
-endif
-#--------------------------------------------------------------------
 CC     = gcc
 LD     = gcc
 CFLAGS = -Wall -D_GNU_SOURCE                                   \
-         -DDATABASE=$(DB)                                      \
          -Dwith_postgres                                       \
          -Dwith_mysql                                          \
          $(OPTIME)
-LIBMAIL        = libmail.a
+LIBMAIL        = libmail.a libmar.a libpos.a
 PAR    = -j`/usr/bin/getconf _NPROCESSORS_ONLN`
 #--------------------------------------------------------------------
index d79025e685605c3d17fffd0ed021fcd426df9862..89597981e9090443052448c4396aa88f42dffe18 100644 (file)
@@ -20,7 +20,7 @@
 #define ITSOK   0               //to check errno against no error
 
 //defining database #define
-#define USE_ALLDB       0       //All database type need to be linked
+#define USE_NODB        0       //No DB TYPE defined
 #define USE_POSTGRESQL  1
 #define USE_MYSQL       2
 
index 384b50dacd5a5976d0cb2e8c13466358f0c29186..a3013c1ec0de3b3efc5f9e6a218a8136822ef87a 100644 (file)
@@ -16,7 +16,7 @@
 #include        "unimar.h"
 
 //checking if MYSQL database need to compiled
-#if DATABASE==USE_MYSQL || DATABSE==USE_ALLDB
+#if DATABASE==USE_MYSQL
   #define DB_MYSQL
 #endif
 
diff --git a/sql/mailleur.mysql b/sql/mailleur.mysql
deleted file mode 100644 (file)
index 3dffd8c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE emails (
- email TEXT,
- space INTEGER
-  DEFAULT 0,
- mxspace INTEGER
-  DEFAULT 20000
- );
diff --git a/sql/mailleur.postg b/sql/mailleur.postg
deleted file mode 100644 (file)
index 3dffd8c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE emails (
- email TEXT,
- space INTEGER
-  DEFAULT 0,
- mxspace INTEGER
-  DEFAULT 20000
- );