]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to generate sender and receiver according SQL type
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 24 Jun 2025 18:35:13 +0000 (14:35 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 24 Jun 2025 18:35:13 +0000 (14:35 -0400)
app/Makefile
lib/Makefile
lib/unipos.c

index d4545039b74f68fcecdd49b9bafcc4240cc2a85f..e66b888ea35c68f27490d67b993deefbe5ee2c1f 100644 (file)
@@ -22,9 +22,11 @@ clean        :
 #--------------------------------------------------------------------
 EXE=                                                           \
        chkspf                                                  \
-       receiver                                                \
+       rcvrpsql                                                \
+       rcvrmsql                                                \
        feeder                                                  \
-       sender                                                  \
+       sndrpsql                                                \
+       sndrmsql                                                \
        sorter                                                  \
 
 SRC=                                                           \
@@ -40,26 +42,10 @@ SRC=                                                                \
 CC     =  gcc 
 LD     =  gcc -g
 CFLAGS =  -I ../lib -Wall $(OPTIME)
-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
-#mariadb
-ifeq ("$(DB)","2")
-MYSQL_LIB=-lmysqlclient
-endif
+LIBMAIL        =  ../lib/libmail.a
 
 LIBS   =       $(LIBMAIL)                      \
                -luuid                          \
-               $(POSTGRESQL_LIB)               \
-               $(MYSQL_LIB)                    \
                -lcrypto                        \
                -lssl                           \
 
@@ -72,6 +58,34 @@ chkspf       :  toremake chkspf.o
 receiver:  toremake receiver.o
           @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
 
+rcvrpsql:  toremake receiver.o
+          @ $(LD) $(LDFLAGS)                           \
+                -o ../bin/$@ receiver.o                \
+                $(LIBS)                                \
+                ../lib/libpos.a                        \
+                -lpq
+
+rcvrmsql:  toremake receiver.o
+          @ $(LD) $(LDFLAGS)                           \
+                -o ../bin/$@ receiver.o                \
+                $(LIBS)                                \
+                ../lib/libmar.a                        \
+                -lmysqlclient
+
+sndrpsql:  toremake sender.o
+          @ $(LD) $(LDFLAGS)                           \
+                -o ../bin/$@ sender.o                  \
+                $(LIBS)                                \
+                ../lib/libpos.a                        \
+                -lpq
+
+sndrmsql:  toremake receiver.o
+          @ $(LD) $(LDFLAGS)                           \
+                -o ../bin/$@ sender.o                  \
+                $(LIBS)                                \
+                ../lib/libmar.a                        \
+                -lmysqlclient
+
 feeder :  toremake feeder.o
           @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
 
@@ -120,7 +134,7 @@ sender.o:  sender.c                         \
           ../lib/unisig.h                      \
           ../lib/subrou.h
 
-toremake:  Makefile $(LIBAI)
+toremake:  Makefile
           touch toremake
           - rm -f $(EXE) *.o
 
index 653557935954da124f8b47f3658f6344f92550e8..97fc739bcb78efba1538d85bb632fc06d134bb22 100644 (file)
@@ -23,17 +23,15 @@ OBJS=                                               \
          lvleml.o                              \
          gesspf.o gestcp.o geseml.o            \
          devlog.o devsoc.o devsql.o            \
-         unidns.o unieml.o unimar.o unipar.o   \
-         unipos.o uniprc.o unisig.o unitls.o   \
+         unidns.o unieml.o unipar.o            \
+         uniprc.o unisig.o unitls.o            \
          subafn.o subrou.o 
 
 LIBS=                                          \
-         libmar.o libpos.o
+         libmar.a libpos.a
 
 objs   : $(OBJS) $(LIBS)
          @ ar -cr libmail.a $(OBJS)
-         @ ar -cr libpos.a libpos.o
-         @ ar -cr libmar.a libmar.o
 
 #--------------------------------------------------------------------
 #Dependances
@@ -139,23 +137,27 @@ uniprc.h:                                 \
 unitls.h:                                      \
           subafn.h
 
-libpos.o:  subrou.h                            \
+libpos.a:  unimar.o                            \
+          subrou.h                             \
            unipos.h unipos.c
           @ $(CC)                              \
                -DDATABASE=1                    \
                -Dwith_postgres                 \
                -c                              \
                -g                              \
-               -o $@ unipos.c
+               -o libpos.o unipos.c
+         @ ar -cr libpos.a libpos.o unimar.o
 
-libmar.o:  subrou.h                            \
+libmar.a:  unipos.o                            \
+          subrou.h                             \
            unimar.h unimar.c
           @ $(CC)                              \
                -DDATABASE=2                    \
                -Dwith_mysql                    \
                -c                              \
                -g                              \
-               -o $@ unimar.c
+               -o libmar.o unimar.c
+         @ ar -cr libmar.a libmar.o unipos.o
 
 #--------------------------------------------------------------------
 
index ada3471f57bd6fe5d7ea569957f4b58e211b00be..df2c23ae348f9f0994057eeb678678575698ab47 100644 (file)
@@ -12,7 +12,7 @@
 #include        "unipos.h"
 
 //checking if MYSQL database need to compiled
-#if DATABASE==USE_POSTGRESQL || DATABSE==USE_ALLDB
+#if DATABASE==USE_POSTGRESQL
   #define DB_POSTGRESQL
 #endif