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