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