VirtualBox

source: kBuild/trunk/src/gmakenew/Makefile.kmk@ 929

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

multi target explicit rules. partly done.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.5 KB
Line 
1# $Id: Makefile.kmk 921 2007-05-25 03:27:53Z bird $
2
3
4DEPTH = ../..
5PATH_GNUMAKE_SRC = $(PATH_ROOT)/src/gmakenew
6include $(PATH_KBUILD)/header.kmk
7
8
9#
10# Template for kmk and the kmk_* binaries in this makefile.
11#
12TEMPLATE_BIN-KMK = Template for src/gmake binaries
13TEMPLATE_BIN-KMK_EXTENDS = BIN
14TEMPLATE_BIN-KMK_DEFS = HAVE_CONFIG_H $(TEMPLATE_BIN_DEFS)
15TEMPLATE_BIN-KMK_DEPS = $(PATH_TARGET)/config.h
16TEMPLATE_BIN-KMK_CLEAN = $(TEMPLATE_BIN-KMK_DEPS)
17TEMPLATE_BIN-KMK_DEPS.solaris = \
18 $(PATH_TARGET)/fts.h \
19 $(PATH_TARGET)/paths.h
20TEMPLATE_BIN-KMK_CLEAN.solaris = $(TEMPLATE_BIN-KMK_DEPS.solaris)
21TEMPLATE_BIN-KMK_DEPS.win = \
22 $(PATH_TARGET)/fts.h \
23 $(PATH_TARGET)/sysexits.h \
24 $(PATH_TARGET)/unistd.h \
25 $(PATH_TARGET)/paths.h \
26 $(PATH_TARGET)/grp.h \
27 $(PATH_TARGET)/pwd.h \
28 $(PATH_TARGET)/inttypes.h
29TEMPLATE_BIN-KMK_CLEAN.win = $(TEMPLATE_BIN-KMK_DEPS.win)
30TEMPLATE_BIN-KMK_INCS = $(PATH_TARGET) . $(TEMPLATE_BIN_INCS)
31TEMPLATE_BIN-KMK_INCS.darwin = glob
32TEMPLATE_BIN-KMK_INCS.freebsd = glob
33TEMPLATE_BIN-KMK_INCS.solaris = glob
34TEMPLATE_BIN-KMK_LIBS = $(TEMPLATE_BIN_LIBS) $(TARGET_kmkmissing)
35ifdef ELECTRIC_HEAP # for electric heap (see electric.c) - windows only.
36TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN_CFLAGS) /FI$(PATH_CURRENT)/electric.h -DELECTRIC_HEAP=1
37endif
38
39
40#
41# A library containing the missing features needed by kmk and the
42# kmk_* binaries. Saves a bit of work later on.
43#
44LIBRARIES += kmkmissing
45kmkmissing_TEMPLATE = BIN-KMK
46kmkmissing_NOINST = 1
47kmkmissing_SOURCES = \
48 kmkbuiltin/err.c \
49 kmkbuiltin/setmode.c \
50 kmkbuiltin/strmode.c \
51 kmkbuiltin/strlcpy.c \
52 electric.c
53
54kmkmissing_SOURCES.darwin = \
55 kmkbuiltin/darwin.c \
56 glob/glob.c \
57 glob/fnmatch.c
58
59kmkmissing_SOURCES.freebsd = \
60 glob/glob.c \
61 glob/fnmatch.c
62
63kmkmissing_SOURCES.solaris = \
64 kmkbuiltin/solfakes.c \
65 kmkbuiltin/fts.c \
66 glob/glob.c \
67 glob/fnmatch.c \
68 getopt.c \
69 getopt1.c
70
71kmkmissing_SOURCES.win += \
72 glob/glob.c \
73 glob/fnmatch.c \
74 getopt.c \
75 getopt1.c \
76 getloadavg.c \
77 w32/subproc/misc.c \
78 w32/subproc/sub_proc.c \
79 w32/subproc/w32err.c \
80 w32/compat/dirent.c \
81 w32/pathstuff.c \
82 kmkbuiltin/mscfakes.c \
83 kmkbuiltin/fts.c
84
85#
86# kmk
87#
88PROGRAMS += kmk
89
90kmk_TEMPLATE = BIN-KMK
91
92kmk_DEFS = \
93 NO_ARCHIVES \
94 EXPERIMENTAL \
95 CONFIG_WITH_TOUPPER_TOLOWER \
96 CONFIG_WITH_EXPLICIT_MULTITARGET \
97 \
98 KMK \
99 KMK_HELPERS \
100 VARIABLE_HASH \
101 CONFIG_NO_DEFAULT_SUFFIXES \
102 CONFIG_NO_DEFAULT_PATTERN_RULES \
103 CONFIG_NO_DEFAULT_TERMINAL_RULES \
104 CONFIG_NO_DEFAULT_SUFFIX_RULES \
105 CONFIG_NO_DEFAULT_VARIABLES \
106 CONFIG_WITH_EXTENDED_NOTPARALLEL \
107 CONFIG_WITH_INCLUDEDEP \
108 CONFIG_WITH_VALUE_LENGTH \
109 CONFIG_WITH_RSORT \
110 CONFIG_WITH_ABSPATHEX \
111 CONFIG_WITH_COMPARE \
112 CONFIG_WITH_STACK \
113 CONFIG_WITH_MATH \
114 CONFIG_WITH_XARGS \
115 CONFIG_PRETTY_COMMAND_PRINTING \
116 \
117 BUILD_PLATFORM=\"$(BUILD_TARGET)\" \
118 BUILD_PLATFORM_ARCH=\"$(BUILD_TARGET_ARCH)\" \
119 BUILD_PLATFORM_CPU=\"$(BUILD_TARGET_CPU)\"
120kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS
121kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS
122kmk_DEFS.win.x86 = \
123 CONFIG_NEW_WIN32_CTRL_EVENT
124
125kmk_SOURCES = \
126 main.c \
127 read.c \
128 hash.c \
129 strcache.c \
130 variable.c \
131 ar.c \
132 arscan.c \
133 commands.c \
134 default.c \
135 dir.c \
136 expand.c \
137 file.c \
138 function.c \
139 implicit.c \
140 job.c \
141 misc.c \
142 remake.c \
143 rule.c \
144 signame.c \
145 version.c \
146 vpath.c \
147 remote-stub.c \
148 kbuild.c
149
150#
151# kmkbuiltin commands
152#
153kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
154kmk_SOURCES += \
155 kmkbuiltin.c \
156 kmkbuiltin/append.c \
157 kmkbuiltin/cat.c \
158 kmkbuiltin/cp.c \
159 kmkbuiltin/cp_utils.c \
160 kmkbuiltin/echo.c \
161 kmkbuiltin/install.c \
162 kmkbuiltin/mkdir.c \
163 kmkbuiltin/mv.c \
164 kmkbuiltin/ln.c \
165 kmkbuiltin/printf.c \
166 kmkbuiltin/rm.c \
167 kmkbuiltin/rmdir.c \
168
169
170#
171# Standalone kmkbuiltin commands.
172#
173## @todo should probably put all those
174PROGRAMS += kmk_append kmk_cat kmk_cp kmk_echo kmk_mkdir kmk_mv kmk_install kmk_ln kmk_printf kmk_rm kmk_rmdir
175
176kmk_append_TEMPLATE = BIN-KMK
177kmk_append_DEFS = kmk_builtin_append=main
178kmk_append_INCS = .
179kmk_append_SOURCES = \
180 kmkbuiltin/append.c
181
182kmk_cat_TEMPLATE = BIN-KMK
183kmk_cat_DEFS = kmk_builtin_cat=main
184kmk_cat_SOURCES = \
185 kmkbuiltin/cat.c
186
187kmk_cp_TEMPLATE = BIN-KMK
188kmk_cp_DEFS = kmk_builtin_cp=main
189kmk_cp_SOURCES = \
190 kmkbuiltin/cp.c \
191 kmkbuiltin/cp_utils.c
192
193kmk_echo_TEMPLATE = BIN-KMK
194kmk_echo_DEFS = kmk_builtin_echo=main
195kmk_echo_SOURCES = \
196 kmkbuiltin/echo.c
197
198kmk_install_TEMPLATE = BIN-KMK
199kmk_install_DEFS = kmk_builtin_install=main
200kmk_install_SOURCES = \
201 kmkbuiltin/install.c
202
203kmk_ln_TEMPLATE = BIN-KMK
204kmk_ln_DEFS = kmk_builtin_ln=main
205kmk_ln_SOURCES = \
206 kmkbuiltin/ln.c
207
208kmk_mkdir_TEMPLATE = BIN-KMK
209kmk_mkdir_DEFS = kmk_builtin_mkdir=main
210kmk_mkdir_SOURCES = \
211 kmkbuiltin/mkdir.c
212
213kmk_mv_TEMPLATE = BIN-KMK
214kmk_mv_DEFS = kmk_builtin_mv=main
215kmk_mv_SOURCES = \
216 kmkbuiltin/mv.c
217
218kmk_printf_TEMPLATE = BIN-KMK
219kmk_printf_DEFS = kmk_builtin_printf=main
220kmk_printf_SOURCES = \
221 kmkbuiltin/printf.c
222
223kmk_rm_TEMPLATE = BIN-KMK
224kmk_rm_DEFS = kmk_builtin_rm=main
225kmk_rm_SOURCES = \
226 kmkbuiltin/rm.c
227
228kmk_rmdir_TEMPLATE = BIN-KMK
229kmk_rmdir_DEFS = kmk_builtin_rmdir=main
230kmk_rmdir_SOURCES = \
231 kmkbuiltin/rmdir.c
232
233
234#
235# kmk_gmake - almost plain GNU Make.
236#
237PROGRAMS += kmk_gmake
238
239kmk_gmake_TEMPLATE = BIN-KMK
240kmk_gmake_DEFS = \
241 HAVE_CONFIG_H \
242 NO_ARCHIVES \
243 CONFIG_WITH_TOUPPER_TOLOWER \
244 EXPERIMENTAL
245
246kmk_gmake_SOURCES = \
247 main.c \
248 read.c \
249 hash.c \
250 strcache.c \
251 variable.c \
252 ar.c \
253 arscan.c \
254 commands.c \
255 default.c \
256 dir.c \
257 expand.c \
258 file.c \
259 function.c \
260 implicit.c \
261 job.c \
262 misc.c \
263 remake.c \
264 rule.c \
265 signame.c \
266 version.c \
267 vpath.c \
268 remote-stub.c
269
270
271include $(PATH_KBUILD)/footer.kmk
272
273
274#
275# Use checked in config.h instead of running ./Configure for it.
276#
277config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
278$(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
279 $(MKDIR) -p $(dir $@)
280 $(CP) $^ $@
281
282#
283# Some missing headers.
284#
285$(PATH_TARGET)/fts.h: kmkbuiltin/ftsfake.h | $(call DIRDEP,$(PATH_TARGET))
286 $(CP) $^ $@
287
288$(PATH_TARGET)/unistd.h: | $(call DIRDEP,$(PATH_TARGET))
289 $(ECHO_EXT) > $@
290
291$(PATH_TARGET)/sysexits.h: | $(call DIRDEP,$(PATH_TARGET))
292 $(ECHO_EXT) > $@
293
294$(PATH_TARGET)/inttypes.h: | $(call DIRDEP,$(PATH_TARGET))
295 $(ECHO_EXT) > $@
296
297$(PATH_TARGET)/paths.h: | $(call DIRDEP,$(PATH_TARGET))
298 $(ECHO_EXT) > $@
299
300$(PATH_TARGET)/pwd.h: | $(call DIRDEP,$(PATH_TARGET))
301 $(ECHO_EXT) > $@
302
303$(PATH_TARGET)/grp.h: | $(call DIRDEP,$(PATH_TARGET))
304 $(ECHO_EXT) > $@
305
306
307#
308# Some tests.
309#
310parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
311parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
312 echo $@_start ; sleep 1; echo $@_done
313
314test:
315 echo "1"
316 echo "2"
317 echo "3"
318 echo "4"
319
320
321#
322# Shell execution tests.
323#
324test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
325
326# shell double and single quoting check (was busted on windows in 3.81).
327test_shell_quoting:
328 $(ECHO_EXT) "double quoted sTrInG"
329 $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
330 $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
331 $(ECHO) "This string should not be printed with double quotes."
332 $(ECHO) 'This string should not be printed with single quotes.'
333 ( echo " #define PWD \"`pwd`\""; )
334
335test_shell_double_quoting:
336 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
337 "s/foo/$@/" -e \
338 "s/foo/works/" \
339 -e "s/foo/\!/"
340
341test_shell_double_quoting2:
342 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
343 "s/foo/$@/" -e \
344 "s/foo/works/" \
345 -e\
346 "s/foo/\!/"
347
348# when using batch mode shell, the newline got escaped twice and spoiling everything.
349test_shell_newline:
350 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
351 's/foo/$@/' -e \
352 's/foo/works/' \
353 -e 's/foo/\!/'
354
355
356test_stack:
357 $(MAKE) -f testcase-stack.kmk
358
359test_math:
360 $(MAKE) -f testcase-math.kmk
361
362
363test_all: test_math test_stack test_shell
364
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