
# This is a pretty dumb link between the Jamfile based build, and the
# configure & make used by the distribution libusb. 
# If you modify any sources in libusb, then jam won't rebuild them,
# you have to run "make"

PREF_CCFLAGS 	+= $(CCOPTFLAG) ;		# Turn optimisation on
#PREF_CCFLAGS	+= $(CCDEBUGFLAG) ;		# Debugging flags
PREF_LINKFLAGS	+= $(LINKDEBUGFLAG) ;

if $(OS) = MACOSX {
	OSFILE = darwin ;
} else {
	# Should detect BSD here!
	OSFILE = linux ;
}

# Run configure if it hasn't been run before

NDepends usb.h : configure ;
GenFileNND usb.h : "(cd $(SUBDIR); chmod +x configure ; ./configure ; rm -f libusb.a )" ;

HDR = . ;

# USB library
# We could run make, but it's long winded, and the resulting static
# lib is a bit screwed up, so build it the simple Jam way:
Library libusb.lib : usb.c error.c descriptors.c $(OSFILE).c ;

# USB test program 
Main testlibusb : tests/testlibusb.c : : : . : : libusb.lib ;
