diff --git a/common.mk b/common.mk new file mode 100644 index 000000000..d2273d788 --- /dev/null +++ b/common.mk @@ -0,0 +1,5 @@ + +# common flags used in openocd build +AM_CPPFLAGS = -I$(top_srcdir)/src \ + -I$(top_builddir)/src \ + -DPKGDATADIR=\"$(pkgdatadir)\" diff --git a/src/Makefile.am b/src/Makefile.am index 19a0ba96c..c2d37c101 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/common.mk + SUBDIRS = \ jtag \ helper \ @@ -29,12 +31,6 @@ noinst_HEADERS = \ hello.h \ openocd.h - -# set the include path found by configure -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src - libopenocd_la_CPPFLAGS = -DPKGBLDDATE=\"`date +%F-%R`\" # banner output includes RELSTR appended to $VERSION from the configure script diff --git a/src/flash/Makefile.am b/src/flash/Makefile.am index 9d983a8d9..ece401837 100644 --- a/src/flash/Makefile.am +++ b/src/flash/Makefile.am @@ -1,11 +1,9 @@ +include $(top_srcdir)/common.mk + SUBDIRS = \ nor \ nand -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src - METASOURCES = AUTO noinst_LTLIBRARIES = libflash.la libflash_la_SOURCES = \ diff --git a/src/flash/nand/Makefile.am b/src/flash/nand/Makefile.am index 8ea7b362d..9aa0e69f1 100644 --- a/src/flash/nand/Makefile.am +++ b/src/flash/nand/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk noinst_LTLIBRARIES = libocdflashnand.la diff --git a/src/flash/nor/Makefile.am b/src/flash/nor/Makefile.am index 852c0a379..e281c22bf 100644 --- a/src/flash/nor/Makefile.am +++ b/src/flash/nor/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk noinst_LTLIBRARIES = libocdflashnor.la libocdflashnor_la_SOURCES = \ diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am index c72188191..25585a489 100644 --- a/src/helper/Makefile.am +++ b/src/helper/Makefile.am @@ -1,7 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ - -DPKGDATADIR=\"$(pkgdatadir)\" +include $(top_srcdir)/common.mk METASOURCES = AUTO noinst_LTLIBRARIES = libhelper.la diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am index 59cd8ffff..fa964a352 100644 --- a/src/jtag/Makefile.am +++ b/src/jtag/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk METASOURCES = AUTO noinst_LTLIBRARIES = libjtag.la diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am index 058812654..f3d5ab052 100644 --- a/src/jtag/drivers/Makefile.am +++ b/src/jtag/drivers/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk noinst_LTLIBRARIES = libocdjtagdrivers.la diff --git a/src/pld/Makefile.am b/src/pld/Makefile.am index 3993622e6..93b79f4a1 100644 --- a/src/pld/Makefile.am +++ b/src/pld/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk METASOURCES = AUTO noinst_LTLIBRARIES = libpld.la diff --git a/src/server/Makefile.am b/src/server/Makefile.am index ac24ebb55..a7c318ce6 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -1,7 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ - -DPKGDATADIR=\"$(pkgdatadir)\" +include $(top_srcdir)/common.mk METASOURCES = AUTO noinst_LTLIBRARIES = libserver.la diff --git a/src/svf/Makefile.am b/src/svf/Makefile.am index 398f9676d..3a14d2087 100644 --- a/src/svf/Makefile.am +++ b/src/svf/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk METASOURCES = AUTO noinst_LTLIBRARIES = libsvf.la diff --git a/src/target/Makefile.am b/src/target/Makefile.am index 1e29ae7d5..537c8c317 100644 --- a/src/target/Makefile.am +++ b/src/target/Makefile.am @@ -1,3 +1,4 @@ +include $(top_srcdir)/common.mk if OOCD_TRACE OOCD_TRACE_FILES = oocd_trace.c @@ -5,10 +6,6 @@ else OOCD_TRACE_FILES = endif -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src - BIN2C = $(top_builddir)/src/helper/bin2char$(EXEEXT_FOR_BUILD) DEBUG_HANDLER = $(srcdir)/xscale/debug_handler.bin diff --git a/src/xsvf/Makefile.am b/src/xsvf/Makefile.am index f96331cd5..1b9cfab00 100644 --- a/src/xsvf/Makefile.am +++ b/src/xsvf/Makefile.am @@ -1,6 +1,4 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +include $(top_srcdir)/common.mk METASOURCES = AUTO noinst_LTLIBRARIES = libxsvf.la