From f6d9f4423349b84834e8773eb24572c393e1abd1 Mon Sep 17 00:00:00 2001 From: "ugo.cirmignani" Date: Wed, 10 Apr 2019 10:00:11 +0200 Subject: [PATCH] Some preprocessor conditions --- Makefile | 22 +++++++++++----------- ftpCommandsElaborate.h | 8 ++++++-- ftpData.h | 8 ++++++-- library/configRead.c | 6 +++++- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 85663b8..fec4799 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ #Linux Generic -CC=gcc +CC=/opt/crosstool/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc OUTPATH=./build/ SOURCE_MODULES_PATH=./library/ @@ -22,14 +22,14 @@ ENABLE_LARGE_FILE_SUPPORT=-D LARGE_FILE_SUPPORT_ENABLED -D _LARGEFILE64_SOURCE ENABLE_OPENSSL_SUPPORT= #TO ENABLE OPENSSL SUPPORT UNCOMMENT NEXT 2 LINES -ENABLE_OPENSSL_SUPPORT=-D OPENSSL_ENABLED -LIBS=-lpthread -lssl -lcrypto +#ENABLE_OPENSSL_SUPPORT=-D OPENSSL_ENABLED +#LIBS=-lpthread -lssl -lcrypto ENABLE_PAM_SUPPORT= PAM_AUTH_LIB= #TO ENABLE PAM AUTH UNCOMMENT NEXT TWO LINES -ENABLE_PAM_SUPPORT= -D PAM_SUPPORT_ENABLED -PAM_AUTH_LIB= -lpam +#ENABLE_PAM_SUPPORT= -D PAM_SUPPORT_ENABLED +#PAM_AUTH_LIB= -lpam CFLAGS=$(CFLAGSTEMP) $(ENABLE_LARGE_FILE_SUPPORT) $(ENABLE_OPENSSL_SUPPORT) $(ENABLE_PAM_SUPPORT) @@ -48,16 +48,16 @@ end: uFTP: uFTP.c fileManagement.o configRead.o logFunctions.o ftpCommandElaborate.o ftpData.o ftpServer.o daemon.o signals.o connection.o openSsl.o dynamicMemory.o errorHandling.o auth.o @$(CC) $(ENABLE_LARGE_FILE_SUPPORT) $(ENABLE_OPENSSL_SUPPORT) uFTP.c $(LIBPATH)dynamicVectors.o $(LIBPATH)fileManagement.o $(LIBPATH)configRead.o $(LIBPATH)logFunctions.o $(LIBPATH)ftpCommandElaborate.o $(LIBPATH)ftpData.o $(LIBPATH)ftpServer.o $(LIBPATH)daemon.o $(LIBPATH)signals.o $(LIBPATH)connection.o $(LIBPATH)openSsl.o $(LIBPATH)dynamicMemory.o $(LIBPATH)errorHandling.o $(LIBPATH)auth.o -o $(OUTPATH)uFTP $(LIBS) $(PAM_AUTH_LIB) -daemon.o: +daemon.o: @$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)daemon.c -o $(LIBPATH)daemon.o -dynamicVectors.o: +dynamicVectors.o: @$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)dynamicVectors.c -o $(LIBPATH)dynamicVectors.o -openSsl.o: +openSsl.o: @$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)openSsl.c -o $(LIBPATH)openSsl.o - -auth.o: + +auth.o: @$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)auth.c -o $(LIBPATH)auth.o configRead.o: dynamicVectors.o fileManagement.o @@ -74,7 +74,7 @@ fileManagement.o: signals.o: @$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)signals.c -o $(LIBPATH)signals.o - + connection.o: @$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)connection.c -o $(LIBPATH)connection.o diff --git a/ftpCommandsElaborate.h b/ftpCommandsElaborate.h index ec2a4b6..fdf563e 100644 --- a/ftpCommandsElaborate.h +++ b/ftpCommandsElaborate.h @@ -37,8 +37,12 @@ #define FTP_CHMODE_COMMAND_RETURN_CODE_NO_FILE 2 #define FTP_CHMODE_COMMAND_RETURN_CODE_NO_PERMISSIONS 3 #define FTP_CHMODE_COMMAND_RETURN_NAME_TOO_LONG 4 -#include -#include + +#ifdef OPENSSL_ENABLED + #include + #include +#endif + #include "ftpData.h" #ifdef __cplusplus diff --git a/ftpData.h b/ftpData.h index ae1c049..28de355 100644 --- a/ftpData.h +++ b/ftpData.h @@ -27,8 +27,12 @@ #define FTPDATA_H #include -#include -#include + +#ifdef OPENSSL_ENABLED + #include + #include +#endif + #include "library/dynamicVectors.h" #include "library/dynamicMemory.h" diff --git a/library/configRead.c b/library/configRead.c index eed6064..6f465d3 100644 --- a/library/configRead.c +++ b/library/configRead.c @@ -30,7 +30,11 @@ #include "configRead.h" #include "../ftpData.h" #include "dynamicVectors.h" -#include "openSsl.h" + +#ifdef OPENSSL_ENABLED + #include "openSsl.h" +#endif + #include "fileManagement.h" #include "daemon.h" #include "dynamicMemory.h"