Driver for USB-JTAG, Altera USB-Blaster and compatibles
[openocd.git] / src / Makefile.am
1 SUBDIRS = \
2         helper \
3         jtag \
4         target \
5         flash \
6         svf \
7         xsvf \
8         pld \
9         server
10
11 lib_LTLIBRARIES = libopenocd.la
12 bin_PROGRAMS = openocd
13
14 if ECOSBOARD
15 MAINFILE = ecosboard.c
16 else
17 MAINFILE = main.c
18 endif
19
20 openocd_SOURCES = $(MAINFILE)
21 openocd_LDADD = libopenocd.la
22
23 libopenocd_la_SOURCES = \
24         hello.c \
25         openocd.c \
26         startup_tcl.c
27
28 noinst_HEADERS = \
29         hello.h \
30         openocd.h
31
32
33 # set the include path found by configure
34 AM_CPPFLAGS = \
35         -I$(top_srcdir)/src \
36         -I$(top_builddir)/src
37
38 libopenocd_la_CPPFLAGS = -DPKGBLDDATE=\"`date +%F-%R`\"
39
40 # banner output includes RELSTR appended to $VERSION from the configure script
41 # guess-rev.sh returns either a repository version ID or "-snapshot"
42 if RELEASE
43 libopenocd_la_CPPFLAGS += -DRELSTR=\"\"
44 else
45 libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
46 endif
47
48 # add default CPPFLAGS
49 libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
50
51 # the library search path.
52 libopenocd_la_LDFLAGS = $(all_libraries)
53
54 if IS_MINGW
55 MINGWLDADD = -lws2_32
56 else
57 MINGWLDADD =
58 endif
59
60 if FT2232_LIBFTDI
61 FTDI2232LIB = -lftdi -lusb
62 else
63 if USB_BLASTER_LIBFTDI
64 FTDI2232LIB = -lftdi -lusb
65 else
66 if PRESTO_LIBFTDI
67 FTDI2232LIB = -lftdi -lusb
68 else
69 FTDI2232LIB =
70 endif
71 endif
72 endif
73
74 if USBPROG
75 LIBUSB = -lusb
76 else
77 if JLINK
78 LIBUSB = -lusb
79 else
80 if RLINK
81 LIBUSB = -lusb
82 else
83 if VSLLINK
84 LIBUSB = -lusb
85 else
86 LIBUSB =
87 endif
88 endif
89 endif
90 endif
91
92 libopenocd_la_LIBADD = \
93         $(top_builddir)/src/xsvf/libxsvf.la \
94         $(top_builddir)/src/svf/libsvf.la \
95         $(top_builddir)/src/pld/libpld.la \
96         $(top_builddir)/src/jtag/libjtag.la \
97         $(top_builddir)/src/flash/libflash.la \
98         $(top_builddir)/src/target/libtarget.la \
99         $(top_builddir)/src/server/libserver.la \
100         $(top_builddir)/src/helper/libhelper.la \
101         $(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
102
103 if HTTPD
104 libopenocd_la_LIBADD += -lmicrohttpd
105 endif
106
107 STARTUP_TCL_SRCS = \
108         $(srcdir)/helper/startup.tcl \
109         $(srcdir)/jtag/startup.tcl \
110         $(srcdir)/target/startup.tcl \
111         $(srcdir)/flash/startup.tcl \
112         $(srcdir)/server/startup.tcl
113
114 EXTRA_DIST = $(STARTUP_TCL_SRCS)
115
116 BUILT_SOURCES = startup.tcl
117
118 startup.tcl: $(STARTUP_TCL_SRCS)
119         cat $^ > $@
120
121 BIN2C = $(top_builddir)/src/helper/bin2char$(EXEEXT_FOR_BUILD)
122
123 # Convert .tcl to cfile
124 startup_tcl.c: startup.tcl $(BIN2C)
125         $(BIN2C) openocd_startup_tcl < $< > $@ || rm -f $@
126
127 # add startup_tcl.c to make clean list
128 CLEANFILES = startup.tcl startup_tcl.c
129
130
131 MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
132
133 # The "quick" target builds executables & reinstalls the executables
134 # Primary use: developer types to quicken the edit/compile/debug
135 # cycle.  by not requiring a "full build and full install". Note the
136 # assumption is: You are only rebuilding the EXE.... and everything
137 # else is/was previously installed.
138 #
139 # use at your own risk
140 quick: all install-binPROGRAMS
141