SubDir HAIKU_TOP src bin gdb opcodes ;

SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) include ] ;
SubDirHdrs [ FDirName $(TARGET_COMMON_DEBUG_LOCATE_TARGET:D) bfd ] ;
	# generated bfd headers

SubDirSysHdrs [ FDirName $(HAIKU_TOP) src bin gawk intl ] ;
	# Use gawk's libintl for the time being.
	# TODO: Put a current version of intl ot src/libs and build a static lib
	# all interested apps can link against.

SubDirCcFlags -DHAVE_CONFIG_H -D_GNU_SOURCE ;

# architecture specific sources
local opcodesArchSources ;
if $(TARGET_ARCH) = x86 {
	opcodesArchSources = i386-dis.c ;
} else if $(TARGET_ARCH) = ppc {
	opcodesArchSources = ppc-dis.c ;
		# TODO: Check, if this is correct (probably is).
} # else: architecture not supported by Haiku

local opcodesAllSources = 
	dis-buf.c
	disassemble.c
	dis-init.c
	$(opcodesArchSources)
;

StaticLibrary <gdb>libopcodes.a :
	$(opcodesAllSources)
;

# Make all objects depend on the generated bfd headers (otherwise they will
# not be generated in the first place).
Depends [ FGristFiles $(opcodesAllSources:S=$(SUFOBJ)) ]
	 : gdb-bfd-generated-headers ;
