source: trunk/bootstrap.gmk@ 998

Last change on this file since 998 was 998, checked in by bird, 18 years ago

SRCDIR not pwd.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.6 KB
RevLine 
[995]1# $Id: bootstrap.gmk 998 2007-05-29 21:25:30Z bird $
2## @file
3#
4# GNU Make Compatible bootstrap Makefile.
5#
6# Copyright (c) 2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
7#
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:
[996]30# - BUILD_TARGET, BUILD_PLATFORM_ARCH, BUILD_PLATFORM_CPU and BUILD_TYPE in the env.
[995]31# - PATH_KBUILD points to ./kBuild with an absolute path.
[996]32# - PATH_KBUILD_BIN must *NOT* be defined anywhere.
[995]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 > file works.
[996]39# - GNU make implements CURDIR, if not please define SRCDIR.
[995]40#
41# Tip. kBuild/env.sh (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
[996]51SRCDIR = $(CURDIR)
52OUTDIR = $(SRCDIR)/out/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)/$(BUILD_TYPE)/bootstrap
[995]53
54
[996]55all: stage1 stage2
[995]56
[996]57
[995]58#
59# Stage 1 - Build bootstrap kmk and sed, refresh config.h caches, link
60# up kmk_ash so $(OUTDIR)/kmk can serve as kBuild bin dir.
61#
62stage1: \
63 $(OUTDIR)/kmk/kmk \
64 $(OUTDIR)/kmk/kmk_ash \
65 $(OUTDIR)/kmk/kmk_sed \
[996]66 $(SRCDIR)/src/kmk/config.h.$(BUILD_TARGET) \
67 $(SRCDIR)/src/sed/config.h.$(BUILD_TARGET)
[995]68
69# kmk
[996]70$(OUTDIR)/kmk/ts-autoreconf:
71 mkdir -p $(@D)
72 cd $(SRCDIR)/src/kmk && autoreconf -i -v
73 echo done > $@
[995]74
75$(OUTDIR)/kmk/ts-configured: $(OUTDIR)/kmk/ts-autoreconf
[996]76 cd $(OUTDIR)/kmk && $(SRCDIR)/src/kmk/configure
77 echo done > $@
[995]78
79$(OUTDIR)/kmk/config.h: $(OUTDIR)/kmk/ts-configured
80
[996]81$(SRCDIR)/src/kmk/config.h.$(BUILD_TARGET): $(OUTDIR)/kmk/config.h
82 cp -f $(OUTDIR)/kmk/config.h $(SRCDIR)/src/kmk/config.h.$(BUILD_TARGET)
[995]83
84$(OUTDIR)/kmk/kmk: $(OUTDIR)/kmk/ts-configured
[996]85 $(MAKE) -C $(@D)
[995]86
87# sed
[996]88$(OUTDIR)/sed/ts-autoreconf:
89 mkdir -p $(@D)
90 @# only required on OS/2, so skip it.
91 @# cd $(SRCDIR)/src/sed && autoreconf -i -v
92 echo done > $@
[995]93
94$(OUTDIR)/sed/ts-configured: $(OUTDIR)/sed/ts-autoreconf
[996]95 cd $(OUTDIR)/sed && $(SRCDIR)/src/sed/configure --without-libintl --disable-nls
96 echo done > $@
[995]97
98$(OUTDIR)/sed/config.h: $(OUTDIR)/sed/ts-configured
99
[996]100$(SRCDIR)/src/sed/config.h.$(BUILD_TARGET): $(OUTDIR)/sed/config.h
101 cp -f $< $@
[995]102
[996]103$(OUTDIR)/sed/sed/sed: $(OUTDIR)/sed/ts-configured
104 $(MAKE) -C $(@D)/..
[995]105
[996]106$(OUTDIR)/kmk/kmk_sed: $(OUTDIR)/sed/sed/sed
107 cp -f $< $@
[995]108
109$(OUTDIR)/kmk/kmk_ash:
[996]110 ln -s /bin/sh $@
[995]111
112#
113# Stage 2 - Build kBuild using the bootstrap tools from the previous step
114# and install it to kBuild/bin/x.y.
115#
116stage2: \
117 $(OUTDIR)/ts-stage2-build \
118 $(OUTDIR)/ts-stage2-install
119
[996]120$(OUTDIR)/ts-stage2-build: \
121 $(SRCDIR)/src/kmk/config.h.$(BUILD_TARGET) \
122 $(SRCDIR)/src/sed/config.h.$(BUILD_TARGET) \
123 $(OUTDIR)/kmk/kmk
124 $(OUTDIR)/kmk/kmk -C $(SRCDIR)
125 echo done > $@
[995]126
[996]127$(OUTDIR)/ts-stage2-install: $(OUTDIR)/ts-stage2-build
[998]128 $(OUTDIR)/kmk/kmk -C $(SRCDIR) PATH_INS=$(SRCDIR) install
[996]129 echo done > $@
[995]130
[996]131
132##
133## Clean the output files...
134##
135#clean:
136# rm -Rf $(OUTDIR)
137
138
139# can't hurt...
140.NOTPARALLEL:
141
Note: See TracBrowser for help on using the repository browser.