use __UCLIBC_HAS_BACKTRACE__ to decide on backtrace() availability
[buildroot.git] / package / sed / sed.mk
blob34e787661e7cd11aeef705be15ff4b8e77856a38
1 #############################################################
3 # sed
5 #############################################################
6 SED_VERSION:=4.1.5
7 SED_SOURCE:=sed-$(SED_VERSION).tar.gz
8 SED_SITE:=$(BR2_GNU_MIRROR)/sed
9 SED_CAT:=$(ZCAT)
10 SED_DIR1:=$(TOOL_BUILD_DIR)/sed-$(SED_VERSION)
11 SED_DIR2:=$(BUILD_DIR)/sed-$(SED_VERSION)
12 SED_BINARY:=sed/sed
13 SED_TARGET_BINARY:=bin/sed
14 ifeq ($(BR2_LARGEFILE),y)
15 SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64
16 endif
17 #HOST_SED_DIR:=$(STAGING_DIR)
18 HOST_SED_DIR:=$(TOOL_BUILD_DIR)
19 SED:=$(HOST_SED_DIR)/bin/sed -i -e
20 HOST_SED_BINARY=$(shell $(CONFIG_SHELL) package/sed/sedcheck.sh)
21 HOST_SED_IF_ANY=$(shell $(CONFIG_SHELL) toolchain/dependencies/check-host-sed.sh)
23 $(DL_DIR)/$(SED_SOURCE):
24 mkdir -p $(DL_DIR)
25 $(WGET) -P $(DL_DIR) $(SED_SITE)/$(SED_SOURCE)
27 sed-source: $(DL_DIR)/$(SED_SOURCE)
30 #############################################################
32 # build sed for use on the host system
34 #############################################################
35 $(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
36 mkdir -p $(TOOL_BUILD_DIR)
37 mkdir -p $(HOST_SED_DIR)/bin
38 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
39 toolchain/patch-kernel.sh $(SED_DIR1) package/sed/ configure.patch
40 touch $@
42 $(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked
43 (cd $(SED_DIR1); rm -rf config.cache; \
44 ./configure \
45 --prefix=/usr \
47 touch $@
49 $(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured
50 $(MAKE) -C $(SED_DIR1)
52 # This stuff is needed to work around GNU make deficiencies
53 build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY)
54 @if [ -L $(HOST_SED_DIR)/$(SED_TARGET_BINARY) ]; then \
55 rm -f $(HOST_SED_DIR)/$(SED_TARGET_BINARY); \
57 @if [ ! -f $(HOST_SED_DIR)/$(SED_TARGET_BINARY) \
58 -o $(HOST_SED_DIR)/$(SED_TARGET_BINARY) \
59 -ot $(SED_DIR1)/$(SED_BINARY) ]; then \
60 set -x; \
61 mkdir -p $(HOST_SED_DIR)/bin; \
62 $(MAKE) DESTDIR=$(HOST_SED_DIR) -C $(SED_DIR1) install; \
63 mv $(HOST_SED_DIR)/usr/bin/sed $(HOST_SED_DIR)/bin/; \
64 rm -rf $(HOST_SED_DIR)/share/locale; \
65 rm -rf $(HOST_SED_DIR)/usr/share/doc; \
67 ifneq ($(BR2_HAVE_INFOPAGES),y)
68 rm -rf $(HOST_SED_DIR)/usr/man/info
69 endif
70 ifneq ($(BR2_HAVE_MANPAGES),y)
71 rm -rf $(HOST_SED_DIR)/usr/share/man
72 endif
74 $(HOST_SED_DIR)/$(SED_TARGET_BINARY):
75 if [ ! -e "$(HOST_SED_DIR)/$(SED_TARGET_BINARY)" ]; then \
76 mkdir -p "$(HOST_SED_DIR)/bin"; \
77 rm -f "$(HOST_SED_DIR)/$(SED_TARGET_BINARY)"; \
78 ln -sf "$(HOST_SED_IF_ANY)" \
79 "$(HOST_SED_DIR)/$(SED_TARGET_BINARY)"; \
82 .PHONY: sed host-sed use-sed-host-binary
84 use-sed-host-binary: $(HOST_SED_DIR)/$(SED_TARGET_BINARY)
86 host-sed: $(HOST_SED_BINARY)
88 ifeq ($(HOST_SED_BINARY),build-sed-host-binary)
89 host-sed-clean:
90 $(MAKE) DESTDIR=$(HOST_SED_DIR) -C $(SED_DIR1) uninstall
91 -$(MAKE) -C $(SED_DIR1) clean
93 host-sed-dirclean:
94 rm -rf $(SED_DIR1)
96 else
97 host-sed-clean host-sed-dirclean:
99 endif
101 #############################################################
103 # build sed for use on the target system
105 #############################################################
106 $(SED_DIR2)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
107 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
108 touch $(SED_DIR2)/.unpacked
110 $(SED_DIR2)/.configured: $(SED_DIR2)/.unpacked
111 (cd $(SED_DIR2); rm -rf config.cache; \
112 $(TARGET_CONFIGURE_OPTS) \
113 $(TARGET_CONFIGURE_ARGS) \
114 CPPFLAGS="$(SED_CFLAGS)" \
115 ./configure \
116 --target=$(GNU_TARGET_NAME) \
117 --host=$(GNU_TARGET_NAME) \
118 --build=$(GNU_HOST_NAME) \
119 --prefix=/usr \
120 --exec-prefix=/usr \
121 --bindir=/usr/bin \
122 --sbindir=/usr/sbin \
123 --libdir=/lib \
124 --libexecdir=/usr/lib \
125 --sysconfdir=/etc \
126 --datadir=/usr/share \
127 --localstatedir=/var \
128 --mandir=/usr/share/man \
129 --infodir=/usr/share/info \
130 --include=$(STAGING_DIR)/usr/include \
131 $(DISABLE_NLS) \
133 touch $@
135 $(SED_DIR2)/$(SED_BINARY): $(SED_DIR2)/.configured
136 $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR2)
138 # This stuff is needed to work around GNU make deficiencies
139 sed-target_binary: $(SED_DIR2)/$(SED_BINARY)
140 @if [ -L $(TARGET_DIR)/$(SED_TARGET_BINARY) ]; then \
141 rm -f $(TARGET_DIR)/$(SED_TARGET_BINARY); \
144 @if [ ! -f $(SED_DIR2)/$(SED_BINARY) \
145 -o $(TARGET_DIR)/$(SED_TARGET_BINARY) \
146 -ot $(SED_DIR2)/$(SED_BINARY) ]; then \
147 set -x; \
148 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) install; \
149 mv $(TARGET_DIR)/usr/bin/sed $(TARGET_DIR)/bin/; \
150 rm -rf $(TARGET_DIR)/share/locale; \
151 rm -rf $(TARGET_DIR)/usr/share/doc; \
153 ifneq ($(BR2_HAVE_INFOPAGES),y)
154 rm -rf $(TARGET_DIR)/usr/share/info
155 endif
156 ifneq ($(BR2_HAVE_MANPAGES),y)
157 rm -rf $(TARGET_DIR)/usr/share/man
158 endif
160 sed: uclibc sed-target_binary
162 sed-clean:
163 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) uninstall
164 -$(MAKE) -C $(SED_DIR2) clean
166 sed-dirclean:
167 rm -rf $(SED_DIR2)
170 #############################################################
172 # Toplevel Makefile options
174 #############################################################
175 ifeq ($(BR2_PACKAGE_SED),y)
176 TARGETS+=sed
177 endif