cc7856c0874bb251afbff9f4afd6b3db12209f23
[openwrt.git] / obsolete-buildroot / make / grep.mk
1 #############################################################
2 #
3 # grep
4 #
5 #############################################################
6 GNUGREP_SOURCE:=grep_2.5.1.ds1.orig.tar.gz
7 GNUGREP_SITE:=http://ftp.debian.org/debian/pool/main/g/grep/
8 GNUGREP_DIR:=$(BUILD_DIR)/grep-2.5.1
9 GNUGREP_CAT:=zcat
10 GNUGREP_BINARY:=src/grep
11 GNUGREP_TARGET_BINARY:=bin/grep
12
13 $(DL_DIR)/$(GNUGREP_SOURCE):
14          $(WGET) -P $(DL_DIR) $(GNUGREP_SITE)/$(GNUGREP_SOURCE)
15
16 grep-source: $(DL_DIR)/$(GNUGREP_SOURCE)
17
18 $(GNUGREP_DIR)/.unpacked: $(DL_DIR)/$(GNUGREP_SOURCE)
19         rm -rf $(GNUGREP_DIR).xxx
20         $(GNUGREP_CAT) $(DL_DIR)/$(GNUGREP_SOURCE) | tar -C $(BUILD_DIR) -xvf -
21         mv $(GNUGREP_DIR) $(GNUGREP_DIR).xxx
22         $(GNUGREP_CAT) $(GNUGREP_DIR).xxx/grep_2.5.1.tar.gz | tar -C $(BUILD_DIR) -xvf -
23         rm -rf $(GNUGREP_DIR).xxx
24         touch $(GNUGREP_DIR)/.unpacked
25
26 $(GNUGREP_DIR)/.configured: $(GNUGREP_DIR)/.unpacked
27         (cd $(GNUGREP_DIR); rm -rf config.cache; \
28                 $(TARGET_CONFIGURE_OPTS) \
29                 CFLAGS="$(TARGET_CFLAGS)" \
30                 ./configure \
31                 --target=$(GNU_TARGET_NAME) \
32                 --host=$(GNU_TARGET_NAME) \
33                 --build=$(GNU_HOST_NAME) \
34                 --prefix=/usr \
35                 --exec-prefix=/usr \
36                 --bindir=/usr/bin \
37                 --sbindir=/usr/sbin \
38                 --libexecdir=/usr/lib \
39                 --sysconfdir=/etc \
40                 --datadir=/usr/share \
41                 --localstatedir=/var \
42                 --mandir=/usr/man \
43                 --infodir=/usr/info \
44                 $(DISABLE_NLS) \
45                 $(DISABLE_LARGEFILE) \
46                 --disable-perl-regexp \
47                 --without-included-regex \
48         );
49         touch  $(GNUGREP_DIR)/.configured
50
51 $(GNUGREP_DIR)/$(GNUGREP_BINARY): $(GNUGREP_DIR)/.configured
52         $(MAKE) -C $(GNUGREP_DIR)
53
54 # This stuff is needed to work around GNU make deficiencies
55 grep-target_binary: $(GNUGREP_DIR)/$(GNUGREP_BINARY)
56         @if [ -L $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY) ] ; then \
57                 rm -f $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY); fi;
58         @if [ ! -f $(GNUGREP_DIR)/$(GNUGREP_BINARY) -o $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY) -ot \
59         $(GNUGREP_DIR)/$(GNUGREP_BINARY) ] ; then \
60             set -x; \
61             rm -f $(TARGET_DIR)/bin/grep $(TARGET_DIR)/bin/egrep $(TARGET_DIR)/bin/fgrep; \
62             cp -a $(GNUGREP_DIR)/src/grep $(GNUGREP_DIR)/src/egrep \
63                 $(GNUGREP_DIR)/src/fgrep $(TARGET_DIR)/bin/; fi
64
65 grep: uclibc grep-target_binary
66
67 grep-clean:
68         $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUGREP_DIR) uninstall
69         -$(MAKE) -C $(GNUGREP_DIR) clean
70
71 grep-dirclean:
72         rm -rf $(GNUGREP_DIR)
73