Skip to content

Commit

Permalink
Makefile reorg and site update
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Sep 20, 2024
1 parent 495f67e commit 39daa5c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="([^/\\\\]*)((g?cc)|([gc]\+\+)|(clang))" prefer-non-shared="true"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="533368308517884254" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="533476417727484254" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
56 changes: 34 additions & 22 deletions config.mk
Original file line number Diff line number Diff line change
@@ -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.
# ============================================================================
Expand Down Expand Up @@ -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 \
Expand All @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 39daa5c

Please sign in to comment.