VirtualBox

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

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

Added fake xargs implementation. Retired abspathex to gnumake-header.kmk.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1# $Id: gnumake-header.kmk 825 2007-02-01 06:37:56Z bird $
2## @file
3#
4# kBuild - Additional header for use when bootstrapping kBuild using Vanilla GNU Make.
5#
6# Copyright (c) 2004-2007 knut st. osmundsen <[email protected]>
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
35##
36# Pushes an item onto a 'stack' variable.
37# @param $1 The stack variable name
38# @param $2 What to push.
39stack-push = $(eval $1 +=$2)
40
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.
49# This does *NOT* return the top element, use
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
59## Converts an relative path to an absolute path using the given CWD.
60# @returns absolute path.
61# @param $1 The path to fixup.
62# @param $2 The CWD to use.
63abspathex = $(foreach _fix_path,$1\
64,$(if $(subst :$(call no-root-slash,$(call no-drive,$(_fix_path))):,,:$(_fix_path):),$(_fix_path),$(abspath $2/$(_fix_path))))
65
66
67##
68# Use the APPEND shell script in case we're boot strapping.
69override APPEND_EXT := $(PATH_KBUILD)/gnumake-append.sh
70override APPEND = $(APPEND_EXT)
71
72#
73# Fix some default variables.
74#
75ifeq ($(MAKEFLAGS),$(MAKEFLAGS:R=x))
76# add the -R makeflag to avoid doing this for submakes
77MAKEFLAGS := R$(MAKEFLAGS)
78
79define def_undefine_default
80ifeq ($(origin $1), default)
81$1:=
82endif
83endef
84
85_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
86$(foreach i, $(_DEFAULT_VARIABLES), $(eval $(call def_undefine_default,$(i))))
87_DEFAULT_VARIABLES :=
88def_undefine_default :=
89endif
90
91#
92# Zap suffixes.
93#
94.SUFFIXES:
95SUFFIXES :=
96
97#
98# Zap implicit rules
99#
100ifeq ($(MAKEFLAGS),$(MAKEFLAGS:r=x))
101MAKEFLAGS := r$(MAKEFLAGS)
102# add the -r makeflag to avoid doing this for submakes
103
104%.C:
105%.F:
106%.S:
107%.a:
108%.c:
109%.c: %.l
110%.c: %.w
111%.c: %.w %.ch
112%.c: %.y
113%.cc:
114%.ch:
115%.cpp:
116%.def:
117%.dll:
118%.dvi:
119%.dvi: %.tex
120%.dvi: %.texi
121%.dvi: %.texinfo
122%.dvi: %.txinfo
123%.el:
124%.elc:
125%.exe:
126%.f:
127%.f: %.F
128%.f: %.r
129%.h:
130%.info:
131%.info: %.texi
132%.info: %.texinfo
133%.info: %.txinfo
134%.l:
135%.lib:
136%.ln:
137%.ln: %.c
138%.ln: %.l
139%.ln: %.y
140%.mod:
141%.o:
142%.o: %.C
143%.o: %.F
144%.o: %.S
145%.o: %.c
146%.o: %.cc
147%.o: %.cpp
148%.o: %.f
149%.o: %.mod
150%.o: %.p
151%.o: %.r
152%.o: %.s
153%.obj:
154%.out:
155%.out: %
156%.p:
157%.p: %.web
158%.r:
159%.r: %.l
160%.s:
161%.s: %.S
162%.sh:
163%.sym:
164%.sym: %.def
165%.tex:
166%.tex: %.w
167%.tex: %.w %.ch
168%.tex: %.web
169%.texi:
170%.texinfo:
171%.txinfo:
172%.w:
173%.web:
174%.y:
175%: %.C
176%: %.F
177%: %.S
178%: %.c
179%: %.cc
180%: %.cpp
181%: %.f
182%: %.mod
183%: %.o
184%: %.p
185%: %.r
186%: %.s
187%: %.sh
188%:: %,v
189%:: RCS/%
190%:: RCS/%,v
191%:: SCCS/s.%
192%:: s.%
193(%): %
194endif
195
196
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