-INCLUDES = -I$(top_srcdir)/src/helper \
- -I$(top_srcdir)/src/jtag -I$(top_srcdir)/src/target -I$(top_srcdir)/src/xsvf -I$(top_srcdir)/src/server \
- -I$(top_srcdir)/src/flash -I$(top_srcdir)/src/pld $(all_includes)
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/helper \
+ -I$(top_srcdir)/src/jtag \
+ -I$(top_srcdir)/src/target \
+ -I$(top_srcdir)/src/xsvf \
+ -I$(top_srcdir)/src/svf \
+ -I$(top_srcdir)/src/server \
+ -I$(top_srcdir)/src/flash \
+ -I$(top_srcdir)/src/pld
+
+libopenocd_la_CPPFLAGS = -DPKGBLDDATE=\"`date +%F-%R`\"
+
+# banner output includes RELSTR appended to $VERSION from the configure script
+# guess-rev.sh returns either a repository version ID or "-snapshot"
+if RELEASE
+libopenocd_la_CPPFLAGS += -DRELSTR=\"\"
+else
+libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
+endif
+
+# add default CPPFLAGS
+libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)