Extend autotools build to create shared library libopenocd with libtool:
[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 = openocd.c
16
17 # set the include path found by configure
18 AM_CPPFLAGS = \
19         -I$(top_srcdir)/src \
20         -I$(top_srcdir)/src/helper \
21         -I$(top_srcdir)/src/jtag \
22         -I$(top_srcdir)/src/target \
23         -I$(top_srcdir)/src/xsvf \
24         -I$(top_srcdir)/src/svf \
25         -I$(top_srcdir)/src/server \
26         -I$(top_srcdir)/src/flash \
27         -I$(top_srcdir)/src/pld
28
29 # pass path to prefix path
30 libopenocd_la_CPPFLAGS = \
31  -DPKGLIBDIR=\"$(pkglibdir)\" \
32  -DPKGBLDDATE=\"`date +%F-%R`\"
33
34 if RELEASE
35 libopenocd_la_CPPFLAGS += -DRELSTR=\"Release\" -DPKGBLDREV=\"\"
36 else
37 libopenocd_la_CPPFLAGS += -DRELSTR=\"svn:\" -DPKGBLDREV=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
38 endif
39
40 # add default CPPFLAGS
41 libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
42
43 # the library search path.
44 libopenocd_la_LDFLAGS = $(all_libraries) 
45
46 if IS_MINGW
47 MINGWLDADD = -lwsock32
48 else
49 MINGWLDADD =
50 endif
51
52 if FT2232_LIBFTDI
53 FTDI2232LIB = -lftdi -lusb
54 else
55 if PRESTO_LIBFTDI
56 FTDI2232LIB = -lftdi -lusb
57 else
58 FTDI2232LIB =
59 endif
60 endif
61
62 if USBPROG
63 LIBUSB = -lusb
64 else
65 if JLINK
66 LIBUSB = -lusb
67 else
68 if RLINK
69 LIBUSB = -lusb
70 else
71 if VSLLINK
72 LIBUSB = -lusb
73 else
74 LIBUSB =
75 endif
76 endif
77 endif
78 endif
79
80 libopenocd_la_LIBADD = \
81         $(top_builddir)/src/xsvf/libxsvf.la \
82         $(top_builddir)/src/svf/libsvf.la \
83         $(top_builddir)/src/pld/libpld.la \
84         $(top_builddir)/src/jtag/libjtag.la \
85         $(top_builddir)/src/flash/libflash.la \
86         $(top_builddir)/src/target/libtarget.la \
87         $(top_builddir)/src/server/libserver.la \
88         $(top_builddir)/src/helper/libhelper.la \
89         $(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
90
91 if HTTPD
92 libopenocd_la_LIBADD += -lmicrohttpd
93 endif
94
95 nobase_dist_pkglib_DATA = \
96         tcl/bitsbytes.tcl                       \
97         tcl/chip/atmel/at91/aic.tcl             \
98         tcl/chip/atmel/at91/at91sam7x128.tcl    \
99         tcl/chip/atmel/at91/at91sam7x256.tcl    \
100         tcl/chip/atmel/at91/pmc.tcl             \
101         tcl/chip/atmel/at91/rtt.tcl             \
102         tcl/chip/atmel/at91/usarts.tcl          \
103         tcl/chip/st/stm32/stm32.tcl             \
104         tcl/chip/st/stm32/stm32_rcc.tcl         \
105         tcl/chip/st/stm32/stm32_regs.tcl        \
106         tcl/cpu/arm/arm7tdmi.tcl                \
107         tcl/cpu/arm/arm920.tcl                  \
108         tcl/cpu/arm/arm946.tcl                  \
109         tcl/cpu/arm/arm966.tcl                  \
110         tcl/cpu/arm/cortex_m3.tcl               \
111         tcl/memory.tcl                          \
112         tcl/mmr_helpers.tcl                     \
113         tcl/readable.tcl
114
115 MAINTAINERCLEANFILES = Makefile.in