SubDir HAIKU_TOP src tools bfs_shell ;

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

# prevent inclusion of HaikuBuildCompatibility.h
DEFINES += HAIKU_BUILD_COMPATIBILITY_H ;

# 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
;

BuildPlatformMergeObject <build>bfs.o : $(bfsSource) ;

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

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