Skip to content

Commit 2337d73

Browse files
committed
Don't use ld(1) option --version-script on Darwin (OS X)
The linker on OS X does not support the --version-script flag. This commit detects the Darwin/OS X OS in the Makefile and doesn't use the flag in that case. This is commit is mostly to keep the code compiling on OS X and to document the issue. Signed-off-by: Christian Lindig <[email protected]>
1 parent 2204b0c commit 2337d73

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@
1111

1212
NAME = rrd-client-lib
1313
VERSION = 1.1.0
14+
OS := $(shell uname)
1415

1516
CC = gcc
1617
CFLAGS = -std=gnu99 -g -fpic -Wall
1718
OBJ += librrd.o
1819
OBJ += parson/parson.o
1920
LIB += -lz
2021

22+
ifeq ($(OS),Darwin)
23+
LDFLAGS = -shared -Wl
24+
else
25+
LDFLAGS = -shared -Wl,--version-script=version.script
26+
endif
2127

2228
.PHONY: all
2329
all: librrd.a librrd.so rrdtest rrdclient
@@ -68,7 +74,7 @@ librrd.a: $(OBJ)
6874
ranlib $@
6975

7076
librrd.so: $(OBJ)
71-
$(CC) -shared -Wl,--version-script=version.script -o $@ $(OBJ) $(LIB)
77+
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIB)
7278

7379
rrdtest: rrdtest.o librrd.a
7480
$(CC) $(CFLAGS) -o $@ $^ $(LIB)

travis-ci.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ make
1515
make valgrind
1616
make test
1717
make test-integration
18+
make clean

0 commit comments

Comments
 (0)