make $(TARGET_DIR)/sbin at install time. make TARGET_DIR=arptables-pkg arptables...
[openwrt/openwrt.git] / obsolete-buildroot / make / coreutils.mk
1 #############################################################
2 #
3 # coreutils
4 #
5 #############################################################
6 COREUTILS_SOURCE:=coreutils-5.0.tar.bz2
7 COREUTILS_SITE:=ftp://ftp.gnu.org/gnu/coreutils/
8 COREUTILS_CAT:=bzcat
9 COREUTILS_DIR:=$(BUILD_DIR)/coreutils-5.0
10 COREUTILS_BINARY:=src/vdir
11 COREUTILS_TARGET_BINARY:=bin/vdir
12 BIN_PROGS:=cat chgrp chmod chown cp date dd df dir echo false hostname \
13 ln ls mkdir mknod mv pwd rm rmdir vdir sleep stty sync touch true uname
14
15 $(DL_DIR)/$(COREUTILS_SOURCE):
16 $(WGET) -P $(DL_DIR) $(COREUTILS_SITE)/$(COREUTILS_SOURCE)
17
18 coreutils-source: $(DL_DIR)/$(COREUTILS_SOURCE)
19
20 $(COREUTILS_DIR)/.unpacked: $(DL_DIR)/$(COREUTILS_SOURCE)
21 $(COREUTILS_CAT) $(DL_DIR)/$(COREUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf -
22 touch $(COREUTILS_DIR)/.unpacked
23
24 $(COREUTILS_DIR)/.configured: $(COREUTILS_DIR)/.unpacked
25 (cd $(COREUTILS_DIR); rm -rf config.cache; \
26 $(TARGET_CONFIGURE_OPTS) \
27 CFLAGS="$(TARGET_CFLAGS)" \
28 ./configure \
29 --target=$(GNU_TARGET_NAME) \
30 --host=$(GNU_TARGET_NAME) \
31 --build=$(GNU_HOST_NAME) \
32 --prefix=/usr \
33 --exec-prefix=/usr \
34 --bindir=/usr/bin \
35 --sbindir=/usr/sbin \
36 --libexecdir=/usr/lib \
37 --sysconfdir=/etc \
38 --datadir=/usr/share \
39 --localstatedir=/var \
40 --mandir=/usr/man \
41 --infodir=/usr/info \
42 $(DISABLE_NLS) \
43 $(DISABLE_LARGEFILE) \
44 --disable-rpath \
45 --disable-dependency-tracking \
46 );
47 #Fix up the max number of open files per process, which apparently
48 # is not set when cross compiling
49 $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \
50 $(COREUTILS_DIR)/config.h
51 # This is undefined when crosscompiling...
52 $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \
53 $(COREUTILS_DIR)/config.h
54 touch $(COREUTILS_DIR)/.configured
55
56 $(COREUTILS_DIR)/$(COREUTILS_BINARY): $(COREUTILS_DIR)/.configured
57 $(MAKE) CC=$(TARGET_CC) -C $(COREUTILS_DIR)
58 rm -f $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
59
60 $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY): $(COREUTILS_DIR)/$(COREUTILS_BINARY)
61 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) install
62 # some things go in root rather than usr
63 for f in $(BIN_PROGS); do \
64 mv $(TARGET_DIR)/usr/bin/$$f $(TARGET_DIR)/bin/$$f; \
65 done
66 # link for archaic shells
67 ln -fs test $(TARGET_DIR)/usr/bin/[
68 # gnu thinks chroot is in bin, debian thinks it's in sbin
69 mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin/chroot
70 $(STRIP) $(TARGET_DIR)/usr/sbin/chroot > /dev/null 2>&1
71 rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
72 $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
73
74 coreutils: uclibc $(TARGET_DIR)/$(COREUTILS_TARGET_BINARY)
75
76 coreutils-clean:
77 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(COREUTILS_DIR) uninstall
78 -$(MAKE) -C $(COREUTILS_DIR) clean
79
80 coreutils-dirclean:
81 rm -rf $(COREUTILS_DIR)
82