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