Skip to content

Commit 8894366

Browse files
Properly link the shared libtinycbor.so to -lm
The hosted version makes use of math functions (usually, we don't test that CBOR_NO_FLOATING_POINT is defined). Signed-off-by: Thiago Macieira <[email protected]>
1 parent 4d15639 commit 8894366

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pkgconfigdir = $(libdir)/pkgconfig
99
CFLAGS = -Wall -Wextra
1010
LDFLAGS_GCSECTIONS = -Wl,--gc-sections
1111
LDFLAGS += $(if $(gc_sections-pass),$(LDFLAGS_GCSECTIONS))
12+
LDLIBS = -lm
1213

1314
GIT_ARCHIVE = git archive --prefix="$(PACKAGE)/" -9
1415
INSTALL = install
@@ -139,16 +140,16 @@ lib/libtinycbor.a: $(TINYCBOR_SOURCES:.c=.o)
139140

140141
lib/libtinycbor.so: $(TINYCBOR_SOURCES:.c=.pic.o)
141142
@$(MKDIR) -p lib
142-
$(CC) -shared -Wl,-soname,libtinycbor.so.$(SOVERSION) -o lib/libtinycbor.so.$(VERSION) $(LDFLAGS) $^
143+
$(CC) -shared -Wl,-soname,libtinycbor.so.$(SOVERSION) -o lib/libtinycbor.so.$(VERSION) $(LDFLAGS) $^ $(LDLIBS)
143144
cd lib ; ln -sf libtinycbor.so.$(VERSION) libtinycbor.so ; ln -sf libtinycbor.so.$(VERSION) libtinycbor.so.$(SOVERSION)
144145

145146
bin/cbordump: $(CBORDUMP_SOURCES:.c=.o) $(BINLIBRARY)
146147
@$(MKDIR) -p bin
147-
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) -lm
148+
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
148149

149150
bin/json2cbor: $(JSON2CBOR_SOURCES:.c=.o) $(BINLIBRARY)
150151
@$(MKDIR) -p bin
151-
$(CC) -o $@ $(LDFLAGS) $^ $(LDFLAGS_CJSON) $(LDLIBS) -lm
152+
$(CC) -o $@ $(LDFLAGS) $^ $(LDFLAGS_CJSON) $(LDLIBS)
152153

153154
tinycbor.pc: tinycbor.pc.in
154155
$(SED) > $@ < $< \

0 commit comments

Comments
 (0)