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