2008-07-29 06:36:11 +03:00
#
2010-03-05 22:28:52 +02:00
# Copyright (C) 2006-2010 OpenWrt.org
2006-07-21 12:15:06 +03:00
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
2007-07-30 21:22:01 +03:00
curdir := package
- i n c l u d e $( TMP_DIR ) / . p a c k a g e d e p s
$(curdir)/builddirs : =$( sort $ ( package -) $ ( package -y ) $ ( package -m ) )
2007-12-14 02:33:25 +02:00
i f e q ( $( SDK ) , 1 )
$( curdir) /builddirs-install:= .
e l s e
$( curdir) /builddirs-default:= . $( sort $( package-y) $( package-m) )
$( curdir) /builddirs-prereq:= . $( sort $( prereq-y) $( prereq-m) )
$( curdir) /builddirs-install:= . $( sort $( package-y) )
e n d i f
2008-05-07 19:45:00 +03:00
i f n e q ( $( IGNORE_ERRORS ) , )
2010-11-02 18:38:57 +02:00
$( curdir) /builddirs-ignore-compile:= $( if $( filter n m y, $( IGNORE_ERRORS) ) ,$( foreach m,$( IGNORE_ERRORS) ,$( package-$( subst n,,$( m) ) ) ) ,$( package-m) $( package-) )
2008-05-07 19:45:00 +03:00
e n d i f
2007-07-30 21:22:01 +03:00
$(curdir)/install : =$( curdir ) /install -cleanup
2007-08-01 01:54:21 +03:00
2007-08-01 11:21:15 +03:00
$(curdir)/cleanup : $( TMP_DIR ) /.build
2010-03-05 22:28:52 +02:00
- find $( STAGING_DIR_ROOT) -type d | $( XARGS) chmod 0755
2009-08-08 00:58:35 +03:00
rm -rf $( TARGET_DIR) $( STAGING_DIR_ROOT)
2007-08-01 01:54:21 +03:00
2009-08-08 05:25:03 +03:00
i f d e f C O N F I G _ U S E _ M K L I B S
define mklibs
rm -rf $( TMP_DIR) /mklibs-progs $( TMP_DIR) /mklibs-out
# first find all programs and add them to the mklibs list
find $( STAGING_DIR_ROOT) -type f -perm +100 -exec \
file -r -N -F '' { } + | \
awk ' /executable.*dynamically/ { print $$1 }' > $( TMP_DIR) /mklibs-progs
# find all loadable objects that are not regular libraries and add them to the list as well
find $( STAGING_DIR_ROOT) -type f -name \* .so\* -exec \
file -r -N -F '' { } + | \
awk ' /shared object/ { print $$1 }' >> $( TMP_DIR) /mklibs-progs
mkdir -p $( TMP_DIR) /mklibs-out
2009-08-08 05:37:59 +03:00
$( STAGING_DIR_HOST) /bin/mklibs.py -D \
2009-08-08 05:25:03 +03:00
-d $( TMP_DIR) /mklibs-out \
--sysroot $( STAGING_DIR_ROOT) \
-L /lib \
-L /usr/lib \
2010-03-05 22:28:52 +02:00
-L /usr/lib/ebtables \
2009-08-08 05:25:03 +03:00
--ldlib $( patsubst $( STAGING_DIR_ROOT) /%,/%,$( firstword $( wildcard \
2010-03-05 22:28:52 +02:00
$( foreach name,ld-uClibc.so.* ld-linux.so.* ld-*.so, \
2009-08-08 05:25:03 +03:00
$( STAGING_DIR_ROOT) /lib/$( name) \
) ) ) ) \
--target $( REAL_GNU_TARGET_NAME) \
` cat $( TMP_DIR) /mklibs-progs` 2>& 1
$( RSTRIP) $( TMP_DIR) /mklibs-out
for lib in ` ls $( TMP_DIR) /mklibs-out/*.so.* 2>/dev/null` ; do \
LIB = " $$ {lib##*/} " ; \
DEST = "`ls " $( TARGET_DIR) /lib/$$ LIB" " $( TARGET_DIR) /usr/lib/$$ LIB" 2>/dev/null`" ; \
[ -n " $$ DEST " ] || continue ; \
echo " Copying stripped library $$ lib to $$ DEST " ; \
cp " $$ lib " " $$ DEST " || exit 1; \
done
endef
e n d i f
2007-08-01 11:21:15 +03:00
$(curdir)/rootfs-prepare : $( TMP_DIR ) /.build
2007-09-21 20:01:46 +03:00
@-$( MAKE) package/preconfig
2006-12-01 16:01:31 +02:00
@if [ -d $( TOPDIR) /files ] ; then \
2011-01-23 22:59:13 +02:00
( cd $( TOPDIR) /files; find -type f ) | \
( cd $( TARGET_DIR) ; while :; do \
read FILE; \
[ -z " $$ FILE " ] && break; \
[ -L " $$ FILE " ] || continue ; \
echo " Removing symlink $( TARGET_DIR) / $$ FILE " ; \
rm -f " $$ FILE " ; \
done ; ) ; \
2007-08-07 03:04:25 +03:00
$( CP) $( TOPDIR) /files/. $( TARGET_DIR) ; \
2006-12-01 16:01:31 +02:00
fi
2007-08-07 03:04:25 +03:00
@mkdir -p $( TARGET_DIR) /etc/rc.d
2006-10-16 00:03:30 +03:00
@( \
2007-08-07 03:04:25 +03:00
cd $( TARGET_DIR) ; \
2006-10-16 00:03:30 +03:00
for script in ./etc/init.d/*; do \
grep '#!/bin/sh /etc/rc.common' $$ script >/dev/null || continue ; \
2008-09-02 03:23:59 +03:00
IPKG_INSTROOT = $( TARGET_DIR) $$ ( which bash) ./etc/rc.common $$ script enable; \
2007-03-16 05:02:31 +02:00
done || true \
2006-10-16 00:03:30 +03:00
)
2007-08-07 03:04:25 +03:00
@-find $( TARGET_DIR) -name CVS | $( XARGS) rm -rf
@-find $( TARGET_DIR) -name .svn | $( XARGS) rm -rf
@-find $( TARGET_DIR) -name '.#*' | $( XARGS) rm -f
2009-10-06 07:50:53 +03:00
$( if $( CONFIG_CLEAN_IPKG) ,rm -rf $( TARGET_DIR) /usr/lib/opkg)
2009-08-08 05:25:03 +03:00
$( call mklibs)
2007-08-01 11:21:15 +03:00
$(curdir)/index : FORCE
2008-07-29 06:36:11 +03:00
@( cd $( PACKAGE_DIR) ; $( SCRIPT_DIR) /ipkg-make-index.sh . > Packages && \
gzip -9c Packages > Packages.gz \
)
2006-07-30 20:09:22 +03:00
2007-07-31 00:14:08 +03:00
$(curdir)/flags-install : = -j 1
2007-08-31 01:43:25 +03:00
$( eval $ ( call stampfile ,$ ( curdir ) ,package ,prereq ,.config ) )
2010-07-28 05:18:16 +03:00
$( eval $ ( call stampfile ,$ ( curdir ) ,package ,cleanup ,$ ( TMP_DIR ) /.build ) )
$( eval $ ( call stampfile ,$ ( curdir ) ,package ,compile ,$ ( TMP_DIR ) /.build ) )
$( eval $ ( call stampfile ,$ ( curdir ) ,package ,install ,$ ( TMP_DIR ) /.build ) )
$( eval $ ( call stampfile ,$ ( curdir ) ,package ,rootfs -prepare ,$ ( TMP_DIR ) /.build ) )
2007-07-31 00:14:08 +03:00
2007-07-30 21:22:01 +03:00
$( eval $ ( call subdir ,$ ( curdir ) ) )