VirtualBox

source: kBuild/trunk/bootstrap.gmk@ 2109

最後變更 在這個檔案從2109是 2109,由 bird 提交於 16 年 前

bootstrap.kmk: need echo and fts.h to build kmk.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.4 KB
 
1# $Id: bootstrap.gmk 2109 2008-12-25 12:15:32Z bird $
2## @file
3# GNU Make Compatible bootstrap Makefile.
4#
5
6#
7# Copyright (c) 2007-2008 knut st. osmundsen <[email protected]>
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 3 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild. If not, see <http://www.gnu.org/licenses/>
23#
24#
25
26#
27# ASSUMES:
28# - KBUILD_TARGET, KBUILD_HOST, KBUILD_HOST_ARCH, and KBUILD_TYPE in the env.
29# - KBUILD_PATH points to ./kBuild with an absolute path.
30# - KBUILD_BIN_PATH and PATH_KBUILD_BIN must *NOT* be defined anywhere.
31# - Current directory == bootstrap.gmk directory.
32# - mkdir -p works.
33# - ln -s works
34# - cp -f works
35# - cd somedir && command works.
36# - echo done > some-file works.
37# - Recent GNU make that implements CURDIR, $(error) and ifdef.
38#
39# Tip: kBuild/env.sh --full (g(nu))make -f bootstrap.kmk
40#
41#
42
43#
44# OPTIONAL:
45# Set env.var. NIX_INSTALL_DIR to /usr/local or /usr
46# (see Config.kmk and wiki for details)
47#
48
49#
50# Deal with legacy env.vars. - no niceties here.
51#
52ifndef KBUILD_HOST
53 KBUILD_HOST := $(BUILD_PLATFORM)
54endif
55ifndef KBUILD_HOST_ARCH
56 KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
57endif
58ifndef KBUILD_HOST_CPU
59 KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
60endif
61
62ifndef KBUILD_TARGET
63 KBUILD_TARGET := $(BUILD_TARGET)
64endif
65ifndef KBUILD_TARGET_ARCH
66 KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
67endif
68ifndef KBUILD_TARGET_CPU
69 KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
70endif
71
72ifndef KBUILD_TYPE
73 KBUILD_TYPE := $(BUILD_TYPE)
74endif
75
76ifndef KBUILD_PATH
77 KBUILD_PATH := $(PATH_KBUILD)
78endif
79
80#
81# Check (some of) the assumptions.
82#
83ifndef KBUILD_TARGET
84 $(error KBUILD_TARGET not set)
85endif
86
87ifndef KBUILD_HOST
88 $(error KBUILD_HOST not set)
89endif
90
91ifndef KBUILD_HOST_ARCH
92 $(error KBUILD_HOST_ARCH not set)
93endif
94
95ifndef KBUILD_TYPE
96 $(error KBUILD_TYPE not set)
97endif
98
99ifndef KBUILD_TYPE
100 $(error KBUILD_TYPE not set)
101endif
102
103ifndef KBUILD_PATH
104 $(error KBUILD_PATH not set)
105endif
106
107ifdef KBUILD_BIN_PATH
108 $(error KBUILD_BIN_PATH is set)
109endif
110ifdef PATH_KBUILD_BIN
111 $(error PATH_KBUILD_BIN is set)
112endif
113
114
115#
116# Globals
117#
118SRCDIR = $(CURDIR)
119OUTDIR = $(SRCDIR)/out/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)/$(KBUILD_TYPE)/bootstrap
120
121# Override this on the make commandline if you need to (FreeBSD).
122AUTORECONF = autoreconf
123
124all: stage1 stage2
125
126
127#
128# Stage 1 - Build bootstrap kmk, kmk_redirect and sed, refresh config.h caches, link
129# up kmk_ash so $(OUTDIR)/kmk can serve as kBuild bin dir.
130#
131stage1: \
132 $(OUTDIR)/kmk/kmk \
133 $(OUTDIR)/kmk/kmk_ash \
134 $(OUTDIR)/kmk/kmk_sed \
135 $(OUTDIR)/kmk/kmk_echo \
136 $(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET) \
137 $(SRCDIR)/src/sed/config.h.$(KBUILD_TARGET)
138
139# kmk
140$(OUTDIR)/kmk/ts-autoreconf:
141 mkdir -p $(@D)
142 cd $(SRCDIR)/src/kmk && $(AUTORECONF) -i -v
143 echo done > $@
144
145$(OUTDIR)/kmk/ts-configured: $(OUTDIR)/kmk/ts-autoreconf
146 cd $(OUTDIR)/kmk && $(SRCDIR)/src/kmk/configure
147 echo done > $@
148
149$(OUTDIR)/kmk/fts.h:
150 ln -s $(SRCDIR)/src/kmk/kmkbuiltin/ftsfake.h $@
151
152$(OUTDIR)/kmk/config.h: \
153 $(OUTDIR)/kmk/ts-configured \
154 $(OUTDIR)/kmk/fts.h
155
156$(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET): $(OUTDIR)/kmk/config.h
157 cp -f $(OUTDIR)/kmk/config.h $(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET)
158
159$(OUTDIR)/kmk/kmk: $(OUTDIR)/kmk/ts-configured
160 $(MAKE) -C $(@D)
161
162# sed
163$(OUTDIR)/sed/ts-autoreconf:
164 mkdir -p $(@D)
165 @cd $(SRCDIR)/src/sed && $(AUTORECONF) -i -v --force
166 echo done > $@
167
168$(OUTDIR)/sed/ts-configured: $(OUTDIR)/sed/ts-autoreconf
169 cd $(OUTDIR)/sed && $(SRCDIR)/src/sed/configure --without-libintl --disable-nls
170 echo done > $@
171
172$(OUTDIR)/sed/config.h: $(OUTDIR)/sed/ts-configured
173
174$(SRCDIR)/src/sed/config.h.$(KBUILD_TARGET): $(OUTDIR)/sed/config.h
175 cp -f $< $@
176
177$(OUTDIR)/sed/sed/sed: $(OUTDIR)/sed/ts-configured
178 $(MAKE) -C $(@D)/..
179
180$(OUTDIR)/kmk/kmk_sed: $(OUTDIR)/sed/sed/sed
181 cp -f $< $@
182
183$(OUTDIR)/kmk/kmk_ash:
184 ln -s /bin/sh $@
185
186$(OUTDIR)/kmk/kmk_echo:
187 ln -s /bin/echo $@
188
189#
190# Stage 2 - Build kBuild using the bootstrap tools from the previous step
191# and install it to kBuild/bin/x.y.
192#
193stage2: \
194 $(OUTDIR)/ts-stage2-build \
195 $(OUTDIR)/ts-stage2-install
196
197$(OUTDIR)/ts-stage2-build: \
198 $(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET) \
199 $(SRCDIR)/src/sed/config.h.$(KBUILD_TARGET) \
200 $(OUTDIR)/kmk/kmk
201 $(OUTDIR)/kmk/kmk -C $(SRCDIR)
202 echo done > $@
203
204$(OUTDIR)/ts-stage2-install: $(OUTDIR)/ts-stage2-build
205 $(OUTDIR)/kmk/kmk -C $(SRCDIR) PATH_INS=$(SRCDIR) install
206 echo done > $@
207
208
209#
210# Clean the output files...
211#
212clean:
213 rm -Rf $(SRCDIR)/out/ \
214 $(SRCDIR)/src/kmk/autom4te.cache/ \
215 $(SRCDIR)/src/sed/autom4te.cache/
216 rm -f $(SRCDIR)/src/kmk/Makefile.in \
217 $(SRCDIR)/src/kmk/config.h.in \
218 $(SRCDIR)/src/kmk/configure \
219 $(SRCDIR)/src/kmk/aclocal.m4 \
220 $(SRCDIR)/src/kmk/glob/Makefile.in \
221 $(SRCDIR)/src/kmk/config/Makefile.in \
222 $(SRCDIR)/src/kmk/config/depcomp \
223 $(SRCDIR)/src/kmk/config/compile \
224 $(SRCDIR)/src/kmk/config/missing \
225 $(SRCDIR)/src/kmk/config/config.guess \
226 $(SRCDIR)/src/kmk/config/config.sub \
227 $(SRCDIR)/src/kmk/config/install-sh \
228 $(SRCDIR)/src/kmk/w32/Makefile.in
229
230
231# can't hurt...
232.NOTPARALLEL:
233
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette