summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKalle Vahlman <kalle.vahlman@movial.com>2012-06-12 09:13:27 +0300
committerKalle Vahlman <kalle.vahlman@movial.com>2012-06-12 09:13:27 +0300
commit48e0affb3f5f5e3b19c8f73b5bd445e538ec37a6 (patch)
tree1bca9b37479a3be4c251e656455dea2d39215e0a /Makefile
parent49ccd82dbfd24297702ad32b7b1568f69da49401 (diff)
Split libraries away from LDFLAGS to fix ordering
There is a linking issue if we give dependency libs before the object files on systems where ld's --as-needed is the default behaviour. If the dependency libs are listed before the objects, the symbols from those libs are not yet needed and thus the libraries are discarded.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 4 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 8a94d06..643fe9f 100644
--- a/Makefile
+++ b/Makefile
@@ -121,7 +121,8 @@ CXXFLAGS := -D__WIN32__ -O2 -mwindows -mthreads -fno-strict-aliasing -Wall $(BYT
endif
ifeq ($(BUILD_WIN),)
-LDFLAGS := -fPIC -fvisibility=hidden -lpthread -ldl -shared -Wl -o liblcdriver.$(LIB_EXTENSION)
+LDFLAGS := -fPIC -fvisibility=hidden -shared -Wl -o liblcdriver.$(LIB_EXTENSION)
+LIBS := -lpthread -ldl
else
# Win x32 linker flags
ifeq ($(BUILD_WIN),1)
@@ -183,10 +184,10 @@ endif
endif
$(LIB_x32): $(LIBOBJ_x32)
- $(CXX) $(LDFLAGS) -m32 -o $(LIB_x32) $(addprefix $(BUILDFOLDER)/$(LIB_x32_OBJ_DIR)/, $(^F))
+ $(CXX) $(LDFLAGS) -m32 -o $(LIB_x32) $(addprefix $(BUILDFOLDER)/$(LIB_x32_OBJ_DIR)/, $(^F)) $(LIBS)
$(LIB_x64): $(LIBOBJ_x64)
- $(CXX) $(LDFLAGS) -o $(LIB_x64) $(addprefix $(BUILDFOLDER)/$(LIB_x64_OBJ_DIR)/, $(^F))
+ $(CXX) $(LDFLAGS) -o $(LIB_x64) $(addprefix $(BUILDFOLDER)/$(LIB_x64_OBJ_DIR)/, $(^F)) $(LIBS)
#
# Source files build x32