more robust development files in target handler
authorJohn Voltz <john.voltz@gmail.com>
Tue, 11 Mar 2008 13:12:39 +0000 (13:12 -0000)
committerJohn Voltz <john.voltz@gmail.com>
Tue, 11 Mar 2008 13:12:39 +0000 (13:12 -0000)
Makefile
scripts/copy.sh [new file with mode: 0755]

index e1d537a49cb43a059cdf6f5338465be296522fd4..1aca7885a9fdcdd01bcac465d36b41135e9d59b7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -242,10 +242,12 @@ endif
 
 include package/*/*.mk
 
+TARGETS+=target-devfiles
+
 # target stuff is last so it can override anything else
 include target/Makefile.in
 
-TARGETS+=erase-fakeroots target-devfiles
+TARGETS+=erase-fakeroots 
 
 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
@@ -318,18 +320,14 @@ erase-fakeroots:
        rm -f $(PROJECT_BUILD_DIR)/.fakeroot*
 
 target-devfiles:
-ifeq ($(strip $(BR2_HAVE_DEVFILES)),y)
-       cp -a $(STAGING_DIR)/usr/include $(TARGET_DIR)/usr
-       cp $(STAGING_DIR)/usr/lib/*.a $(TARGET_DIR)/usr/lib
-       cp $(STAGING_DIR)/lib/*.a $(TARGET_DIR)/lib
-       cp $(STAGING_DIR)/usr/lib/*.la $(TARGET_DIR)/usr/lib
-       cp $(STAGING_DIR)/lib/*.la $(TARGET_DIR)/lib
+ifeq ($(BR2_HAVE_DEVFILES),y)
+       ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
 else
        rm -rf $(TARGET_DIR)/usr/include
-       find $(TARGET_DIR)/usr/lib -name '*.a' -delete
-       find $(TARGET_DIR)/lib -name '*.a' -delete
-       find $(TARGET_DIR)/usr/lib -name '*.la' -delete
-       find $(TARGET_DIR)/lib -name '*.la' -delete
+       find $(TARGET_DIR)/usr/lib -name '*.a' -delete 
+       find $(TARGET_DIR)/lib -name '*.a' -delete 
+       find $(TARGET_DIR)/usr/lib -name '*.la' -delete 
+       find $(TARGET_DIR)/lib -name '*.la' -delete 
 endif
 
 source: $(TARGETS_SOURCE) $(HOST_SOURCE)
diff --git a/scripts/copy.sh b/scripts/copy.sh
new file mode 100755 (executable)
index 0000000..613c4dd
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+STAGING_DIR=$1
+TARGET_DIR=$2
+
+echo "Copying development files to target..."
+
+cp -a ${STAGING_DIR}/usr/include ${TARGET_DIR}/usr
+
+for LIBSDIR in /lib /usr/lib; do
+       for WILDCARD in *.a *.la; do
+               for FILE_PATH in `find ${STAGING_DIR}${LIBSDIR} -name ${WILDCARD}`; do
+                       STAGING_STRIPPED=${FILE_PATH##${STAGING_DIR}}
+                       EXTENDED_DIR=${PATH_FILE%/${WILDCARD}}
+                       mkdir -p ${TARGET_DIR}${EXTENDED_DIR}
+                       cp ${FILE_PATH} ${TARGET_DIR}${STAGING_STRIPPED}
+                       #echo ${TARGET_DIR}${STAGING_STRIPPED}
+               done
+       done
+done