3 # Usage SetupBoot <sources_or_objects> : <extra_cc_flags> : <include_private_headers> ;
5 # <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
6 # set for the sources and the sources some header
7 # dependencies might be missing.
9 local sources = [ FGristFiles $(1) ] ;
10 local objects = $(sources:S=$(SUFOBJ)) ;
12 # add private kernel headers
14 SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
17 if $(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_PACKAGING_ARCH)) {
18 SourceSysHdrs $(sources) :
19 $(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_PACKAGING_ARCH)) ;
23 for object in $(objects) {
24 # add boot flags for the object
25 ObjectCcFlags $(object) : $(TARGET_BOOT_CCFLAGS) $(2) ;
26 ObjectC++Flags $(object) : $(TARGET_BOOT_C++FLAGS) $(2) ;
27 ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
28 ASFLAGS on $(object) = $(TARGET_BOOT_CCFLAGS) ;
30 # override warning flags
31 TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
32 = $(TARGET_KERNEL_WARNING_CCFLAGS) ;
33 TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
34 = $(TARGET_KERNEL_WARNING_C++FLAGS) ;
40 SetupBoot $(1) : $(2) ;
46 # BootLd <name> : <objs> : <linkerscript> : <args> ;
48 LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ;
50 LINKFLAGS on $(1) = $(TARGET_BOOT_LINKFLAGS) $(4) ;
51 if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
53 # Remove any preset LINKLIBS, but link against libgcc.a. Linking against
54 # libsupc++ is opt-out.
56 if ! [ on $(1) return $(HAIKU_NO_LIBSUPC++) ] {
57 libs += [ TargetBootLibsupc++ true ] ;
58 Depends $(1) : [ TargetBootLibsupc++ ] ;
60 LINKLIBS on $(1) = $(libs) [ TargetBootLibgcc true ] ;
61 Depends $(1) : [ TargetBootLibgcc ] ;
63 # TODO: Do we really want to invoke SetupBoot here? The objects should
64 # have been compiled with BootObjects anyway, so we're doing that twice.
67 # Show that we depend on the libraries we need
68 LocalClean clean : $(1) ;
69 LocalDepends all : $(1) ;
72 MakeLocateDebug $(1) ;
74 on $(1) XRes $(1) : $(RESFILES) ;
75 if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
82 actions BootLd bind VERSION_SCRIPT
84 $(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) \
85 --version-script=$(VERSION_SCRIPT)
90 # BootMergeObject <name> : <sources> : <extra CFLAGS> : <other objects> ;
91 # Compiles source files and merges the object files to an object file.
92 # <name>: Name of the object file to create. No grist will be added.
93 # <sources>: Sources to be compiled. Grist will be added.
94 # <extra CFLAGS>: Additional flags for compilation.
95 # <other objects>: Object files or static libraries to be merged. No grist
99 SetupBoot $(2) : $(3) ;
101 MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
102 LINKFLAGS on $(1) += $(TARGET_BOOT_LINKFLAGS) ;
105 rule BootStaticLibrary
107 # Usage BootStaticLibrary <name> : <sources> : <extra cc flags> ;
108 # This is designed to take a set of sources and libraries and create
109 # a file called lib<name>.a
111 SetupBoot $(2) : $(3) : false ;
112 Library $(1) : $(2) ;
115 rule BootStaticLibraryObjects
117 # Usage BootStaticLibrary <name> : <sources> ;
118 # This is designed to take a set of sources and libraries and create
119 # a file called <name>
121 # Show that we depend on the libraries we need
123 LocalClean clean : $(1) ;
124 LocalDepends all : $(1) ;
125 Depends $(1) : $(2) ;
127 MakeLocateDebug $(1) ;
130 actions BootStaticLibraryObjects
132 # Force recreation of the archive to avoid build errors caused by
133 # stale dependencies after renaming or deleting object files.
135 $(HAIKU_AR_$(TARGET_PACKAGING_ARCH)) -r "$(1)" "$(2)" ;
138 rule BuildMBR binary : source
140 SEARCH on $(source) = $(SUBDIR) ;
141 MakeLocateDebug $(binary) ;
142 Depends $(binary) : $(source) ;
148 $(HAIKU_CC_$(HAIKU_PACKAGING_ARCH)) $(2) -o $(1) $(MBRFLAGS) -nostdlib -Xlinker --oformat=binary -Xlinker -S -Xlinker -N -Xlinker --entry=start -Xlinker -Ttext=0x600