SubDir OBOS_TOP src tests kernel boot loader ;

UsePrivateHeaders [ FDirName kernel ] ;
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
UsePrivateHeaders [ FDirName storage ] ;
SubDirHdrs $(OBOS_TOP) headers private kernel arch $(OBOS_ARCH) ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ;

ObjectsDefines 
	# boot loader
	main.cpp
	vfs.cpp
	partitions.cpp
	stdio.cpp
	RootFileSystem.cpp

	# partitions
	amiga_rdb.cpp
	apple.cpp
	intel.cpp
	PartitionMap.cpp

	# file systems
	bfs.cpp
	Directory.cpp
	:
	read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
	;

{
	local defines =
		_BOOT_MODE
		BOOT_SUPPORT_PARTITION_AMIGA
		BOOT_SUPPORT_PARTITION_APPLE
		BOOT_SUPPORT_PARTITION_INTEL

		BOOT_SUPPORT_FILE_SYSTEM_BFS
		;

	defines = [ FDefines $(defines) ] ;

	if $(OS) = "LINUX" {
	#	SubDirC++Flags -include /usr/include/stdio.h ;
	} else {
	#	SubDirC++Flags -include /boot/develop/headers/posix/stdio.h ;
		SubDirC++Flags $(defines) -DHAVE_READ_POS=1 -fno-builtins -fcheck-memory-usage -D_NO_INLINE_ASM ;
	}
}

SimpleTest BootLoaderTest :
	# userland bindings
	platform_start.cpp
	platform_debug.cpp
	platform_devices.cpp
	platform_heap.cpp
	Handle.cpp

	# boot loader
	main.cpp
	vfs.cpp
	partitions.cpp
	RootFileSystem.cpp

	# partitioning systems
	amiga_rdb.cpp
	apple.cpp
	intel.cpp
	PartitionMap.cpp

	# file systems
	bfs.cpp
	Directory.cpp

	list.c
	:
	: -fno-builtin
	;

# Tell Jam where to find the utility sources
SEARCH on [ FGristFiles list.c ]
    = [ FDirName $(OBOS_TOP) src kernel core util ] ;

SEARCH on [ FGristFiles 
		main.cpp vfs.cpp partitions.cpp
		heap.cpp RootFileSystem.cpp
	] = [ FDirName $(OBOS_TOP) src kernel boot loader ] ;

SEARCH on [ FGristFiles amiga_rdb.cpp ]
    = [ FDirName $(OBOS_TOP) src add-ons kernel partitioning_systems amiga ] ;

SEARCH on [ FGristFiles apple.cpp ]
    = [ FDirName $(OBOS_TOP) src add-ons kernel partitioning_systems apple ] ;

SEARCH on [ FGristFiles intel.cpp PartitionMap.cpp ]
    = [ FDirName $(OBOS_TOP) src add-ons kernel partitioning_systems intel ] ;

SEARCH on [ FGristFiles bfs.cpp Directory.cpp ]
    = [ FDirName $(OBOS_TOP) src kernel boot loader file_systems bfs ] ;
