From c1ef87d64e1918797562f3dd871fbe19d02ce34c Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Tue, 24 Jun 2025 14:35:13 -0400 Subject: [PATCH] Able to generate sender and receiver according SQL type --- app/Makefile | 54 +++++++++++++++++++++++++++++++++------------------- lib/Makefile | 20 ++++++++++--------- lib/unipos.c | 2 +- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/app/Makefile b/app/Makefile index d454503..e66b888 100644 --- a/app/Makefile +++ b/app/Makefile @@ -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 diff --git a/lib/Makefile b/lib/Makefile index 6535579..97fc739 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 #-------------------------------------------------------------------- diff --git a/lib/unipos.c b/lib/unipos.c index ada3471..df2c23a 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 || DATABSE==USE_ALLDB +#if DATABASE==USE_POSTGRESQL #define DB_POSTGRESQL #endif -- 2.47.3