diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 8d69c63..8700499 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + diff --git a/README.md b/README.md index 3e79db1..9141ca4 100644 --- a/README.md +++ b/README.md @@ -111,14 +111,9 @@ 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, `-lredisx -lxchange` will be added automatically. + - `LDFLAGS`: Extra linker flags (default: _not set_). Note, `-lm -lredisx -lxchange -pthread` will be added + automatically. - - `THREADS`: Linker flags for the __pthread__ library. It will be added to `LDFLAGS` automatically. (default: - `-pthread`) - - - `RTLIB`: Linker flags fo linking against a realtime (if necessary). It will be added to `LDFLAGS` - automatically. (default: empty) - - `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 5b821ca..9fc59b5 100644 --- a/config.mk +++ b/config.mk @@ -1,6 +1,6 @@ # =========================================================================== -# Generic configuration options for building the RedisX library (both static -# and shared). +# Generic configuration options for building the SMA-X client library (both +# static and shared). # # You can include this snipplet in your Makefile also. # ============================================================================ @@ -38,31 +38,17 @@ CFLAGS ?= -Os -Wall -std=c99 # Extra warnings (not supported on all compilers) #CFLAGS += -Wextra -# Link against math libs (for e.g. isnan()) -LDFLAGS ?= -lm +# Extra link flags (if any) +#LDFLAGS = # Link flags to use for threading with pthread THREADS ?= -pthread -# Runtime libraries to link against (if any) -#RTLIB ?= -lrt +# Link flags required for network functions (if any) to include in LDFLAGS +#NETFLAGS = -lnsl -# 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 += -lredisx -lxchange $(RTLIB) $(THREADS) +# Link flags required for OS calls (if any) to include in LDFLAGS +#OSFLAGS = # cppcheck options for 'check' target CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \ @@ -87,6 +73,32 @@ ifeq ($(BUILD_MODE),debug) CFLAGS += -g -DDEBUG endif +ifdef OSFLAGS + LDFLAGS += $(OSFLAGS) +endif + +ifdef NETFLAGS + LDFLAGS += $(NETFLAGS) +endif + +# Links against pthread and dependencies +LDFLAGS += $(THREADS) -lredisx -lxchange + +# 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) diff --git a/test.mk b/test.mk index 3c88149..e82c698 100644 --- a/test.mk +++ b/test.mk @@ -6,11 +6,19 @@ LDFLAGS += -L$(LIB) -lsmax LD_LIBRARY_PATH := $(LIB):$(LD_LIBRARY_PATH) - TESTS = $(BIN)/simpleIntTest $(BIN)/simpleIntsTest $(BIN)/structTest $(BIN)/queueTest $(BIN)/lazyTest \ $(BIN)/waitTest $(BIN)/resilientTest # Top level make targets... -all: $(TESTS) +build: $(TESTS) + +run: build + $(BIN)/simpleIntTest + $(BIN)/simpleIntsTest + $(BIN)/structTest + $(BIN)/queueTest + $(BIN)/lazyTest + $(BIN)/waitTest + $(BIN)/resilientTest include build.mk \ No newline at end of file