## Process this file with automake to produce Makefile.in

# require automake 1.4
# gnu strictness chokes on README being autogenerated
AUTOMAKE_OPTIONS = 1.4 foreign

SUBDIRS = . tests doc

AM_CFLAGS = -Werror

configincludedir = $(pkglibdir)/include

bin_SCRIPTS = libusb-config

libusb-config: libusb-config.in

EXTRA_DIST = LICENSE libusb.spec.in libusb.spec libusb-config.in README.in README \
             INSTALL.libusb.in INSTALL.libusb Doxyfile apidocs/header.html \
             apidocs/footer.html apidocs/doxygen.css apidocs/doxygen.png libusb.pc.in
EXTRA_libusb_la_SOURCE = linux.c linux.h bsd.c darwin.c

lib_LTLIBRARIES = libusb.la libusbpp.la

pkgconfig_DATA = libusb.pc

if LINUX_API
OS_SUPPORT = linux.c linux.h
else
if BSD_API
OS_SUPPORT = bsd.c
else
if DARWIN_API
OS_SUPPORT = darwin.c
AM_CFLAGS_EXT = -no-cpp-precomp
LDADDS = -Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind -no-undefined
PREBIND_FLAGS=-Wl,-seg1addr,0x01666000
PREBIND_FLAGSPP=-Wl,-seg1addr,0x01676000
else
OS_SUPPORT = 
endif
endif
endif

AM_CFLAGS += $(AM_CFLAGS_EXT)

AM_CPPFLAGS = -I.
AM_CXXFLAGS = 

libusb_la_SOURCES = usb.c usbi.h error.c error.h descriptors.c $(OS_SUPPORT)
libusbpp_la_SOURCES = usbpp.cpp usbpp.h

libusbpp_la_DEPENDENCIES = libusb.la

# Do not add usb.h to *_SOURCES, regardless of dependencies.
# It would be added to the dist tarball, which it shouldn't be.
nodist_include_HEADERS = usb.h
include_HEADERS = usbpp.h

libusb_la_LDFLAGS = \
	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
	-release $(LT_RELEASE) \
	-export-dynamic \
	$(LDADDS) $(PREBIND_FLAGS)

libusbpp_la_LDFLAGS = \
	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
	-release $(LT_RELEASE) \
	-export-dynamic \
	$(LDADDS) -lusb $(PREBIND_FLAGSPP)

.PHONY: files release snapshot

files:
	@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
	  echo $$p; \
	done

release:
	$(MAKE) distcheck

snapshot:
	$(MAKE) dist distdir=$(PACKAGE)-`date +"%Y%m%d"`

## generate API documentation with doxygen
apidox:
	$(MAKE) apidox-am-@LIBUSB_HAS_DOXYGEN@

apidox-am-no:
apidox-am-yes:
	@echo "*** Creating API documentation main page"; \
	doxygen Doxyfile

.PHONY: apidox-am-yes apidox-am-no apidox

