@Makefile_conf@

AR = ar
ARFLAGS = rv

CFLAGS = $(CDEBUG) -I. -I../../include 
SHARED_CFLAGS = $(CFLAGS) -fPIC

INSTALL = install -c
INSTALLDATA = install -c -m 644

trgdir = ..

if BITS
trgs_static = $(trgdir)/libpci_64.a
trgs_shared = $(trgdir)/libpci_64.so
#trgs2 = $(trgdir)/libpcidaq_64.a
else
trgs_static = $(trgdir)/libpci.a
trgs_shared = $(trgdir)/libpci.so
#trgs2 = $(trgdir)/libpcidaq.a
endif

all:$(trgs_static) $(trgs_shared)

$(trgs1): pcidio.c pci180x.c pcilanner.c pci1002.c pcifc16.c
	$(CC) -c $(CFLAGS) -Dtarget_$(patsubst %.a,%,$(subst $(trgdir)/lib,,$@)) $^
	$(AR) $(ARFLAGS) $@ $(patsubst %.c,%.o,$^)
	$(RM) *.o

$(trgs_shared): pcidio.c pci180x.c pcilanner.c pci1002.c pcifc16.c
	$(CC) -c $(SHARED_CFLAGS) -Dtarget_$(patsubst %.so,%,$(subst $(trgdir)/lib,,$@)) $^
	$(CC) -shared -o $@ $(patsubst %.c,%.o,$^) -lm -lpthread
	$(RM) *.o

#$(trgs2): pcidaq.c 
#	$(CC) -c $(CFLAGS) -Dtarget_$(patsubst %.a,%,$(subst $(trgdir)/lib,,$@)) $^
#	$(AR) $(ARFLAGS) $@ $(patsubst %.c,%.o,$^)
#	$(RM) *.o

clean:
	rm -f *.o *~ *.tmp *.bak \#* .\#* $(trgs)

