VirtualBox

source: kBuild/trunk/src/gmake/Makefile.kmk@ 864

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

amd64 hack.

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

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