From 7e135db07a82256191a83355216ae7b21479d979 Mon Sep 17 00:00:00 2001 From: Attila Kovacs Date: Fri, 20 Sep 2024 08:43:57 +0200 Subject: [PATCH] Makefile reorg and site update --- .settings/language.settings.xml | 4 +- README.md | 4 +- config.mk | 67 +++++++++++++++++---------------- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 7e7fd08..4a70856 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -4,8 +4,8 @@ - - + + diff --git a/README.md b/README.md index 0cb2ab0..2521a4d 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,8 @@ prior to invoking `make`. The following build variables can be configured: - `CFLAGS`: Flags to pass onto the C compiler (default: `-Os -Wall -std=c99`). Note, `-Iinclude` will be added automatically. - - `LDFLAGS`: Linker flags (default is `-lm`). Note, `-lpq -lsmax -lredisx -lxchange -lpthread -lpopt` will be added - automatically. + - `LDFLAGS`: Extra linker flags (default: _not set_). Note, `-lm -pthread -lsmax -lredisx -lxchange -lpq -lpopt` will + be added automatically. - `BUILD_MODE`: You can set it to `debug` to enable debugging features: it will initialize the global `xDebug` variable to `TRUE` and add `-g` to `CFLAGS`. diff --git a/config.mk b/config.mk index d57c00b..242aa13 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,5 @@ # =========================================================================== -# Generic configuration options for building the RedisX library (both static -# and shared). +# Generic configuration options for building smax-postgres # # You can include this snipplet in your Makefile also. # ============================================================================ @@ -58,37 +57,6 @@ CFLAGS ?= -Os -Wall -std=c99 # Link against math libs (for e.g. isnan()) LDFLAGS ?= -lm -# Compile and link against a specific PostgreSQL library (if defined) -ifdef PGDIR - CPPFLAGS += -I$(PGDIR)/include - LDFLAGS += -L$(PGDIR)/lib - LD_LIBRARY_PATH = $(PGDIR)/lib:$(LD_LIBRARY_PATH) -endif - -# Compile and link against a specific smax library (if defined) -ifdef SMAXLIB - CPPFLAGS += -I$(SMAXLIB)/include - LDFLAGS += -L$(SMAXLIB)/lib - LD_LIBRARY_PATH = $(SMAXLIB)/lib:$(LD_LIBRARY_PATH) -endif - -# Compile and link against a specific redisx library (if defined) -ifdef REDISX - CPPFLAGS += -I$(REDISX)/include - LDFLAGS += -L$(REDISX)/lib - LD_LIBRARY_PATH = $(REDISX)/lib:$(LD_LIBRARY_PATH) -endif - -# Compile and link against a specific xchange library (if defined) -ifdef XCHANGE - CPPFLAGS += -I$(XCHANGE)/include - LDFLAGS += -L$(XCHANGE)/lib - LD_LIBRARY_PATH = $(XCHANGE)/lib:$(LD_LIBRARY_PATH) -endif - -# Always link against the xchange lib. -LDFLAGS += -lsmax -lredisx -lxchange -lpq - # cppcheck options for 'check' target CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \ --error-exitcode=1 --std=c11 $(CHECKEXTRA) @@ -116,11 +84,44 @@ ifeq ($(BUILD_MODE),debug) CFLAGS += -g -DDEBUG endif +# Always link against dependencies +LDFLAGS += -lm -lsmax -lredisx -lxchange -lpq + ifeq ($(SYSTEMD),1) DFLAGS += -DUSE_SYSTEMD=1 LDFLAGS += -lsystemd endif +# Compile and link against a specific PostgreSQL library (if defined) +ifdef PGDIR + CPPFLAGS += -I$(PGDIR)/include + LDFLAGS += -L$(PGDIR)/lib + LD_LIBRARY_PATH = $(PGDIR)/lib:$(LD_LIBRARY_PATH) +endif + +# Compile and link against a specific smax library (if defined) +ifdef SMAXLIB + CPPFLAGS += -I$(SMAXLIB)/include + LDFLAGS += -L$(SMAXLIB)/lib + LD_LIBRARY_PATH = $(SMAXLIB)/lib:$(LD_LIBRARY_PATH) +endif + +# Compile and link against a specific redisx library (if defined) +ifdef REDISX + CPPFLAGS += -I$(REDISX)/include + LDFLAGS += -L$(REDISX)/lib + LD_LIBRARY_PATH = $(REDISX)/lib:$(LD_LIBRARY_PATH) +endif + +# Compile and link against a specific xchange library (if defined) +ifdef XCHANGE + CPPFLAGS += -I$(XCHANGE)/include + LDFLAGS += -L$(XCHANGE)/lib + LD_LIBRARY_PATH = $(XCHANGE)/lib:$(LD_LIBRARY_PATH) +endif + + + # Search for files in the designated locations vpath %.h $(INC) vpath %.c $(SRC)