pci fixup
[openwrt.git] / obsolete-buildroot / make / sed.mk
1 #############################################################
2 #
3 # sed
4 #
5 #############################################################
6 SED_SOURCE:=sed-4.0.8.tar.gz
7 SED_SITE:=ftp://ftp.gnu.org/gnu/sed
8 SED_CAT:=zcat
9 SED_DIR1:=$(TOOL_BUILD_DIR)/sed-4.0.8
10 SED_DIR2:=$(BUILD_DIR)/sed-4.0.8
11 SED_BINARY:=sed/sed
12 SED_TARGET_BINARY:=bin/sed
13 ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true)
14 SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64
15 endif
16 SED:=$(STAGING_DIR)/bin/sed -i -e
17
18 HOST_SED_TARGET=$(shell ./sources/sedcheck.sh)
19
20 $(DL_DIR)/$(SED_SOURCE):
21 $(WGET) -P $(DL_DIR) $(SED_SITE)/$(SED_SOURCE)
22
23 sed-source: $(DL_DIR)/$(SED_SOURCE)
24
25
26 #############################################################
27 #
28 # build sed for use on the host system
29 #
30 #############################################################
31 $(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
32 mkdir -p $(TOOL_BUILD_DIR)
33 mkdir -p $(DL_DIR)
34 mkdir -p $(STAGING_DIR)/bin;
35 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
36 touch $(SED_DIR1)/.unpacked
37
38 $(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked
39 (cd $(SED_DIR1); rm -rf config.cache; \
40 ./configure \
41 --prefix=$(STAGING_DIR) \
42 --prefix=/usr \
43 );
44 touch $(SED_DIR1)/.configured
45
46 $(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured
47 $(MAKE) -C $(SED_DIR1)
48
49 # This stuff is needed to work around GNU make deficiencies
50 build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY)
51 @if [ -L $(STAGING_DIR)/$(SED_TARGET_BINARY) ] ; then \
52 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); fi;
53 @if [ ! -f $(STAGING_DIR)/$(SED_TARGET_BINARY) -o $(STAGING_DIR)/$(SED_TARGET_BINARY) \
54 -ot $(SED_DIR1)/$(SED_BINARY) ] ; then \
55 set -x; \
56 mkdir -p $(STAGING_DIR)/bin; \
57 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) install; \
58 mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \
59 rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \
60 $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; fi
61
62 use-sed-host-binary:
63 @if [ -x /usr/bin/sed ]; then SED="/usr/bin/sed"; else \
64 if [ -x /bin/sed ]; then SED="/bin/sed"; fi; fi; \
65 mkdir -p $(STAGING_DIR)/bin; \
66 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); \
67 ln -s $$SED $(STAGING_DIR)/$(SED_TARGET_BINARY)
68
69 host-sed: $(HOST_SED_TARGET)
70
71 host-sed-clean:
72 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) uninstall
73 -$(MAKE) -C $(SED_DIR1) clean
74
75 host-sed-dirclean:
76 rm -rf $(SED_DIR1)
77
78
79 #############################################################
80 #
81 # build sed for use on the target system
82 #
83 #############################################################
84 $(SED_DIR2)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
85 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(BUILD_DIR) -xvf -
86 touch $(SED_DIR2)/.unpacked
87
88 $(SED_DIR2)/.configured: $(SED_DIR2)/.unpacked
89 (cd $(SED_DIR2); rm -rf config.cache; \
90 $(TARGET_CONFIGURE_OPTS) \
91 CFLAGS="$(TARGET_CFLAGS)" \
92 CPPFLAGS="$(SED_CFLAGS)" \
93 ./configure \
94 --target=$(GNU_TARGET_NAME) \
95 --host=$(GNU_TARGET_NAME) \
96 --build=$(GNU_HOST_NAME) \
97 --prefix=/usr \
98 --exec-prefix=/usr \
99 --bindir=/usr/bin \
100 --sbindir=/usr/sbin \
101 --libexecdir=/usr/lib \
102 --sysconfdir=/etc \
103 --datadir=/usr/share \
104 --localstatedir=/var \
105 --mandir=/usr/man \
106 --infodir=/usr/info \
107 $(DISABLE_NLS) \
108 );
109 touch $(SED_DIR2)/.configured
110
111 $(SED_DIR2)/$(SED_BINARY): $(SED_DIR2)/.configured
112 $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR2)
113
114 # This stuff is needed to work around GNU make deficiencies
115 sed-target_binary: $(SED_DIR2)/$(SED_BINARY)
116 @if [ -L $(TARGET_DIR)/$(SED_TARGET_BINARY) ] ; then \
117 rm -f $(TARGET_DIR)/$(SED_TARGET_BINARY); fi;
118
119 @if [ ! -f $(SED_DIR2)/$(SED_BINARY) -o $(TARGET_DIR)/$(SED_TARGET_BINARY) \
120 -ot $(SED_DIR2)/$(SED_BINARY) ] ; then \
121 set -x; \
122 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) install; \
123 mv $(TARGET_DIR)/usr/bin/sed $(TARGET_DIR)/bin/; \
124 rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
125 $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc; fi
126
127 sed: uclibc sed-target_binary
128
129 sed-clean:
130 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) uninstall
131 -$(MAKE) -C $(SED_DIR2) clean
132
133 sed-dirclean:
134 rm -rf $(SED_DIR2)
135
136
This page took 0.04863 seconds and 5 git commands to generate.