Objects should generally be listed before the libraries they require.
DLM building fails for me without these changes.

Signed-off-by: Jacek Konieczny <jaj...@jajcus.net>
---
 dlm_controld/Makefile | 4 ++--
 dlm_tool/Makefile     | 2 +-
 fence/Makefile        | 2 +-
 libdlm/Makefile       | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile
index d279b0d..f42a913 100644
--- a/dlm_controld/Makefile
+++ b/dlm_controld/Makefile
@@ -62,10 +62,10 @@ LIB_LDFLAGS += -Wl,-z,relro -pie
 all: $(LIB_TARGET) $(BIN_TARGET)
 
 $(BIN_TARGET): $(BIN_SOURCE)
-       $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ -L.
+       $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L.
 
 $(LIB_TARGET): $(LIB_SOURCE)
-       $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -fPIC -o $@ 
-Wl,-soname=$(LIB_SMAJOR) $^
+       $(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -fPIC -o $@ 
-Wl,-soname=$(LIB_SMAJOR)
        ln -sf $(LIB_TARGET) $(LIB_SO)
        ln -sf $(LIB_TARGET) $(LIB_SMAJOR)
 
diff --git a/dlm_tool/Makefile b/dlm_tool/Makefile
index fe43677..c16d8f5 100644
--- a/dlm_tool/Makefile
+++ b/dlm_tool/Makefile
@@ -39,7 +39,7 @@ BIN_LDFLAGS += -lpthread -ldlm -ldlmcontrol
 all: $(BIN_TARGET)
 
 $(BIN_TARGET): $(BIN_SOURCE)
-       $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@
+       $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@
 
 clean:
        rm -f *.o *.so *.so.* $(BIN_TARGET)
diff --git a/fence/Makefile b/fence/Makefile
index 0f1a29c..b4c59dd 100644
--- a/fence/Makefile
+++ b/fence/Makefile
@@ -40,7 +40,7 @@ BIN_LDFLAGS += -ldl
 all: $(BIN_TARGET)
 
 $(BIN_TARGET): $(BIN_SOURCE)
-       $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ -L.
+       $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L.
 
 clean:
        rm -f *.o *.so *.so.* $(BIN_TARGET)
diff --git a/libdlm/Makefile b/libdlm/Makefile
index 565a600..76d3504 100644
--- a/libdlm/Makefile
+++ b/libdlm/Makefile
@@ -86,18 +86,18 @@ LLT_LDFLAGS += $(LDFLAGS)
 all: $(LIB_TARGET) $(LLT_TARGET) $(LIB_PC) $(LLT_PC)
 
 $(LIB_O): $(SOURCE) 
-       $(CC) $(LIB_CFLAGS) -c -o $@ $<
+       $(CC) $< $(LIB_CFLAGS) -c -o $@
 
 $(LLT_O): $(SOURCE) 
-       $(CC) $(LLT_CFLAGS) -c -o $@ $<
+       $(CC) $< $(LLT_CFLAGS) -c -o $@
 
 $(LIB_TARGET): $(LIB_O)
-       $(CC) $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR) $^
+       $(CC) $^ $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR)
        ln -sf $(LIB_TARGET) $(LIB_SO)
        ln -sf $(LIB_TARGET) $(LIB_SMAJOR)
 
 $(LLT_TARGET): $(LLT_O)
-       $(CC) $(LLT_LDFLAGS) -shared -o $@ -Wl,-soname=$(LLT_SMAJOR) $^
+       $(CC) $^ $(LLT_LDFLAGS) -shared -o $@ -Wl,-soname=$(LLT_SMAJOR)
        ln -sf $(LLT_TARGET) $(LLT_SO)
        ln -sf $(LLT_TARGET) $(LLT_SMAJOR)
 
-- 
1.7.12.4

Reply via email to