summaryrefslogtreecommitdiffstats
path: root/toolchain/mklibs/mklibs.mk
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2006-08-02 21:19:09 +0000
committerEric Andersen <andersen@codepoet.org>2006-08-02 21:19:09 +0000
commit9ab4e56e94d56848a3e883e4e1610986a523dbe5 (patch)
treef32e19010ef0d52d8b1b9d86fbc7b9aad9ac230c /toolchain/mklibs/mklibs.mk
parent54044da9735da1e0abe78f04a96e8d29abef6d60 (diff)
downloadbuildroot-novena-9ab4e56e94d56848a3e883e4e1610986a523dbe5.tar.gz
buildroot-novena-9ab4e56e94d56848a3e883e4e1610986a523dbe5.zip
Add support for mklibs (strips unused syms from shared libs such as uClibc)
based on a patch from akvadrako, and using a version of mklibs.py that was massively hacked up by andersee and mjn3 for uClibc support.
Diffstat (limited to 'toolchain/mklibs/mklibs.mk')
-rw-r--r--toolchain/mklibs/mklibs.mk49
1 files changed, 49 insertions, 0 deletions
diff --git a/toolchain/mklibs/mklibs.mk b/toolchain/mklibs/mklibs.mk
new file mode 100644
index 000000000..b7010176a
--- /dev/null
+++ b/toolchain/mklibs/mklibs.mk
@@ -0,0 +1,49 @@
+######################################################################
+#
+# mklibs
+#
+######################################################################
+MKLIBS_PROGRAM:=$(STAGING_DIR)/bin/mklibs.py
+
+$(MKLIBS_PROGRAM): toolchain/mklibs/mklibs.py
+ cp -a toolchain/mklibs/mklibs.py $@
+
+mklibs-clean:
+ rm -f $(MKLIBS_PROGRAM)
+
+mklibs-dirclean:
+ true
+
+#############################################################
+#
+# Run mklibs
+#
+#############################################################
+MKLIBS_PYTHON:=$(shell which python)
+ifeq ($(MKLIBS_PYTHON),)
+ MKLIBS_PYTHON=/usr/bin/python
+endif
+
+$(STAGING_DIR)/mklibs-stamp: $(MKLIBS_PROGRAM) $(MKLIBS_PYTHON) $(STAGING_DIR)/lib/*
+ find $(TARGET_DIR) -type f -perm +100 -exec \
+ file -r -N -F '' {} + | \
+ awk ' /executable.*dynamically/ { print $$1 }' > $(STAGING_DIR)/mklibs-progs
+ cd $(TARGET_DIR); PATH=$(PATH):$(STAGING_DIR)/bin $(MKLIBS_PYTHON) $(MKLIBS_PROGRAM) \
+ --target $(REAL_GNU_TARGET_NAME) --root $(STAGING_DIR) -d ./ \
+ `cat $(STAGING_DIR)/mklibs-progs`
+ touch $@
+
+# this empty target allows a mklibs dependeny to be included in the
+# target targets, but it will be only invoked if BR2_MKLIBS is conf'ed
+.PHONY: mklibs
+mklibs:
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+
+ifeq ($(strip $(BR2_MKLIBS)),y)
+mklibs: $(STAGING_DIR)/mklibs-stamp
+endif