source: trunk/kBuild/gnumake-header.kmk@ 815

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

Fixed bootstrap problem caused by missing kmk_append.

  • Property svn:keywords set to Id
File size: 4.0 KB
RevLine 
[723]1# $Id: gnumake-header.kmk 815 2007-01-31 03:54:18Z bird $
2## @file
3#
4# kBuild - Additional header for use when bootstrapping kBuild using Vanilla GNU Make.
5#
[782]6# Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
[723]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# Disable some features to make it work.
29#
30NO_COMPILE_CMDS_DEPS := 1
31NO_LINK_CMDS_DEPS := 1
32sinclude $(PATH_KBUILD)/StampOutPredefines.kmk
33$(warning kBuild: Using vanilla GNU make isn't safe for anything but kBuild bootstrapping!)
34
[743]35##
[782]36# Pushes an item onto a 'stack' variable.
[743]37# @param $1 The stack variable name
38# @param $2 What to push.
39stack-push = $(eval $1 +=$2)
[723]40
[743]41##
42# Removes the top element from a 'stack' variable.
43# @returns The popped element
44# @param $1 The stack variable name
45stack-pop = $(call stack-top,$1)$(call stack-popv,$1)
46
47##
48# Removes the top element from a 'stack' variable.
[782]49# This does *NOT* return the top element, use
[743]50# @param $1 The stack variable name
51# @remark This ain't very fast (that's why it's implemented in functions.c in kmk).
52stack-popv = $(eval $1:=$(wordlist 1,$(words $(wordlist 2,9999,$($1))),$($1)))
53
54##
55# Retrieves the top element from the 'stack' variable.
56# @param $1 The stack variable name
57stack-top = $(lastword $($1))
58
[815]59##
60# Use the APPEND shell script in case we're boot strapping.
61override APPEND_EXT := $(PATH_KBUILD)/gnumake-append.sh
62override APPEND = $(APPEND_EXT)
[743]63
[723]64#
[743]65# Fix some default variables.
[723]66#
67ifeq ($(MAKEFLAGS),$(MAKEFLAGS:R=x))
68# add the -R makeflag to avoid doing this for submakes
69MAKEFLAGS := R$(MAKEFLAGS)
70
71define def_undefine_default
72ifeq ($(origin $1), default)
73$1:=
74endif
75endef
[782]76
[723]77_DEFAULT_VARIABLES := .LIBPATTERNS .VARIABLES AR ARFLAGS AS CC CHECKOUT,v CO COFLAGS COMPILE.C COMPILE.F COMPILE.S COMPILE.c COMPILE.cc COMPILE.cpp COMPILE.def COMPILE.f COMPILE.mod COMPILE.p COMPILE.r COMPILE.s CPP CTANGLE CWEAVE CXX F77 F77FLAGS FC GET LD LEX LEX.l LINK.C LINK.F LINK.S LINK.c LINK.cc LINK.cpp LINK.f LINK.o LINK.p LINK.r LINK.s LINT LINT.c M2C MAKEINFO OUTPUT_OPTION PC PREPROCESS.F PREPROCESS.S PREPROCESS.r RM TANGLE TEX TEXI2DVI WEAVE YACC YACC.y
78$(foreach i, $(_DEFAULT_VARIABLES), $(eval $(call def_undefine_default,$(i))))
79_DEFAULT_VARIABLES :=
80def_undefine_default :=
81endif
82
83#
[743]84# Zap suffixes.
[723]85#
86.SUFFIXES:
87SUFFIXES :=
88
89#
[743]90# Zap implicit rules
[723]91#
92ifeq ($(MAKEFLAGS),$(MAKEFLAGS:r=x))
93MAKEFLAGS := r$(MAKEFLAGS)
94# add the -r makeflag to avoid doing this for submakes
95
96%.C:
97%.F:
98%.S:
99%.a:
100%.c:
101%.c: %.l
102%.c: %.w
103%.c: %.w %.ch
104%.c: %.y
105%.cc:
106%.ch:
107%.cpp:
108%.def:
109%.dll:
110%.dvi:
111%.dvi: %.tex
112%.dvi: %.texi
113%.dvi: %.texinfo
114%.dvi: %.txinfo
115%.el:
116%.elc:
117%.exe:
118%.f:
119%.f: %.F
120%.f: %.r
121%.h:
122%.info:
123%.info: %.texi
124%.info: %.texinfo
125%.info: %.txinfo
126%.l:
127%.lib:
128%.ln:
129%.ln: %.c
130%.ln: %.l
131%.ln: %.y
132%.mod:
133%.o:
134%.o: %.C
135%.o: %.F
136%.o: %.S
137%.o: %.c
138%.o: %.cc
139%.o: %.cpp
140%.o: %.f
141%.o: %.mod
142%.o: %.p
143%.o: %.r
144%.o: %.s
145%.obj:
146%.out:
147%.out: %
148%.p:
149%.p: %.web
150%.r:
151%.r: %.l
152%.s:
153%.s: %.S
154%.sh:
155%.sym:
156%.sym: %.def
157%.tex:
158%.tex: %.w
159%.tex: %.w %.ch
160%.tex: %.web
161%.texi:
162%.texinfo:
163%.txinfo:
164%.w:
165%.web:
166%.y:
167%: %.C
168%: %.F
169%: %.S
170%: %.c
171%: %.cc
172%: %.cpp
173%: %.f
174%: %.mod
175%: %.o
176%: %.p
177%: %.r
178%: %.s
179%: %.sh
180%:: %,v
181%:: RCS/%
182%:: RCS/%,v
183%:: SCCS/s.%
184%:: s.%
185(%): %
186endif
187
188
Note: See TracBrowser for help on using the repository browser.