SubDir OBOS_TOP src tests add-ons kernel file_systems bfs bfs_shell ;

SubDirHdrs $(OBOS_TOP) src tests add-ons kernel file_systems fs_shell ;
SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ;

UsePrivateHeaders [ FDirName kernel ] ;			# For kernel_cpp.cpp

{
	# set CHECK_MALLOC to something when doing tests against memory corruption
	local malloc_debug_defines ;
	local malloc_debug_flags ;
	if $(CHECK_MALLOC) {
		malloc_debug_defines = _NO_INLINE_ASM ;
		malloc_debug_flags = -fcheck-memory-usage ;
	}

	local defines = [ FDefines USER
		#DEBUG
		USED_IN_FS_SHELL NO_FILE_UNCACHED_IO
		UNSAFE_GET_VNODE
		#BFS_BIG_ENDIAN_ONLY
		$(malloc_debug_defines) ] ;
	SubDirCcFlags $(defines) -fno-exceptions -fno-rtti $(malloc_debug_flags) ;
	SubDirC++Flags $(defines) -fno-exceptions -fno-rtti $(malloc_debug_flags) -include [ FDirName $(SUBDIR) Debug.h ] ;
}

SimpleTest bfs_shell :
	fsh.c rootfs.c initfs.c kernel.c cache.c sl.c stub.c tracker.cpp
	sysdep.c hexdump.c argv.c

	Volume.cpp BPlusTree.cpp Inode.cpp Index.cpp Query.cpp Journal.cpp
	BlockAllocator.cpp kernel_interface_r5.cpp Utility.cpp BufferPool.cpp
	Debug.cpp kernel_cpp.cpp
	:
	;

# Tell Jam where to find these sources
SEARCH on [ FGristFiles
		Volume.cpp BPlusTree.cpp Inode.cpp Index.cpp Query.cpp Journal.cpp
		BlockAllocator.cpp kernel_interface_r5.cpp Utility.cpp BufferPool.cpp
		Debug.cpp cpp.cpp
	] = [ FDirName $(OBOS_TOP) src add-ons kernel file_systems bfs ] ;

SEARCH on [ FGristFiles
		kernel_cpp.cpp
	] = [ FDirName $(OBOS_TOP) src kernel core util ] ;

SEARCH on [ FGristFiles
		fsh.c rootfs.c initfs.c kernel.c cache.c sl.c stub.c tracker.cpp
		sysdep.c hexdump.c argv.c
	] = [ FDirName $(OBOS_TOP) src tests add-ons kernel file_systems fs_shell ] ;
