+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src
-if FTD2XXDIR
-FTD2XXINC = -I@WITH_FTD2XX@/
-else
-FTD2XXINC =
-endif
-
-INCLUDES = -I$(top_srcdir)/src/helper $(FTD2XXINC) $(all_includes)
METASOURCES = AUTO
-noinst_LIBRARIES = libjtag.a
+noinst_LTLIBRARIES = libjtag.la
-if BITBANG
-BITBANGFILES = bitbang.c
-else
-BITBANGFILES =
-endif
+SUBDIRS =
+DRIVERFILES =
+libjtag_la_LIBADD =
-if PARPORT
-PARPORTFILES = parport.c
-else
-PARPORTFILES =
-endif
+CLEANFILES =
-if FTDI2232
-FTDI2232FILES = ftdi2232.c
-else
-FTDI2232FILES =
-endif
+BUILT_SOURCES =
-if FTD2XX
-FTD2XXFILES = ftd2xx.c
-else
-FTD2XXFILES =
-endif
+BUILT_SOURCES += minidriver_imp.h
+CLEANFILES += minidriver_imp.h
-if AMTJTAGACCEL
-AMTJTAGACCELFILES = amt_jtagaccel.c
-else
-AMTJTAGACCELFILES =
+if MINIDRIVER
+
+if ZY1000
+DRIVERFILES += zy1000/zy1000.c
+JTAG_MINIDRIVER_DIR = $(srcdir)/zy1000
endif
+if MINIDRIVER_DUMMY
+DRIVERFILES += minidummy/minidummy.c commands.c
+JTAG_MINIDRIVER_DIR = $(srcdir)/minidummy
+endif
+
+MINIDRIVER_IMP_DIR = $(srcdir)/minidriver
+
+jtag_minidriver.h: $(JTAG_MINIDRIVER_DIR)/jtag_minidriver.h
+ cp $< $@
+
+BUILT_SOURCES += jtag_minidriver.h
+
+CLEANFILES += jtag_minidriver.h
-if EP93XX
-EP93XXFILES = ep93xx.c
else
-EP93XXFILES =
+
+MINIDRIVER_IMP_DIR = $(srcdir)/drivers
+DRIVERFILES += commands.c
+
+SUBDIRS += drivers
+libjtag_la_LIBADD += $(top_builddir)/src/jtag/drivers/libocdjtagdrivers.la
+
endif
-libjtag_a_SOURCES = jtag.c $(BITBANGFILES) $(PARPORTFILES) $(FTDI2232FILES) $(FTD2XXFILES) $(AMTJTAGACCELFILES) $(EP93XXFILES)
+# endif // MINIDRIVER
+
+minidriver_imp.h: $(MINIDRIVER_IMP_DIR)/minidriver_imp.h
+ cp $< $@
+
+
+libjtag_la_SOURCES = \
+ adapter.c \
+ core.c \
+ interface.c \
+ interfaces.c \
+ tcl.c \
+ transport.c \
+ $(DRIVERFILES)
+
+noinst_HEADERS = \
+ commands.h \
+ driver.h \
+ interface.h \
+ interfaces.h \
+ minidriver.h \
+ jtag.h \
+ transport.h \
+ minidriver/minidriver_imp.h \
+ minidummy/jtag_minidriver.h
+
+EXTRA_DIST = startup.tcl
-noinst_HEADERS = bitbang.h jtag.h
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in