SHELL = /bin/sh

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..

PACKAGE = @PACKAGE@
VERSION = @VERSION@
distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION)

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
locksanedir = @locksanedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
configdir = ${sysconfdir}/sane.d

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
RANLIB = @RANLIB@

CC = @CC@
INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
DEFS = @DEFS@

 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LIBTOOL = ../libtool
MCOMP	= --mode=compile
MLINK	= --mode=link

DISTCLEAN_FILES = @DISTCLEAN_FILES@

@SET_MAKE@

LIBSANEI_OBJS = sanei_ab306.o sanei_constrain_value.o sanei_init_debug.o \
	sanei_net.o sanei_wire.o sanei_codec_ascii.o sanei_codec_bin.o \
	sanei_scsi.o sanei_config.o sanei_config2.o sanei_pio.o sanei_pa4s2.o \
	sanei_auth.o sanei_usb.o sanei_thread.o sanei_pv8630.o sanei_pp.o \
	sanei_lm983x.o sanei_access.o @SANEI_JPEG@ sanei_tcp.o sanei_udp.o

LIBSANEI_LTOBJS = sanei_ab306.lo sanei_constrain_value.lo sanei_init_debug.lo \
	sanei_net.lo sanei_wire.lo sanei_codec_ascii.lo sanei_codec_bin.lo \
	sanei_scsi.lo sanei_config.lo sanei_config2.lo sanei_pio.lo \
	sanei_pa4s2.lo sanei_auth.lo sanei_usb.lo sanei_thread.lo \
	sanei_pv8630.lo sanei_lm983x.lo sanei_pp.lo sanei_access.lo @SANEI_JPEG_LO@ \
	sanei_tcp.lo sanei_udp.lo

TARGETS = libsanei.a $(LIBSANEI_LTOBJS)
TESTPROGRAMS = test_wire

DISTFILES = Makefile.in linux_sg3_err.h os2_srb.h sanei_DomainOS.c \
  sanei_DomainOS.h sanei_ab306.c sanei_auth.c sanei_codec_ascii.c \
  sanei_codec_bin.c sanei_config.c sanei_config2.c \
  sanei_constrain_value.c sanei_init_debug.c sanei_jpeg.c \
  sanei_net.c sanei_pa4s2.c sanei_pio.c sanei_pv8630.c sanei_lm983x.c \
  sanei_scsi.c sanei_thread.c sanei_usb.c sanei_pp.c \
  sanei_wire.c test_wire.c sanei_access.c sanei_tcp.c sanei_udp.c

.PHONY: all check clean depend dist distclean install uninstall

.SUFFIXES:
.SUFFIXES: .c .o .lo

.c.o:
	$(COMPILE) $<

.c.lo:
	@$(LIBTOOL) $(MCOMP) $(COMPILE) -static $<

all:	$(TARGETS)

libsanei.a: $(LIBSANEI_LTOBJS)
	@$(LIBTOOL) $(MLINK) $(CC) -static $(LIBSANEI_LTOBJS) -o $@

install:

uninstall:

check: test_wire
	./test_wire

test_wire: test_wire.o libsanei.a
	@$(LIBTOOL) $(MLINK) $(CC) -o $@ test_wire.o $(LDFLAGS) libsanei.a

test_wire.o: test_wire.c
	$(COMPILE) $<

depend:
	makedepend -I. -I../include *.c 2>/dev/null

clean:
	rm -f *.o *.lo *.a $(OBJS) $(TESTPROGRAMS)
	rm -rf .libs

distclean: clean
	rm -f $(DISTCLEAN_FILES)
	rm -f Makefile

dist: $(DISTFILES)
	for file in $(DISTFILES); do \
	  ln $$file $(distdir)/sanei 2> /dev/null \
	    || cp -p $$file $(distdir)/sanei ; \
	done

