libusb: idProduct of USB device may be zero
[openocd.git] / src / Makefile.am
blobc78e81c801fb48324a30578460b0e21104b1ab3a
1 include $(top_srcdir)/common.mk
3 SUBDIRS = \
4         jtag \
5         helper \
6         target \
7         transport \
8         flash \
9         svf \
10         xsvf \
11         pld \
12         server \
13         rtos
15 lib_LTLIBRARIES = libopenocd.la
16 bin_PROGRAMS = openocd
18 MAINFILE = main.c
20 openocd_SOURCES = $(MAINFILE)
21 openocd_LDADD = libopenocd.la
23 if INTERNAL_JIMTCL
24 openocd_LDADD += $(top_builddir)/jimtcl/libjim.a
25 else
26 openocd_LDADD += -ljim
27 endif
29 if ULINK
30 openocd_LDADD += -lm
31 endif
33 libopenocd_la_SOURCES = \
34         hello.c \
35         openocd.c \
36         startup_tcl.c
38 noinst_HEADERS = \
39         hello.h \
40         openocd.h
42 libopenocd_la_CPPFLAGS = -DPKGBLDDATE=\"`date +%F-%R`\"
44 # banner output includes RELSTR appended to $VERSION from the configure script
45 # guess-rev.sh returns either a repository version ID or "-snapshot"
46 if RELEASE
47 libopenocd_la_CPPFLAGS += -DRELSTR=\"\"
48 libopenocd_la_CPPFLAGS += -DGITVERSION=\"\"
49 else
50 libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
51 libopenocd_la_CPPFLAGS += -DGITVERSION=\"`cd $(top_srcdir) && git describe`\"
52 endif
54 # add default CPPFLAGS
55 libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
57 # the library search path.
58 libopenocd_la_LDFLAGS = $(all_libraries)
60 if IS_MINGW
61 MINGWLDADD = -lws2_32
62 else
63 MINGWLDADD =
64 endif
66 if FT2232_LIBFTDI
67 FTDI2232LIB = -lftdi -lusb
68 else
69 if USB_BLASTER_LIBFTDI
70 FTDI2232LIB = -lftdi -lusb
71 else
72 if PRESTO_LIBFTDI
73 FTDI2232LIB = -lftdi -lusb
74 else
75 FTDI2232LIB =
76 endif
77 endif
78 endif
80 LIBUSB =
81 if USE_LIBUSB1
82 LIBUSB += -lusb-1.0
83 endif
85 if USE_LIBUSB0
86 LIBUSB += -lusb
87 endif
89 libopenocd_la_LIBADD = \
90         $(top_builddir)/src/xsvf/libxsvf.la \
91         $(top_builddir)/src/svf/libsvf.la \
92         $(top_builddir)/src/pld/libpld.la \
93         $(top_builddir)/src/jtag/libjtag.la \
94         $(top_builddir)/src/transport/libtransport.la \
95         $(top_builddir)/src/flash/libflash.la \
96         $(top_builddir)/src/target/libtarget.la \
97         $(top_builddir)/src/server/libserver.la \
98         $(top_builddir)/src/rtos/librtos.la \
99         $(top_builddir)/src/helper/libhelper.la \
100         $(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
102 STARTUP_TCL_SRCS = \
103         $(srcdir)/helper/startup.tcl \
104         $(srcdir)/jtag/startup.tcl \
105         $(srcdir)/target/startup.tcl \
106         $(srcdir)/flash/startup.tcl \
107         $(srcdir)/server/startup.tcl
109 EXTRA_DIST = $(STARTUP_TCL_SRCS)
111 BUILT_SOURCES = startup.tcl
113 startup.tcl: $(STARTUP_TCL_SRCS)
114         cat $^ > $@
116 BIN2C = $(top_builddir)/src/helper/bin2char$(EXEEXT_FOR_BUILD)
118 # Convert .tcl to cfile
119 startup_tcl.c: startup.tcl $(BIN2C)
120         $(BIN2C) openocd_startup_tcl < $< > $@ || rm -f $@
122 # add startup_tcl.c to make clean list
123 CLEANFILES = startup.tcl startup_tcl.c
125 # we do not want generated file in the dist
126 dist-hook:
127         rm -f $(distdir)/startup_tcl.c
128         
129 MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
131 # The "quick" target builds executables & reinstalls the executables
132 # Primary use: developer types to quicken the edit/compile/debug
133 # cycle.  by not requiring a "full build and full install". Note the
134 # assumption is: You are only rebuilding the EXE.... and everything
135 # else is/was previously installed.
137 # use at your own risk
138 quick: all install-binPROGRAMS