2006-06-23 14:53:28 +08:00
#############################################################
#
# lsof
#
#############################################################
2008-10-24 02:54:10 +08:00
LSOF_VERSION := 4.81
2007-05-15 19:23:46 +08:00
LSOF_SOURCE := lsof_$( LSOF_VERSION) .tar.bz2
2006-06-23 14:53:28 +08:00
LSOF_SITE := ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
2006-11-17 23:43:51 +08:00
LSOF_CAT := $( BZCAT)
2007-05-15 19:23:46 +08:00
LSOF_DIR := $( BUILD_DIR) /lsof_$( LSOF_VERSION)
2006-06-23 14:53:28 +08:00
LSOF_BINARY := lsof
LSOF_TARGET_BINARY := bin/lsof
2007-10-21 20:02:16 +08:00
LSOF_INCLUDE := $( STAGING_DIR) /usr/include
2006-06-23 14:53:28 +08:00
2006-11-29 20:59:56 +08:00
BR2_LSOF_CFLAGS :=
i f e q ( $( BR 2_LARGEFILE ) , )
BR2_LSOF_CFLAGS += -U_FILE_OFFSET_BITS
e n d i f
2007-06-27 01:45:08 +08:00
i f e q ( $( BR 2_INET_IPV 6) , )
2006-11-29 20:59:56 +08:00
BR2_LSOF_CFLAGS += -UHASIPv6
e n d i f
2006-06-23 14:53:28 +08:00
$(DL_DIR)/$(LSOF_SOURCE) :
2009-01-16 19:42:52 +08:00
$( call DOWNLOAD,$( LSOF_SITE) ,$( LSOF_SOURCE) )
2006-06-23 14:53:28 +08:00
lsof-source : $( DL_DIR ) /$( LSOF_SOURCE )
lsof-unpacked : $( LSOF_DIR ) /.unpacked
$(LSOF_DIR)/.unpacked : $( DL_DIR ) /$( LSOF_SOURCE )
$( LSOF_CAT) $( DL_DIR) /$( LSOF_SOURCE) | tar -C $( BUILD_DIR) $( TAR_OPTIONS) -
2007-05-15 19:23:46 +08:00
( cd $( LSOF_DIR) ; tar xf lsof_$( LSOF_VERSION) _src.tar; rm -f lsof_$( LSOF_VERSION) _src.tar)
2006-10-03 02:40:42 +08:00
toolchain/patch-kernel.sh $( LSOF_DIR) package/lsof/ \* .patch
2006-06-23 14:53:28 +08:00
touch $( LSOF_DIR) /.unpacked
$(LSOF_DIR)/.configured : $( LSOF_DIR ) /.unpacked
2007-10-21 20:02:16 +08:00
( cd $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src; echo n | $( TARGET_CONFIGURE_OPTS) DEBUG = " $( TARGET_CFLAGS) $( BR2_LSOF_CFLAGS) " LSOF_INCLUDE = " $( LSOF_INCLUDE) " ./Configure linux)
2006-06-23 14:53:28 +08:00
touch $( LSOF_DIR) /.configured
2007-05-15 19:23:46 +08:00
$(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/$(LSOF_BINARY) : $( LSOF_DIR ) /.configured
2006-12-14 07:08:48 +08:00
i f e q ( $( UCLIBC_HAS_WCHAR ) , )
2007-08-22 20:35:41 +08:00
$( SED) 's,^#define[[:space:]]*HASWIDECHAR.*,#undef HASWIDECHAR,' $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src/machine.h
$( SED) 's,^#define[[:space:]]*WIDECHARINCL.*,,' $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src/machine.h
2006-12-14 07:08:48 +08:00
e n d i f
i f e q ( $( UCLIBC_HAS_LOCALE ) , )
2007-08-22 20:35:41 +08:00
$( SED) 's,^#define[[:space:]]*HASSETLOCALE.*,#undef HASSETLOCALE,' $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src/machine.h
2006-12-14 07:08:48 +08:00
e n d i f
2007-05-15 19:23:46 +08:00
$( MAKE) $( TARGET_CONFIGURE_OPTS) DEBUG = " $( TARGET_CFLAGS) $( BR2_LSOF_CFLAGS) " -C $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src
2006-06-23 14:53:28 +08:00
2007-05-15 19:23:46 +08:00
$(TARGET_DIR)/$(LSOF_TARGET_BINARY) : $( LSOF_DIR ) /lsof_ $( LSOF_VERSION ) _src /$( LSOF_BINARY )
cp $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src/$( LSOF_BINARY) $@
2007-10-02 00:15:31 +08:00
$( STRIPCMD) $@
2006-06-23 14:53:28 +08:00
lsof : uclibc $( TARGET_DIR ) /$( LSOF_TARGET_BINARY )
lsof-clean :
-rm -f $( TARGET_DIR) /$( LSOF_TARGET_BINARY)
2007-05-15 19:23:46 +08:00
-$( MAKE) -C $( LSOF_DIR) /lsof_$( LSOF_VERSION) _src clean
2006-06-23 14:53:28 +08:00
lsof-dirclean :
rm -rf $( LSOF_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
2008-12-08 16:15:27 +08:00
i f e q ( $( BR 2_PACKAGE_LSOF ) , y )
2006-06-23 14:53:28 +08:00
TARGETS += lsof
e n d i f