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