Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
all: sds-test
LIBVERSION = 2.0.0

SDS_SRC = sds.c sds.h sdsalloc.h

PREFIX ?= /usr/local
INCLUDE_PATH ?= include/sds
LIBRARY_PATH ?= lib

INSTALL_INCLUDE_PATH = $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)

INSTALL ?= cp -a

.PHONY: all

all: sds-test sds-install

sds-install: sds-lib
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
$(INSTALL) libsds.so.$(LIBVERSION) $(INSTALL_LIBRARY_PATH)
ln -s $(INSTALL_LIBRARY_PATH)/libsds.so.$(LIBVERSION) $(INSTALL_LIBRARY_PATH)/libsds.so
$(INSTALL) sds.h $(INSTALL_INCLUDE_PATH)

sds-lib: sds.c sds.h sdsalloc.h
$(CC) -fPIC -fstack-protector -std=c99 -pedantic -Wall -Werror -shared \
-o libsds.so.$(LIBVERSION) -Wl,-soname=libsds.so.$(LIBVERSION) $(SDS_SRC)

sds-test: sds.c sds.h testhelp.h
$(CC) -o sds-test sds.c -Wall -std=c99 -pedantic -O2 -DSDS_TEST_MAIN
Expand Down
1 change: 1 addition & 0 deletions sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,7 @@ int sdsTest(void) {
if (type != SDS_TYPE_5) {
test_cond("sdsMakeRoomFor() free", sdsavail(x) >= step);
oldfree = sdsavail(x);
(void) oldfree;
}
p = x+oldlen;
for (j = 0; j < step; j++) {
Expand Down
5 changes: 5 additions & 0 deletions sdsalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@
#define s_malloc malloc
#define s_realloc realloc
#define s_free free

/* GCC: Incorrect warning about empty translation units
* when using pre-compiled headers,
* (See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64502). */
typedef int sdsvoid;