VirtualBox

source: kBuild/trunk/bootstrap.gmk@ 1518

Last change on this file since 1518 was 1512, checked in by bird, 17 years ago

Added a --full option and not exporting defaults.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1# $Id: bootstrap.gmk 1512 2008-04-09 01:36:57Z bird $
2## @file
3# GNU Make Compatible bootstrap Makefile.
4#
5
6#
7# Copyright (c) 2007 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 2 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, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26
27
28#
29# ASSUMES:
30# - KBUILD_TARGET, KBUILD_HOST, KBUILD_HOST_ARCH, and KBUILD_TYPE in the env.
31# - PATH_KBUILD points to ./kBuild with an absolute path.
32# - PATH_KBUILD_BIN must *NOT* be defined anywhere.
33# - Current directory == bootstrap.gmk directory.
34# - mkdir -p works.
35# - ln -s works
36# - cp -f works
37# - cd somedir && command works.
38# - echo done > some-file works.
39# - GNU make implements CURDIR, if not please define SRCDIR.
40#
41# Tip: kBuild/env.sh --full (g)make -f bootstrap.kmk
42#
43#
44
45#
46# OPTIONAL:
47# Set env.var. NIX_INSTALL_DIR to /usr/local or /usr
48# (see Config.kmk and wiki for details)
49#
50
51#
52# Deal with legacy env.vars. - no niceties here.
53#
54ifndef KBUILD_HOST
55 KBUILD_HOST := $(BUILD_PLATFORM)
56endif
57ifndef KBUILD_HOST_ARCH
58 KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
59endif
60ifndef KBUILD_HOST_CPU
61 KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
62endif
63
64ifndef KBUILD_TARGET
65 KBUILD_TARGET := $(BUILD_TARGET)
66endif
67ifndef KBUILD_TARGET_ARCH
68 KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
69endif
70ifndef KBUILD_TARGET_CPU
71 KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
72endif
73
74ifndef KBUILD_TYPE
75 KBUILD_TYPE := $(BUILD_TYPE)
76endif
77
78ifndef KBUILD_PATH
79 KBUILD_PATH := $(PATH_KBUILD)
80endif
81
82
83#
84# Globals
85#
86SRCDIR = $(CURDIR)
87OUTDIR = $(SRCDIR)/out/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)/$(KBUILD_TYPE)/bootstrap
88
89# Override this on the make commandline if you need to (FreeBSD).
90AUTORECONF = autoreconf
91
92all: stage1 stage2
93
94
95#
96# Stage 1 - Build bootstrap kmk, kmk_redirect and sed, refresh config.h caches, link
97# up kmk_ash so $(OUTDIR)/kmk can serve as kBuild bin dir.
98#
99stage1: \
100 $(OUTDIR)/kmk/kmk \
101 $(OUTDIR)/kmk/kmk_ash \
102 $(OUTDIR)/kmk/kmk_sed \
103 $(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET) \
104 $(SRCDIR)/src/sed/config.h.$(KBUILD_TARGET)
105
106# kmk
107$(OUTDIR)/kmk/ts-autoreconf:
108 mkdir -p $(@D)
109 cd $(SRCDIR)/src/kmk && $(AUTORECONF) -i -v
110 echo done > $@
111
112$(OUTDIR)/kmk/ts-configured: $(OUTDIR)/kmk/ts-autoreconf
113 cd $(OUTDIR)/kmk && $(SRCDIR)/src/kmk/configure
114 echo done > $@
115
116$(OUTDIR)/kmk/config.h: $(OUTDIR)/kmk/ts-configured
117
118$(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET): $(OUTDIR)/kmk/config.h
119 cp -f $(OUTDIR)/kmk/config.h $(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET)
120
121$(OUTDIR)/kmk/kmk: $(OUTDIR)/kmk/ts-configured
122 $(MAKE) -C $(@D)
123
124# sed
125$(OUTDIR)/sed/ts-autoreconf:
126 mkdir -p $(@D)
127 @cd $(SRCDIR)/src/sed && $(AUTORECONF) -i -v --force
128 echo done > $@
129
130$(OUTDIR)/sed/ts-configured: $(OUTDIR)/sed/ts-autoreconf
131 cd $(OUTDIR)/sed && $(SRCDIR)/src/sed/configure --without-libintl --disable-nls
132 echo done > $@
133
134$(OUTDIR)/sed/config.h: $(OUTDIR)/sed/ts-configured
135
136$(SRCDIR)/src/sed/config.h.$(KBUILD_TARGET): $(OUTDIR)/sed/config.h
137 cp -f $< $@
138
139$(OUTDIR)/sed/sed/sed: $(OUTDIR)/sed/ts-configured
140 $(MAKE) -C $(@D)/..
141
142$(OUTDIR)/kmk/kmk_sed: $(OUTDIR)/sed/sed/sed
143 cp -f $< $@
144
145$(OUTDIR)/kmk/kmk_ash:
146 ln -s /bin/sh $@
147
148#
149# Stage 2 - Build kBuild using the bootstrap tools from the previous step
150# and install it to kBuild/bin/x.y.
151#
152stage2: \
153 $(OUTDIR)/ts-stage2-build \
154 $(OUTDIR)/ts-stage2-install
155
156$(OUTDIR)/ts-stage2-build: \
157 $(SRCDIR)/src/kmk/config.h.$(KBUILD_TARGET) \
158 $(SRCDIR)/src/sed/config.h.$(KBUILD_TARGET) \
159 $(OUTDIR)/kmk/kmk
160 $(OUTDIR)/kmk/kmk -C $(SRCDIR)
161 echo done > $@
162
163$(OUTDIR)/ts-stage2-install: $(OUTDIR)/ts-stage2-build
164 $(OUTDIR)/kmk/kmk -C $(SRCDIR) PATH_INS=$(SRCDIR) install
165 echo done > $@
166
167
168#
169# Clean the output files...
170#
171clean:
172 rm -Rf $(SRCDIR)/out/ \
173 $(SRCDIR)/src/kmk/autom4te.cache/ \
174 $(SRCDIR)/src/sed/autom4te.cache/
175 rm -f $(SRCDIR)/src/kmk/Makefile.in \
176 $(SRCDIR)/src/kmk/config.h.in \
177 $(SRCDIR)/src/kmk/configure \
178 $(SRCDIR)/src/kmk/aclocal.m4 \
179 $(SRCDIR)/src/kmk/glob/Makefile.in \
180 $(SRCDIR)/src/kmk/config/Makefile.in \
181 $(SRCDIR)/src/kmk/config/depcomp \
182 $(SRCDIR)/src/kmk/config/compile \
183 $(SRCDIR)/src/kmk/config/missing \
184 $(SRCDIR)/src/kmk/config/config.guess \
185 $(SRCDIR)/src/kmk/config/config.sub \
186 $(SRCDIR)/src/kmk/config/install-sh \
187 $(SRCDIR)/src/kmk/w32/Makefile.in
188
189
190# can't hurt...
191.NOTPARALLEL:
192
Note: See TracBrowser for help on using the repository browser.

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