1 #############################################################
5 #############################################################
7 SED_SOURCE
:=sed-
$(SED_VERSION
).
tar.gz
8 SED_SITE
:=$(BR2_GNU_MIRROR
)/sed
10 SED_DIR1
:=$(TOOL_BUILD_DIR
)/sed-
$(SED_VERSION
)
11 SED_DIR2
:=$(BUILD_DIR
)/sed-
$(SED_VERSION
)
13 SED_TARGET_BINARY
:=bin
/sed
14 ifeq ($(BR2_LARGEFILE
),y
)
15 SED_CPPFLAGS
=-D_FILE_OFFSET_BITS
=64
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
):
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
42 $(SED_DIR1
)/.configured
: $(SED_DIR1
)/.unpacked
43 (cd
$(SED_DIR1
); rm -rf config.cache
; \
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 $(Q
)if
[ -L
$(HOST_SED_DIR
)/$(SED_TARGET_BINARY
) ]; then \
55 rm -f
$(HOST_SED_DIR
)/$(SED_TARGET_BINARY
); \
57 $(Q
)if
[ ! -f
$(HOST_SED_DIR
)/$(SED_TARGET_BINARY
) \
58 -o
$(HOST_SED_DIR
)/$(SED_TARGET_BINARY
) \
59 -ot
$(SED_DIR1
)/$(SED_BINARY
) ]; then \
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
70 ifneq ($(BR2_HAVE_MANPAGES
),y
)
71 rm -rf
$(HOST_SED_DIR
)/usr
/share
/man
74 $(HOST_SED_DIR
)/$(SED_TARGET_BINARY
):
75 $(Q
)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
)
90 $(MAKE
) DESTDIR
=$(HOST_SED_DIR
) -C
$(SED_DIR1
) uninstall
91 -$(MAKE
) -C
$(SED_DIR1
) clean
97 host-sed-clean host-sed-dirclean
:
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)" \
116 --target
=$(GNU_TARGET_NAME
) \
117 --host
=$(GNU_TARGET_NAME
) \
118 --build
=$(GNU_HOST_NAME
) \
122 --sbindir
=/usr
/sbin \
124 --libexecdir
=/usr
/lib \
126 --datadir=/usr
/share \
127 --localstatedir
=/var \
128 --mandir=/usr
/share
/man \
129 --infodir=/usr
/share
/info \
130 --include=$(STAGING_DIR
)/usr
/include \
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
); \
143 $(Q
)if
[ ! -f
$(SED_DIR2
)/$(SED_BINARY
) \
144 -o
$(TARGET_DIR
)/$(SED_TARGET_BINARY
) \
145 -ot
$(SED_DIR2
)/$(SED_BINARY
) ]; then \
147 $(MAKE
) DESTDIR
=$(TARGET_DIR
) CC
=$(TARGET_CC
) -C
$(SED_DIR2
) install; \
148 mv
$(TARGET_DIR
)/usr
/bin
/sed
$(TARGET_DIR
)/bin
/; \
149 rm -rf
$(TARGET_DIR
)/share
/locale
; \
150 rm -rf
$(TARGET_DIR
)/usr
/share
/doc
; \
152 ifneq ($(BR2_HAVE_INFOPAGES
),y
)
153 rm -rf
$(TARGET_DIR
)/usr
/share
/info
155 ifneq ($(BR2_HAVE_MANPAGES
),y
)
156 rm -rf
$(TARGET_DIR
)/usr
/share
/man
159 sed
: uclibc sed-target_binary
162 $(MAKE
) DESTDIR
=$(TARGET_DIR
) CC
=$(TARGET_CC
) -C
$(SED_DIR2
) uninstall
163 -$(MAKE
) -C
$(SED_DIR2
) clean
169 #############################################################
171 # Toplevel Makefile options
173 #############################################################
174 ifeq ($(BR2_PACKAGE_SED
),y
)