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