SubDir HAIKU_TOP src apps devices ;

UsePrivateHeaders shared ;
UsePrivateHeaders interface ;
UsePrivateKernelHeaders ;
UsePrivateSystemHeaders ;


rule ISAPnPHeaderGen
{
	SEARCH on $(2) = $(SEARCH_SOURCE) ;
	SEARCH on $(3) = $(SEARCH_SOURCE) ;

	Depends $(1) : $(2) $(3) ;
	MakeLocateArch $(<) ;
	ISAPnPHeaderGen1 $(1) : $(2) $(3) ;
	LocalClean clean : $(<) ;
}

actions ISAPnPHeaderGen1
{
	grep '^PNP[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] '  $(2[1]) \
| gawk -f $(2[2]) > $(1) ;
}

ISAPnPHeaderGen [ FGristFiles isapnpids.h ] : isapnp_devids.txt : devlist2h.awk ;

rule USBDevsHeaderGen
{
	SEARCH on $(2) = $(SEARCH_SOURCE) ;
	SEARCH on $(3) = $(SEARCH_SOURCE) ;

	Depends $(1) : $(2) $(3) ;
	MakeLocateArch $(<) ;
	USBDevsHeaderGen1 $(1) : $(2) $(3) ;
	LocalClean clean : $(<) ;
}

actions USBDevsHeaderGen1
{
	gawk -v HEADERFILE=$(1[1]) -v DATAFILE=$(1[2]) -f $(2[2]) $(2[1])
}

USBDevsHeaderGen [ FGristFiles usbdevs.h usbdevs_data.h ] : usbdevs
	: usb_devlist2h.awk ;

rule PCIHeaderGen
{
	SEARCH on $(2) = $(SEARCH_SOURCE) ;
	SEARCH on $(3) = $(SEARCH_SOURCE) ;

	Depends $(1) : $(2) $(3) ;
	MakeLocateArch $(<) ;
	PCIHeaderGen1 $(1) : $(2) $(3) ;
	LocalClean clean : $(<) ;
}

actions PCIHeaderGen1
{
	gawk -v HEADERFILE=$(1) -f $(2[2]) $(2[1])
}

local pciidsFile = [ DownloadFile pci.ids
			: http://www.haiku-files.org/files/pci.ids ] ;

PCIHeaderGen [ FGristFiles pcihdr.h ] : $(pciidsFile) : pci-header.awk ;

rule USBHeaderGen
{
	SEARCH on $(2) = $(SEARCH_SOURCE) ;
	SEARCH on $(3) = $(SEARCH_SOURCE) ;

	Depends $(1) : $(2) $(3) ;
	MakeLocateArch $(<) ;
	USBHeaderGen1 $(1) : $(2) $(3) ;
	LocalClean clean : $(<) ;
}

actions USBHeaderGen1
{
	gawk -v HEADERFILE=$(1) -f $(2[2]) $(2[1])
}

local usbidsFile = [ DownloadFile usb.ids
			: http://www.haiku-files.org/files/usb.ids ] ;

USBHeaderGen [ FGristFiles usbhdr.h ] : $(usbidsFile) : usb-header.awk ;

Application Devices :
	DevicesApplication.cpp
	DevicesView.cpp
	dm_wrapper.c
	DevicePCI.cpp
	DeviceACPI.cpp
	DeviceSCSI.cpp
	Device.cpp
	PropertyList.cpp
	PropertyListPlain.cpp
	: be libcolumnlistview.a tracker $(TARGET_LIBSUPC++)
		$(TARGET_LIBSTDC++)	$(HAIKU_LOCALE_LIBS) 
	: Devices.rdef
;

DoCatalogs Devices :
	x-vnd.Haiku-Devices
	:
	DevicesApplication.cpp
	DevicesView.cpp
	DevicePCI.cpp
	PropertyList.cpp
	PropertyListPlain.cpp
	DeviceACPI.cpp
	DeviceSCSI.cpp
	Device.cpp
;

Includes [ FGristFiles DevicePCI.cpp ] : [ FGristFiles pcihdr.h ] ;

