SubDir OBOS_TOP src kits ;

# If defined allows to run applications without the registrar
# -- for development only, of course.
if $(RUN_WITHOUT_REGISTRAR) {
	local defines = [ FDefines RUN_WITHOUT_REGISTRAR ] ;
	SubDirCcFlags $(defines) ;
	SubDirC++Flags $(defines) ;
}

# If defined allows to run applications without the app server
# -- needed until the app server runs on our kernel.
if $(RUN_WITHOUT_APP_SERVER) {
	local defines = [ FDefines RUN_WITHOUT_APP_SERVER ] ;
	SubDirCcFlags $(defines) ;
	SubDirC++Flags $(defines) ;
}

# Collect libopenbeos.so sources.
subdirs = app interface support storage ;
for subdir in $(subdirs) {
	local dir = [ FDirName $(SUBDIR) $(subdir) ] ;
	local file = $(subdir:S=.src) ;
	include $(file:D=$(dir)) ;
	UsePrivateHeaders $(subdir) ;
	SEARCH_SOURCE += $(dir) ;
}

UsePrivateHeaders shared app [ FDirName servers app ] ;
UsePrivateHeaders kernel ;	# for syscalls.h
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
UsePrivateHeaders input ;

# Add subsubdirs to the SEARCH_SOURCE.
SEARCH_SOURCE += [ FDirName $(SUBDIR) interface BTextView ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) storage mime ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) storage sniffer ] ;

LIBBE_SOURCE = 
	$(APP_KIT_SOURCE)
	$(INTERFACE_KIT_SOURCE)
	$(SUPPORT_KIT_SOURCE)
	$(STORAGE_KIT_SOURCE)
;

LIBBE_SOURCE_HAIKU_ONLY =
	$(STORAGE_KIT_SOURCE_HAIKU_ONLY)
;

SharedLibrary be :
	$(LIBBE_SOURCE) $(LIBBE_SOURCE_HAIKU_ONLY)
;

SharedLibraryFromObjects openbeos :
	$(LIBBE_SOURCE:S=.o)
;

LinkSharedOSLibs libbe.so :
	libroot.so	# make sure it links against our libroot.so
	stdc++.r4
;

LinkSharedOSLibs libopenbeos.so :
	libbeadapter.so
	be
	stdc++.r4
;

# The adapter library we need (Storage Kit).
#
SharedLibrary beadapter :
	LibBeAdapter.cpp
	strlcat.c
	strlcpy.c
;
LinkSharedOSLibs libbeadapter.so :
	be
;

# Note: If you want to use /boot/home/config/lib/libopenbeos.so in another
# rule, use the identifier <boot!home!config!lib>libopenbeos.so, otherwise
# libopenbeos.so.
LOCATE on <boot!home!config!lib>libopenbeos.so
		  <boot!home!config!lib>libbeadapter.so = /boot/home/config/lib ;
File <boot!home!config!lib>libopenbeos.so : libopenbeos.so ;
File <boot!home!config!lib>libbeadapter.so : libbeadapter.so ;
Includes <boot!home!config!lib>libopenbeos.so
	: <boot!home!config!lib>libbeadapter.so ;

SEARCH on [ FGristFiles
		strlcat.c strlcpy.c
	] = [ FDirName $(OBOS_TOP) src kernel libroot posix string ] ;

SubInclude OBOS_TOP src kits app ;
SubInclude OBOS_TOP src kits interface ;
SubInclude OBOS_TOP src kits mail ;
SubInclude OBOS_TOP src kits media ;
SubInclude OBOS_TOP src kits midi ;
SubInclude OBOS_TOP src kits midi2 ;
SubInclude OBOS_TOP src kits screensaver ;
SubInclude OBOS_TOP src kits storage ;
SubInclude OBOS_TOP src kits support ;
SubInclude OBOS_TOP src kits textencoding ;
SubInclude OBOS_TOP src kits translation ;
SubInclude OBOS_TOP src kits device ;
SubInclude OBOS_TOP src kits game ;
SubInclude OBOS_TOP src kits network ;
