⛏️ index : haiku.git

SubDir HAIKU_TOP src tools makebootable platform bios_ia32 ;

SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems bfs ;

UsePrivateHeaders storage shared ;
UsePrivateSystemHeaders ;

SEARCH_SOURCE
	+= [ FDirName $(HAIKU_TOP) src bin makebootable platform bios_ia32 ] ;

USES_BE_API on <build>makebootable = true ;

local hostPlatformSources ;
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd ||
   $(HOST_PLATFORM) = netbsd || $(HOST_PLATFORM) = darwin {
	UsePrivateHeaders interface ;

	hostPlatformSources = PartitionMap.cpp PartitionMapParser.cpp
		PartitionMapWriter.cpp crc32.cpp Header.cpp utility.cpp ;

	SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel
		partitioning_systems intel ] ;
	SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel
		partitioning_systems gpt ] ;

	DEFINES += _USER_MODE ;
}

# Write the stage 1 boot loader into the makebootable resources. On Darwin
# resources don't seem to work; there we use an attribute instead.
if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != mingw {
	AddFileDataResource <build>makebootable : RAWT:666:BootCode : stage1.bin ;
}

BuildPlatformMain <build>makebootable :
	makebootable.cpp
	$(hostPlatformSources)
	: $(HOST_LIBBE) $(HOST_LIBSTDC++) $(HOST_LIBSUPC++)
;

# on Darwin write the boot loader code into an attribute
if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = mingw {
	AddFileDataAttribute <build>makebootable : BootCode : raw : stage1.bin ;
}