xref: /haiku/build/jam/OverriddenJamRules (revision 16c83730262f1e4f0fc69d80744bb36dcfbbe3af)
1# Overridden to allow spaces in file names.
2actions Chmod1
3{
4	$(CHMOD) "$(MODE)" "$(1)"
5}
6
7# Overridden to allow spaces in file names.
8actions piecemeal together existing Clean
9{
10	$(RM) "$(>)"
11}
12
13#-------------------------------------------------------------------------------
14# Link rule/action are overwritten as they don't handle linking files who's name
15# contain spaces very well. Also adds resources and version to executable.
16#-------------------------------------------------------------------------------
17rule Link
18{
19	# Note: RESFILES must be set before invocation.
20
21	if [ on $(1) return $(PLATFORM) ] = host {
22		LINK on $(1) = $(HOST_LINK) ;
23	 	LINKFLAGS on $(1) = $(HOST_LINKFLAGS) [ on $(1) return $(LINKFLAGS) ] ;
24	} else {
25		LINK on $(1) = $(TARGET_LINK_$(TARGET_PACKAGING_ARCH)) ;
26	 	LINKFLAGS on $(1) = $(TARGET_LINKFLAGS_$(TARGET_PACKAGING_ARCH))
27			[ on $(1) return $(LINKFLAGS) ] ;
28	}
29
30 	NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] ;
31 	LINKLIBS on $(1) = [ on $(1) return $(LINKLIBS) ] ;
32
33	MODE on $(<) = $(EXEMODE) ;
34	on $(1) XRes $(1) : $(RESFILES) ;
35	if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
36		SetType $(1) ;
37		MimeSet $(1) : sharedObject ;
38		SetVersion $(1) ;
39
40		# For applications for the target also generate the MIME DB entries.
41		if [ on $(1) return $(PLATFORM) ] != host
42			&& [ on $(1) return $(RESFILES) ] {
43			CreateAppMimeDBEntries $(1) ;
44		}
45
46		# If the generic attribute emulation is enabled, make sure the tool to
47		# remove the attributes is built first.
48		if $(HOST_RM_ATTRS_TARGET) {
49			Depends $(1) : $(HOST_RM_ATTRS_TARGET) ;
50		}
51	}
52	Chmod $(<) ;
53}
54
55# When using "real" attributes (i.e. BeOS attributes or xattr/extattr) on the
56# host platform, unlinking the main target by gcc will also automatically get
57# rid of the attributes. When using the generic attribute emulation, which
58# uses separate files, we need to remove the target explicitely first, so that
59# the attributes won't be "leaked".
60if $(HOST_PLATFORM_BEOS_COMPATIBLE) || $(HAIKU_HOST_USE_XATTR) = 1 {
61	actions Link bind NEEDLIBS LINK_BEGIN_GLUE LINK_END_GLUE VERSION_SCRIPT
62	{
63		$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(LINK_BEGIN_GLUE)" "$(2)" \
64			"$(NEEDLIBS)" $(LINKLIBS) "$(LINK_END_GLUE)" \
65			-Wl,--version-script,$(VERSION_SCRIPT)
66	}
67} else {
68	actions Link bind NEEDLIBS LINK_BEGIN_GLUE LINK_END_GLUE VERSION_SCRIPT
69	{
70		$(RM) "$(1)"
71		$(LINK) $(LINKFLAGS) -o "$(1)" $(UNDEFS) "$(LINK_BEGIN_GLUE)" "$(2)" \
72			"$(NEEDLIBS)" $(LINKLIBS) "$(LINK_END_GLUE)" \
73			-Wl,--version-script,$(VERSION_SCRIPT)
74	}
75}
76
77rule Object
78{
79	# find out which headers and defines to use
80	local headers ;
81	local sysHeaders ;
82	local defines ;
83
84	on $(1) { # use on $(1) variable values
85		if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
86			return ;
87		}
88
89		# Save HDRS for -I$(HDRS) on compile.
90		# We shouldn't need -I$(SEARCH_SOURCE) as cc can find headers
91		# in the .c file's directory, but generated .c files (from
92		# yacc, lex, etc) are located in $(LOCATE_TARGET), possibly
93		# different from $(SEARCH_SOURCE).
94
95		headers = $(HAIKU_CONFIG_HEADERS) $(SEARCH_SOURCE) $(SUBDIRHDRS)
96			$(HDRS) ;
97		sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ;
98		defines = $(DEFINES) ;
99
100		if $(PLATFORM) = host {
101			sysHeaders += $(HOST_HDRS) ;
102			defines += $(HOST_DEFINES) ;
103
104			if $(USES_BE_API) {
105				sysHeaders += $(HOST_BE_API_HEADERS) ;
106			}
107
108		} else {
109			sysHeaders += $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ;
110			defines += $(TARGET_DEFINES_$(TARGET_PACKAGING_ARCH))
111				$(TARGET_DEFINES) ;
112		}
113	}
114
115	# locate object and search for source
116
117	LocalClean clean : $(<) ;
118
119	MakeLocateDebug $(<) ;
120	SEARCH on $(>) = $(SEARCH_SOURCE) ;
121
122	HDRS on $(<) = $(headers) ;
123	SYSHDRS on $(<) = $(sysHeaders) ;
124
125	# handle #includes for source: Jam scans for headers with
126	# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE)
127	# with the scanned file as the target and the found headers
128	# as the sources.  HDRSEARCH is the value of SEARCH used for
129	# the found header files.  Finally, if jam must deal with
130	# header files of the same name in different directories,
131	# they can be distinguished with HDRGRIST.
132
133	# $(SEARCH_SOURCE:E) is where cc first looks for #include
134	# "foo.h" files.  If the source file is in a distant directory,
135	# look there.  Else, look in "" (the current directory).
136
137	HDRRULE on $(>) = HdrRule ;
138	HDRSCAN on $(>) = $(HDRPATTERN) ;
139	HDRSEARCH on $(>) = $(headers) $(sysHeaders) $(STDHDRS) ;
140	HDRGRIST on $(>) = $(HDRGRIST) ;
141
142	# propagate target specific-defines
143
144	DEFINES on $(1) = $(defines) ;
145
146	# if source is not .c, generate .c with specific rule
147
148	switch $(>:S)
149	{
150	    case .asm : As $(<) : $(>) ;
151	    case .nasm : AssembleNasm $(<) : $(>) ;
152	    case .c :	Cc $(<) : $(>) ;
153	    case .C :	C++ $(<) : $(>) ;
154	    case .cc :	C++ $(<) : $(>) ;
155	    case .cpp : C++ $(<) : $(>) ;
156	    case .f :	Fortran $(<) : $(>) ;
157	    case .l :	if [ on $(2) return $(GENERATE_C++) ] {
158	    				InheritPlatform $(<:S=.cpp) : $(1) ;
159						C++ $(<) : $(<:S=.cpp) ;
160						Lex $(<:S=.cpp) : $(>) ;
161					} else {
162	    				InheritPlatform $(<:S=.c) : $(1) ;
163						Cc $(<) : $(<:S=.c) ;
164						Lex $(<:S=.c) : $(>) ;
165					}
166		case *.o :	return ;
167	    case .s :	As $(<) : $(>) ;
168	    case .S :	As $(<) : $(>) ;
169	    case .y :	if [ on $(2) return $(GENERATE_C++) ] {
170	    				InheritPlatform $(1:S=.cpp) $(1:S=.hpp) : $(1) ;
171						C++ $(1) : $(1:S=.cpp) ;
172						Yacc $(1:S=.cpp) $(1:S=.hpp) : $(2) ;
173					} else {
174	    				InheritPlatform $(1:S=.c) $(1:S=.h) : $(1) ;
175						Cc $(1) : $(1:S=.c) ;
176						Yacc $(1:S=.c) $(1:S=.h) : $(2) ;
177					}
178	    case * :	UserObject $(<) : $(>) ;
179	}
180}
181
182rule As
183{
184	local flags ;
185	local includesSeparator ;
186	local localIncludesOption ;
187	local systemIncludesOption ;
188	if [ on $(1) return $(PLATFORM) ] = host {
189		flags = [ on $(1) return $(HOST_ASFLAGS) $(ASFLAGS) ] ;
190
191		CC on $(1) = $(HOST_CC) ;
192
193		includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
194		localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
195		systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
196
197	} else {
198		flags = [ on $(1) return $(TARGET_ASFLAGS_$(architecture))
199			$(ASFLAGS) ] ;
200
201		CC on $(1) = $(TARGET_CC_$(TARGET_PACKAGING_ARCH)) ;
202
203		includesSeparator
204			= $(TARGET_INCLUDES_SEPARATOR_$(TARGET_PACKAGING_ARCH)) ;
205		localIncludesOption
206			= $(TARGET_LOCAL_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
207		systemIncludesOption
208			= $(TARGET_SYSTEM_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
209	}
210
211	Depends $(<) : $(>) ;
212	ASFLAGS on $(<) += $(flags) $(SUBDIRASFLAGS) ;
213	ASHDRS on $(<) = [ on $(<) FIncludes $(HDRS) : $(localIncludesOption) ]
214		$(includesSeparator)
215		[ on $(<) FSysIncludes $(SYSHDRS) : $(systemIncludesOption) ] ;
216	ASDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;
217}
218
219# TODO: The KERNEL_CCFLAGS were used here before. Check whether we need any
220# flags we don't have now.
221actions As
222{
223	$(CC) -c "$(2)" -O2 $(ASFLAGS) -D_ASSEMBLER $(ASDEFS) $(ASHDRS) -o "$(1)" ;
224}
225
226rule Lex
227{
228	Depends $(1) : $(2) ;
229	MakeLocateArch $(1) ;
230	LocalClean clean : $(1) ;
231}
232
233actions Lex
234{
235	$(LEX) $(LEXFLAGS) -o$(1) $(2)
236}
237
238rule Yacc
239{
240	local source = $(1[1]) ;
241	local header = $(1[2]) ;
242	local yaccSource = $(2) ;
243
244	MakeLocateArch $(source) $(header) ;
245
246	Depends $(source) $(header) : $(yaccSource) ;
247	Yacc1 $(source) $(header) : $(yaccSource) ;
248	LocalClean clean : $(source) $(header) ;
249
250	# make sure someone includes $(header) else it will be
251	# a deadly independent target
252
253	Includes $(source) : $(header) ;
254}
255
256actions Yacc1
257{
258	bison $(YACCFLAGS) -o $(1[1]) $(2)
259	[ -f $(1[1]).h ] && mv $(1[1]).h $(1[2]) || true
260}
261
262rule Cc
263{
264	Depends $(<) : $(>) ;
265
266	on $(1) {
267		local flags ;
268		local includesSeparator ;
269		local localIncludesOption ;
270		local systemIncludesOption ;
271
272		# optimization flags
273		if $(DEBUG) = 0 {
274			flags += $(OPTIM) ;
275		} else {
276			flags += -O0 ;
277		}
278
279		if $(PLATFORM) = host {
280			# warning flags
281			if $(WARNINGS) != 0 {
282				flags += $(HOST_WARNING_CCFLAGS) ;
283			}
284
285			# debug and other flags
286			flags += $(HOST_CCFLAGS) $(HOST_DEBUG_$(DEBUG)_CCFLAGS)
287				$(SUBDIRCCFLAGS) $(CCFLAGS) ;
288
289			if $(USES_BE_API) {
290				flags += $(HOST_BE_API_CCFLAGS) ;
291			}
292
293			CC on $(1) = $(HOST_CC) ;
294
295			includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
296			localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
297			systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
298
299		} else {
300			# warning flags
301			if $(WARNINGS) != 0 {
302				flags += $(TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH)) ;
303			}
304
305			# debug and other flags
306			flags += $(TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH))
307				$(TARGET_DEBUG_$(DEBUG)_CCFLAGS_$(TARGET_PACKAGING_ARCH))
308				$(SUBDIRCCFLAGS) $(CCFLAGS) ;
309
310			CC on $(1) = $(TARGET_CC_$(TARGET_PACKAGING_ARCH)) ;
311
312			includesSeparator
313				= $(TARGET_INCLUDES_SEPARATOR_$(TARGET_PACKAGING_ARCH)) ;
314			localIncludesOption
315				= $(TARGET_LOCAL_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
316			systemIncludesOption
317				= $(TARGET_SYSTEM_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
318		}
319
320		CCFLAGS on $(<) = $(flags) ;
321		CCHDRS on $(<) = [ FIncludes $(HDRS) : $(localIncludesOption) ]
322			$(includesSeparator)
323			[ FSysIncludes $(SYSHDRS) : $(systemIncludesOption) ] ;
324		CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
325	}
326}
327
328actions Cc
329{
330	$(CC) $(CCFLAGS) -c "$(2)" $(CCDEFS) $(CCHDRS) -o "$(1)" ;
331}
332
333rule C++
334{
335	Depends $(<) : $(>) ;
336
337	on $(1) {
338		local flags ;
339		local includesSeparator ;
340		local localIncludesOption ;
341		local systemIncludesOption ;
342
343		# optimization flags
344		if $(DEBUG) = 0 {
345			flags += $(OPTIM) ;
346		} else {
347			flags += -O0 ;
348		}
349
350		if $(PLATFORM) = host {
351			# warning flags
352			if $(WARNINGS) != 0 {
353				flags += $(HOST_WARNING_C++FLAGS) ;
354			}
355
356			# debug and other flags
357			flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS)
358				$(SUBDIRC++FLAGS) $(C++FLAGS) ;
359
360			if $(USES_BE_API) {
361				flags += $(HOST_BE_API_C++FLAGS) ;
362			}
363
364			C++ on $(1) = $(HOST_C++) ;
365
366			includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
367			localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
368			systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
369
370		} else {
371			# warning flags
372			if $(WARNINGS) != 0 {
373				flags += $(TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH)) ;
374			}
375
376			# debug and other flags
377			flags += $(TARGET_C++FLAGS_$(TARGET_PACKAGING_ARCH))
378				$(TARGET_DEBUG_$(DEBUG)_C++FLAGS_$(TARGET_PACKAGING_ARCH))
379				$(SUBDIRC++FLAGS) $(C++FLAGS) ;
380
381			C++ on $(1) = $(TARGET_C++_$(TARGET_PACKAGING_ARCH)) ;
382
383			includesSeparator
384				= $(TARGET_INCLUDES_SEPARATOR_$(TARGET_PACKAGING_ARCH)) ;
385			localIncludesOption
386				= $(TARGET_LOCAL_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
387			systemIncludesOption
388				= $(TARGET_SYSTEM_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
389		}
390
391		C++FLAGS on $(<) = $(flags) ;
392		CCHDRS on $(<) = [ FIncludes $(HDRS) : $(localIncludesOption) ]
393			$(includesSeparator)
394			[ FSysIncludes $(SYSHDRS) : $(systemIncludesOption) ] ;
395		CCDEFS on $(<) = [ FDefines $(DEFINES) ] ;
396	}
397}
398
399actions C++
400{
401	$(C++) -c "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ;
402}
403
404actions together Archive
405{
406	# Force recreation of the archive to avoid build errors caused by
407	# stale dependencies after renaming or deleting object files.
408	$(RM) $(<)
409	$(AR) $(<) $(>)
410}
411
412rule Library
413{
414	local lib = $(1) ;
415	local sources = [ FGristFiles $(2) ] ;
416	local objects = $(sources:S=$(SUFOBJ)) ;
417
418	InheritPlatform $(objects) : $(lib) ;
419	LibraryFromObjects $(lib) : $(objects) ;
420	Objects $(sources) ;
421}
422
423rule LibraryFromObjects
424{
425	local _i _l _s ;
426
427	# Add grist to file names
428	# bonefish: No, don't. The Library rule does that anyway, and when we
429	# have an object from another dir, we certainly don't want that.
430
431	_s = $(>) ;
432	_l = $(<:S=$(SUFLIB)) ;
433
434	on $(_l) {
435		# set the tools according to the platform
436		if $(PLATFORM) = host {
437			AR on $(_l) = $(HOST_AR) $(HOST_ARFLAGS) ;
438			RANLIB on $(_l) = $(HOST_RANLIB) ;
439		} else {
440			AR on $(_l) = $(TARGET_AR_$(TARGET_PACKAGING_ARCH))
441				$(TARGET_ARFLAGS_$(TARGET_PACKAGING_ARCH)) ;
442			RANLIB on $(_l) = $(TARGET_RANLIB_$(TARGET_PACKAGING_ARCH)) ;
443		}
444
445		# library depends on its member objects
446
447		if $(KEEPOBJS)
448		{
449			LocalDepends obj : $(_s) ;
450		}
451
452		LocalDepends lib : $(_l) ;
453
454		# Set LOCATE for the library and its contents.  The bound
455		# value shows up as $(NEEDLIBS) on the Link actions.
456		# For compatibility, we only do this if the library doesn't
457		# already have a path.
458
459		if ! $(_l:D)
460		{
461			# locate the library only, if it hasn't been located yet
462			local dir = $(LOCATE[1]) ;
463			if ! $(dir) {
464				MakeLocateDebug $(_l) ;
465				dir = [ on $(_l) return $(LOCATE[1]) ] ;
466					# Note: The "on ..." is necessary, since our environment
467					# isn't changed by MakeLocateDebug.
468			}
469			MakeLocate $(_l)($(_s:BS)) : $(dir) ;
470		}
471
472		if $(NOARSCAN)
473		{
474			# If we can't scan the library to timestamp its contents,
475			# we have to just make the library depend directly on the
476			# on-disk object files.
477
478			Depends $(_l) : $(_s) ;
479		}
480		else
481		{
482			# If we can scan the library, we make the library depend
483			# on its members and each member depend on the on-disk
484			# object file.
485
486			Depends $(_l) : $(_l)($(_s:BS)) ;
487
488			for _i in $(_s)
489			{
490			Depends $(_l)($(_i:BS)) : $(_i) ;
491			}
492		}
493
494		LocalClean clean : $(_l) ;
495
496		# bonefish: Not needed on the supported platforms. Maybe later...
497		# if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; }
498
499		Archive $(_l) : $(_s) ;
500
501		if $(RANLIB) { Ranlib $(_l) ; }
502
503		# If we can't scan the library, we have to leave the .o's around.
504
505		if ! ( $(KEEPOBJS) || $(NOARSCAN) || $(NOARUPDATE) ) {
506			RmTemps $(_l) : $(_s) ;
507		}
508	}
509}
510
511rule Main
512{
513	local target = $(1) ;
514	local sources = [ FGristFiles $(2) ] ;
515	local objects = $(sources:S=$(SUFOBJ)) ;
516
517	InheritPlatform $(objects) : $(target) ;
518	MainFromObjects $(target) : $(objects) ;
519	Objects $(sources) ;
520}
521
522rule MainFromObjects
523{
524	local _s _t ;
525
526	# Add grist to file names
527	# Add suffix to exe
528
529	_s = [ FGristFiles $(>) ] ;
530	_t = [ FAppendSuffix $(<) : $(SUFEXE) ] ;
531
532	# so 'jam foo' works when it's really foo.exe
533
534	if $(_t) != $(<)
535	{
536	    Depends $(<) : $(_t) ;
537	    NotFile $(<) ;
538	}
539
540	# make compiled sources a dependency of target
541
542	LocalDepends exe : $(_t) ;
543	Depends $(_t) : $(_s) ;
544	MakeLocateDebug $(_t) ;
545
546	LocalClean clean : $(_t) ;
547
548	Link $(_t) : $(_s) ;
549}
550
551# Override Jam 2.5rc3 MakeLocate and MkDir to deal more intelligently
552# with grist set on the supplied directory name. Also do nothing for already
553# located files.
554rule MakeLocate
555{
556	local dir = $(2[1]) ;
557
558	if $(dir)
559	{
560		if ! $(dir:G) {
561			dir = $(dir:G=dir) ;
562		}
563
564		local target ;
565		for target in $(1) {
566			# don't relocate once located
567		    LOCATE on $(target) += $(dir:G=) ;
568			if [ on $(target) return $(LOCATE) ] = $(dir:G=) {
569			    Depends $(target) : $(dir) ;
570		    	MkDir $(dir) ;
571			}
572		}
573	}
574}
575
576rule MkDir
577{
578	local dir = $(<) ;
579	if ! $(dir:G) {
580		dir = $(dir:G=dir) ;
581	}
582
583	# make this and all super directories
584	while true {
585		# If dir exists, don't update it
586		# Do this even for $(DOT).
587		NoUpdate $(dir) ;
588
589		# Bail out when reaching the CWD (".") or a directory we've already
590		# made.
591		if $(dir:G=) = $(DOT) || $($(dir:G=)-mkdir) {
592			return ;
593		}
594
595		local s ;
596
597		# Cheesy gate to prevent multiple invocations on same dir
598		# MkDir1 has the actions
599		# Arrange for jam dirs
600
601		$(dir:G=)-mkdir = true ;
602		MkDir1 $(dir) ;
603		LocalDepends dirs : $(dir) ;
604
605		# Recursively make parent directories.
606		# $(dir:P) = $(dir)'s parent, & we recurse until root
607
608		s = $(dir:P) ;	# parent keeps grist
609
610		if $(s:G=) && $(s) != $(dir) {
611			Depends $(dir) : $(s) ;
612			dir = $(s) ;
613		} else if $(s) {
614			NotFile $(s) ;
615			break ;
616		}
617	}
618}
619
620rule ObjectCcFlags
621{
622	# supports inheriting the global variable value
623
624	local file ;
625	for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
626		CCFLAGS on $(file) = [ on $(file) return $(CCFLAGS) ] $(2) ;
627	}
628}
629
630rule ObjectC++Flags
631{
632	# supports inheriting the global variable value
633
634	local file ;
635	for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
636		C++FLAGS on $(file) = [ on $(file) return $(C++FLAGS) ] $(2) ;
637	}
638}
639
640rule ObjectDefines
641{
642	# supports inheriting the global variable value and multiple files
643
644	if $(2) {
645		local file ;
646		for file in [ FGristFiles $(1:S=$(SUFOBJ)) ] {
647			DEFINES on $(file) = [ on $(file) return $(DEFINES) ] $(2) ;
648			CCDEFS on $(file) = [ on $(file) FDefines $(DEFINES) ] ;
649		}
650	}
651}
652
653rule ObjectHdrs
654{
655	# ObjectHdrs <sources or objects> : <headers> : <gristed objects>
656	# Note: Parameter 3 <gristed objects> is an extension.
657
658	local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
659	local headers = $(2) ;
660
661	local file ;
662	for file in $(objects) {
663		on $(file) {
664			local localHeaders = $(HDRS) $(headers) ;
665			SYSHDRS on $(file) = $(localHeaders) ;
666
667			# reformat ASHDRS and CCHDRS
668			local fileHeaders ;
669
670			if $(PLATFORM) = host {
671				fileHeaders =
672					[ FIncludes $(localHeaders) : $(HOST_LOCAL_INCLUDES_OPTION) ]
673					$(HOST_INCLUDES_SEPARATOR)
674					[ FSysIncludes $(SYSHDRS)
675						: $(HOST_SYSTEM_INCLUDES_OPTION) ] ;
676			} else {
677				local architecture = $(TARGET_PACKAGING_ARCH) ;
678				fileHeaders =
679					[ FIncludes $(localHeaders)
680						: $(TARGET_LOCAL_INCLUDES_OPTION_$(architecture)) ]
681					$(TARGET_INCLUDES_SEPARATOR_$(architecture))
682					[ FSysIncludes $(SYSHDRS)
683						: $(TARGET_SYSTEM_INCLUDES_OPTION_$(architecture)) ] ;
684			}
685
686			ASHDRS on $(file) = $(fileHeaders) ;
687			CCHDRS on $(file) = $(fileHeaders) ;
688		}
689	}
690}
691
692# Overridden to avoid calling SubDir for a directory twice (in SubInclude
693# and from the Jamfile in the directory).
694rule SubInclude
695{
696	# SubInclude TOP d1 ... ;
697	#
698	# Include a subdirectory's Jamfile.
699
700	if ! $($(<[1]))
701	{
702	    Exit SubInclude $(<[1]) without prior SubDir $(<[1]) ;
703	}
704
705	# Set up the config variables for the subdirectory.
706	local config = [ ConfigObject $(1) ] ;
707
708	__configured = ;
709	if ! [ on $(config) return $(__configured) ] {
710		# No custom configuration defined for the subdir. We use the variable
711		# values inherited by the closest ancestor.
712		config = $(HAIKU_INHERITED_SUBDIR_CONFIG) ;
713	}
714
715	# store SUBDIR_TOKENS
716	local oldSubDirTokens = $(SUBDIR_TOKENS) ;
717
718	on $(config) {
719		include [ FDirName $($(1[1])) $(1[2-) $(JAMFILE) ] ;
720	}
721
722	# restore SUBDIR_TOKENS
723	SUBDIR_TOKENS = $(oldSubDirTokens) ;
724}
725
726
727actions File
728{
729	$(CP) "$(>)" "$(<)"
730}
731