3 # Overridden to support a second argument, the option to be used.
7 return $(2:E="--bad-include-option ")$(1) ;
11 # FSysIncludes <dirs> ;
13 # Counterpart of FIncludes for system include search paths.
17 return $(2:E="--bad-include-option ")$(1) ;
23 # SubDirSysHdrs <dirs> ;
25 # Adds directories to the system include search paths for the current
26 # subdirectory. Counterpart of SubDirHdrs which adds non-system include
29 # <dirs>: The directories to be added to the current subdir's system
30 # include search paths.
32 SUBDIRSYSHDRS += [ FDirName $(1) ] ;
38 # ObjectSysHdrs <sources or objects> : <headers> : <gristed objects>
40 # Adds directories to the system include search paths for the given
41 # sources or objects. Counterpart of ObjectHdrs which adds non-system
42 # include search paths.
44 # NOTE: With this incarnation of the Haiku build system this rule doesn't
45 # need to be invoked *after* the rule that generates the objects anymore.
46 # Actually it is even encouraged to do that *before*. Same for ObjectHdrs.
48 # <sources or objects>: The targets for which to add system include
50 # <dirs>: The directories to be added to the given objects' system
51 # include search paths.
54 local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] $(3) ;
55 local headers = $(2) ;
58 for file in $(objects) {
60 local sysHeaders = $(SYSHDRS) $(headers) ;
61 SYSHDRS on $(file) = $(sysHeaders) ;
63 # reformat ASHDRS and CCHDRS
66 if $(PLATFORM) = host {
68 [ FIncludes $(HDRS) : $(HOST_LOCAL_INCLUDES_OPTION) ]
69 $(HOST_INCLUDES_SEPARATOR)
70 [ FSysIncludes $(sysHeaders)
71 : $(HOST_SYSTEM_INCLUDES_OPTION) ] ;
73 local architecture = $(TARGET_PACKAGING_ARCH) ;
76 : $(TARGET_LOCAL_INCLUDES_OPTION_$(architecture)) ]
77 $(TARGET_INCLUDES_SEPARATOR_$(architecture))
78 [ FSysIncludes $(sysHeaders)
79 : $(TARGET_SYSTEM_INCLUDES_OPTION_$(architecture)) ] ;
82 ASHDRS on $(file) = $(fileHeaders) ;
83 CCHDRS on $(file) = $(fileHeaders) ;
91 # SourceHdrs <sources> : <headers> [ : <gristed objects> ] ;
93 # Is a wrapper for ObjectHdrs, that passes <sources> and <headers> or,
94 # if supplied <objects> and <headers>, and also adjusts HDRSEARCH (not
95 # done by ObjectHdrs).
97 local sources = [ FGristFiles $(1) ] ;
98 local headers = $(2) ;
99 local objects = $(3) ;
101 ObjectHdrs $(sources) : $(headers) : $(objects) ;
103 # Also add the header search dirs to HDRSEARCH. Note, that these dirs
104 # will be listed after the STDHDRS (if any), but that's better than not
105 # being listed at all.
106 HDRSEARCH on $(sources) += $(headers) ;
112 # SourceSysHdrs <sources> : <headers> [ : <gristed objects> ] ;
114 # Is a wrapper for ObjectSysHdrs, that passes <sources> and <headers> or,
115 # if supplied <objects> and <headers>, and also adjusts HDRSEARCH (not
116 # done by ObjectSysHdrs).
118 local sources = [ FGristFiles $(1) ] ;
119 local headers = $(2) ;
120 local objects = $(3) ;
122 ObjectSysHdrs $(sources) : $(headers) : $(objects) ;
124 # Also add the header search dirs to HDRSEARCH. Note, that these dirs
125 # will be listed after the STDHDRS (if any), but that's better than not
126 # being listed at all.
127 HDRSEARCH on $(sources) += $(headers) ;
133 # PublicHeaders <group list>
135 # Returns the directory names for the public header dirs identified by
142 dirs += [ FDirName $(HAIKU_TOP) headers os $(i) ] ;
150 # PrivateHeaders <group list>
152 # Returns the directory names for the private header dirs identified by
159 dirs += [ FDirName $(HAIKU_TOP) headers private $(i) ] ;
165 rule PrivateBuildHeaders
167 # PrivateBuildHeaders <group list>
169 # Returns the directory names for the private build header dirs identified
176 dirs += [ FDirName $(HAIKU_TOP) headers build private $(i) ] ;
184 # LibraryHeaders <group list>
186 # Returns the directory names for the library header dirs identified by
193 dirs += [ FDirName $(HAIKU_TOP) headers libs $(i) ] ;
201 # usage: ArchHeaders <arch> ;
203 # <arch> specifies the architecture (e.g. x86).
205 return [ FDirName $(HAIKU_TOP) headers private kernel arch $(1) ] ;
211 # UseHeaders <headers> [ : <system> ] ;
213 # Adds the C header dirs <headers> to the header search
214 # dirs of the subdirectory.
215 # If <system> is "true", the dirs are added as system otherwise local
217 # NOTE: This rule must be invoked *before* the rule that builds the objects.
222 SubDirSysHdrs $(header) ;
226 SubDirHdrs $(header) ;
232 rule UsePublicHeaders
234 # UsePublicHeaders <group list> ;
236 # Adds the public C header dirs given by <group list> to the header search
237 # dirs of the subdirectory.
238 # NOTE: This rule must be invoked *before* the rule that builds the
241 UseHeaders [ PublicHeaders $(1) ] : true ;
245 rule UsePublicObjectHeaders
247 # UsePublicObjectHeaders <sources> : <group list> [ : <objects> ] ;
249 # Adds the public C header dirs given by <group list> to the header search
250 # dirs of either the object targets of <sources> or if supplied to
251 # <objects>. Also adjusts HDRSEARCH of <sources>.
253 SourceSysHdrs $(1) : [ PublicHeaders $(2) ] : $(3) ;
257 rule UsePrivateHeaders
259 # UsePrivateHeaders <group list> [ : <system> ] ;
261 # Adds the private C header dirs given by <group list> to the header search
262 # dirs of the subdirectory.
263 # <system> specifies whether to add the dirs as system or local header
264 # search dirs. Defaults to "true".
265 # NOTE: This rule must be invoked *before* the rule that builds the objects.
267 local system = $(2) ;
270 UseHeaders [ PrivateHeaders $(1) ] : $(system) ;
274 rule UsePrivateObjectHeaders
276 # UsePrivateObjectHeaders <sources> : <group list> [ : <objects>
279 # Adds the private C header dirs given by <group list> to the header search
280 # dirs of either the object targets of <sources> or if supplied to
281 # <objects>. Also adjusts HDRSEARCH of <sources>.
282 # <system> specifies whether to add the dirs as system or local header
283 # search dirs. Defaults to "true".
285 local system = $(4) ;
288 if $(system) = true {
289 SourceSysHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
291 SourceHdrs $(1) : [ PrivateHeaders $(2) ] : $(3) ;
296 rule UsePrivateBuildHeaders
298 # UsePrivateBuildHeaders <group list> [ : <system> ] ;
300 # Adds the private build C header dirs given by <group list> to the header
301 # search dirs of the subdirectory.
302 # <system> specifies whether to add the dirs as system or local header
303 # search dirs. Defaults to "true".
304 # NOTE: This rule must be invoked *before* the rule that builds the objects.
306 local system = $(2) ;
309 UseHeaders [ PrivateBuildHeaders $(1) ] : $(system) ;
313 rule UseCppUnitHeaders
315 SubDirSysHdrs [ FDirName $(HAIKU_TOP) headers tools cppunit ] ;
319 rule UseCppUnitObjectHeaders
321 # UseCppUnitObjectHeaders <sources> [ : <objects> ] ;
322 SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers tools cppunit ]
329 # usage: UseArchHeaders <arch> ;
331 # <arch> specifies the architecture (e.g. x86).
332 # NOTE: This rule must be invoked *before* the rule that builds the objects.
334 local headers = [ ArchHeaders $(1) ] ;
336 UseHeaders $(headers) : true ;
340 rule UseArchObjectHeaders
342 # usage: UseArchObjectHeaders <sources> : <arch> : [ <objects> ] ;
344 # <arch> specifies the architecture (e.g. x86).
345 # <sources_or_objects> Source or object files.
347 local sources = $(1) ;
348 local headers = [ ArchHeaders $(2) ] ;
349 local objects = $(3) ;
352 targets = $(objects) ;
354 targets = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
357 SourceSysHdrs $(sources) : $(headers) : $(objects) ;
361 rule UsePosixObjectHeaders
363 # UsePosixObjectHeaders <sources> [ : <objects> ] ;
365 # Adds the POSIX header dir to the header search
366 # dirs of either the object targets of <sources> or if supplied to
367 # <objects>. Also adjusts HDRSEARCH of <sources>.
369 SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers posix ] : $(2) ;
373 rule UseLibraryHeaders
375 # UseLibraryHeaders <group list> ;
377 # Adds the library header dirs given by <group list> to the header search
378 # dirs of the subdirectory.
379 # NOTE: This rule must be invoked *before* the rule that builds the objects.
381 UseHeaders [ LibraryHeaders $(1) ] : true ;
385 rule UseLegacyHeaders
387 # usage: UseLegacyHeaders <group list> ;
389 # NOTE: This rule must be invoked *before* the rule that builds the objects.
391 UseHeaders [ FDirName $(HAIKU_TOP) headers legacy $(1) ] : true ;
395 rule UseLegacyObjectHeaders
397 # UseLegacyObjectHeaders <sources> [ : <objects> ] ;
399 # Adds the legacy header dir to the header search
400 # dirs of either the object targets of <sources> or if supplied to
401 # <objects>. Also adjusts HDRSEARCH of <sources>.
403 SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers legacy ] : $(2) ;
407 rule UsePrivateKernelHeaders
409 UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ;
413 rule UsePrivateSystemHeaders
415 UseHeaders $(TARGET_PRIVATE_SYSTEM_HEADERS_$(TARGET_PACKAGING_ARCH))
420 rule UseBuildFeatureHeaders feature : attribute
422 # UseBuildFeatureHeaders <feature> : [ <attribute> ] ;
424 # UseHeaders [ BuildFeatureAttribute <feature> : <attribute> ] : true ;
425 # Moreover the default value for <attribute> is "headers", which usually
426 # allows the rule to be called with the feature name as the only parameter.
428 local headers = [ BuildFeatureAttribute $(feature) : $(attribute:E=headers)
430 UseHeaders $(headers) : true ;
434 rule FStandardOSHeaders
436 local osIncludes = add-ons add-ons/file_system add-ons/graphics
437 add-ons/input_server add-ons/registrar
439 add-ons/tracker app device drivers game interface
440 kernel locale media mail midi midi2 net storage
441 support translation ;
443 return [ FDirName $(HAIKU_TOP) headers os ]
444 [ PublicHeaders $(osIncludes) ] ;
448 rule FStandardHeaders architecture
450 local osIncludes = add-ons add-ons/file_system add-ons/graphics
451 add-ons/input_server add-ons/registrar
453 add-ons/tracker app device drivers game interface
454 kernel locale media mail midi midi2 net storage
455 support translation ;
459 if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
460 headers += [ FDirName $(HAIKU_OUTPUT_DIR) clang_headers ] ;
464 headers += [ C++HeaderDirectories $(architecture) ] ;
467 headers += [ GccHeaderDirectories $(architecture) ] ;
469 # Use headers directory, to allow to do things like include <posix/string.h>
470 headers += [ FDirName $(HAIKU_TOP) headers ] ;
472 # Use posix headers directory
473 headers += [ FDirName $(HAIKU_TOP) headers posix ] ;
476 headers += [ FDirName $(HAIKU_TOP) headers glibc ] ;
478 # Use public OS header directories
479 headers += [ FDirName $(HAIKU_TOP) headers os ] ;
480 headers += [ PublicHeaders $(osIncludes) ] ;
482 # Use the root of the private headers -- not so nice, but simplifies things.
483 headers += [ PrivateHeaders $(DOT) ] ;
489 # SUBDIRSYSHDRS shall be reset automatically for each subdir
490 SUBDIRRESET += SYSHDRS ;