1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Sort lists of libraries/source/object files
for deterministic linking order
--- a/Make.rules
+++ b/Make.rules
@@ -136,8 +136,8 @@
_libs = $(strip $(foreach _lib,$(LIBDIRS),\
$(if $(filter lib%,$(_lib)),\
$(patsubst lib%,-l%,$(_lib)),\
- $(wildcard $(srcdir)/$(_lib)/$(_lib).so \
- $(srcdir)/$(_lib)/$(_lib).a))))
+ $(sort $(wildcard $(srcdir)/$(_lib)/$(_lib).so \
+ $(srcdir)/$(_lib)/$(_lib).a)))))
override LIBS := $(_libs) -lm $(LIBS)
@@ -166,7 +166,7 @@
endif
endif
-sources = $(wildcard *.c)
+sources = $(sort $(wildcard *.c))
OBJS = $(sources:.c=.$(obj))
--- a/default.rules
+++ b/default.rules
@@ -143,7 +143,7 @@
ifeq ($(filter $(TARGET),$(EXEDIRS)),$(TARGET))
ifeq ($(filter $(TARGET),$(MODUSERS)),$(TARGET))
-MOD_OBJS = $(wildcard $(foreach dir,$(MODDIRS),$(srcdir)/$(dir)/*.o))
+MOD_OBJS = $(sort $(wildcard $(foreach dir,$(MODDIRS),$(srcdir)/$(dir)/*.o)))
ifeq ($(shared),yes)
override LDFLAGS := -rdynamic $(LDFLAGS)
endif
|