2015-09-14 14:51:07 +00:00
|
|
|
--- a/common.mk
|
|
|
|
+++ b/common.mk
|
2015-09-17 13:07:48 +00:00
|
|
|
@@ -2,6 +2,16 @@ CC := $(CROSS)gcc
|
2015-09-14 14:51:07 +00:00
|
|
|
AR := $(CROSS)ar
|
|
|
|
RANLIB := $(CROSS)ranlib
|
|
|
|
|
|
|
|
+ifeq ($(STATIC),1)
|
2015-09-17 13:07:48 +00:00
|
|
|
+ define static_link
|
|
|
|
+ -Wl,-Bstatic $(1) -Wl,-Bdynamic
|
|
|
|
+ endef
|
|
|
|
+else
|
|
|
|
+ define static_link
|
|
|
|
+ $(1)
|
|
|
|
+ endef
|
2015-09-14 14:51:07 +00:00
|
|
|
+endif
|
|
|
|
+
|
|
|
|
# Stolen from Linux build system
|
|
|
|
comma = ,
|
|
|
|
try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
|
2015-09-17 13:07:48 +00:00
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
|
|
|
@@ -89,10 +89,10 @@ obj-mkfs.jffs2 = compr_rtime.o compr_zli
|
|
|
|
compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \
|
|
|
|
compr.o rbtree.o
|
|
|
|
LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
|
|
|
|
-LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS)
|
|
|
|
+LDLIBS_mkfs.jffs2 = $(call static_link,-lz $(LZOLDLIBS))
|
2015-09-14 14:51:07 +00:00
|
|
|
|
2015-09-17 13:07:48 +00:00
|
|
|
LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
|
|
|
|
-LDLIBS_jffs2reader = -lz $(LZOLDLIBS)
|
|
|
|
+LDLIBS_jffs2reader = $(call static_link,-lz $(LZOLDLIBS))
|
2015-09-14 14:51:07 +00:00
|
|
|
|
2015-09-17 13:07:48 +00:00
|
|
|
$(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
|
|
|
|
|
|
|
|
@@ -119,7 +119,7 @@ else
|
|
|
|
XZLDLIBS = -llzma
|
|
|
|
endif
|
|
|
|
|
|
|
|
-LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid
|
|
|
|
+LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS) $(XZLDLIBS)) -lm $(call static_link,-luuid)
|
|
|
|
$(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
|
|
|
|
|
|
|
|
#
|