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