SubDir HAIKU_TOP src tools bfs_shell ;

SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ;

# set some additional defines
{
	local defines =
		#BFS_BIG_ENDIAN_ONLY
		BFS_SHELL
		;

	if $(DEBUG) = 0 {
		# the gcc on BeOS doesn't compile BFS correctly with -O2 or more
		OPTIM = -O1 ;
	}

	defines = [ FDefines $(defines) ] ;
	SubDirCcFlags $(defines) -Wall -Wno-multichar ;
	SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ;
}

local libHaikuCompat ;
if $(HOST_PLATFORM_BEOS_COMPATIBLE) && ! $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
	libHaikuCompat = libhaikucompat_build.a ;
}

# platform specific libraries
local fsShellCommandLibs ;
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
	fsShellCommandLibs = $(HOST_NETWORK_LIBS) ;
}

UsePrivateHeaders fs_shell ;

local bfsSource =
	bfs_disk_system.cpp
	BlockAllocator.cpp
	BPlusTree.cpp
	Attribute.cpp
	Debug.cpp
	Index.cpp
	Inode.cpp
	Journal.cpp
	Query.cpp
	Utility.cpp
	Volume.cpp

	kernel_interface.cpp
;

BuildPlatformMain <build>bfs_shell
	:
	$(bfsSource)

	: <build>fs_shell.a $(libHaikuCompat) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++)
	  $(HOST_LIBROOT) $(fsShellCommandLibs)
;

BuildPlatformMain <build>bfs_fuse
	:
	$(bfsSource)

	: <build>fuse_module.a $(libHaikuCompat) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++)
	  $(HOST_STATIC_LIBROOT) $(fsShellCommandLibs) fuse
;
