xref: /OK3568_Linux_fs/buildroot/package/openocd/openocd.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# openocd
4#
5################################################################################
6
7OPENOCD_VERSION = 0.11.0
8OPENOCD_SOURCE = openocd-$(OPENOCD_VERSION).tar.bz2
9OPENOCD_SITE = http://sourceforge.net/projects/openocd/files/openocd/$(OPENOCD_VERSION)
10OPENOCD_LICENSE = GPL-2.0+
11OPENOCD_LICENSE_FILES = COPYING
12# 0002-configure-enable-build-on-uclinux.patch patches configure.ac
13OPENOCD_AUTORECONF = YES
14OPENOCD_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
15
16OPENOCD_CONF_OPTS = \
17	--oldincludedir=$(STAGING_DIR)/usr/include \
18	--includedir=$(STAGING_DIR)/usr/include \
19	--disable-doxygen-html \
20	--disable-internal-jimtcl \
21	--disable-shared \
22	--enable-dummy \
23	--disable-werror
24
25# Rely on the Config.in options of each individual adapter selecting
26# the dependencies they need.
27
28OPENOCD_DEPENDENCIES = \
29	host-pkgconf \
30	jimtcl \
31	$(if $(BR2_PACKAGE_LIBFTDI1),libftdi1) \
32	$(if $(BR2_PACKAGE_LIBUSB),libusb) \
33	$(if $(BR2_PACKAGE_LIBUSB_COMPAT),libusb-compat) \
34	$(if $(BR2_PACKAGE_LIBHID),libhid) \
35	$(if $(BR2_PACKAGE_HIDAPI),hidapi) \
36	$(if $(BR2_PACKAGE_LIBGPIOD),libgpiod)
37
38# Adapters
39OPENOCD_CONF_OPTS += \
40	$(if $(BR2_PACKAGE_OPENOCD_FTDI),--enable-ftdi,--disable-ftdi) \
41	$(if $(BR2_PACKAGE_OPENOCD_STLINK),--enable-stlink,--disable-stlink) \
42	$(if $(BR2_PACKAGE_OPENOCD_TI_ICDI),--enable-ti-icdi,--disable-ti-icdi) \
43	$(if $(BR2_PACKAGE_OPENOCD_ULINK),--enable-ulink,--disable-ulink) \
44	$(if $(BR2_PACKAGE_OPENOCD_UBLASTER2),--enable-usb-blaster-2,--disable-usb-blaster-2) \
45	$(if $(BR2_PACKAGE_OPENOCD_JLINK),--enable-jlink,--disable-jlink) \
46	$(if $(BR2_PACKAGE_OPENOCD_OSDBM),--enable-osbdm,--disable-osbdm) \
47	$(if $(BR2_PACKAGE_OPENOCD_OPENDOUS),--enable-opendous,--disable-opendous) \
48	$(if $(BR2_PACKAGE_OPENOCD_AICE),--enable-aice,--disable-aice) \
49	$(if $(BR2_PACKAGE_OPENOCD_VSLLINK),--enable-vsllink,--disable-vsllink) \
50	$(if $(BR2_PACKAGE_OPENOCD_USBPROG),--enable-usbprog,--disable-usbprog) \
51	$(if $(BR2_PACKAGE_OPENOCD_RLINK),--enable-rlink,--disable-rlink) \
52	$(if $(BR2_PACKAGE_OPENOCD_XDS110),--enable-xds110,--disable-xds110) \
53	$(if $(BR2_PACKAGE_OPENOCD_ARMEW),--enable-armjtagew,--disable-armjtagew) \
54	$(if $(BR2_PACKAGE_OPENOCD_CMSIS_DAP),--enable-cmsis-dap,--disable-cmsis-dap) \
55	$(if $(BR2_PACKAGE_OPENOCD_PARPORT),--enable-parport,--disable-parport) \
56	$(if $(BR2_PACKAGE_OPENOCD_VPI),--enable-jtag_vpi,--disable-jtag_vpi) \
57	$(if $(BR2_PACKAGE_OPENOCD_UBLASTER),--enable-usb-blaster,--disable-usb-blaster) \
58	$(if $(BR2_PACKAGE_OPENOCD_AMTJT),--enable-amtjtagaccel,--disable-amjtagaccel) \
59	$(if $(BR2_PACKAGE_OPENOCD_ZY1000_MASTER),--enable-zy1000-master,--disable-zy1000-master) \
60	$(if $(BR2_PACKAGE_OPENOCD_ZY1000),--enable-zy1000,--disable-zy1000) \
61	$(if $(BR2_PACKAGE_OPENOCD_EP93XX),--enable-ep93xx,--disable-ep93xx) \
62	$(if $(BR2_PACKAGE_OPENOCD_AT91RM),--enable-at91rm9200,--disable-at91rm9200) \
63	$(if $(BR2_PACKAGE_OPENOCD_BCM2835),--enable-bcm2835gpio,--disable-bcm2835gpio) \
64	$(if $(BR2_PACKAGE_OPENOCD_GW16012),--enable-gw16012,--disable-gw16012) \
65	$(if $(BR2_PACKAGE_OPENOCD_PRESTO),--enable-presto,--disable-presto) \
66	$(if $(BR2_PACKAGE_OPENOCD_OPENJTAG),--enable-openjtag,--disable-openjtag) \
67	$(if $(BR2_PACKAGE_OPENOCD_BUSPIRATE),--enable-buspirate,--disable-buspirate) \
68	$(if $(BR2_PACKAGE_OPENOCD_SYSFS),--enable-sysfsgpio,--disable-sysfsgpio)
69
70# Enable all configuration options for host build.
71#
72# Note that deprecated options have been removed. CMSIS_DAP needs
73# hidapi (currently not included in buildroot) and zy1000 stuff fails
74# to build, so they've been removed too.
75#
76HOST_OPENOCD_CONF_OPTS = \
77	--enable-ftdi \
78	--enable-stlink \
79	--enable-ti-icdi \
80	--enable-ulink \
81	--enable-usb-blaster-2 \
82	--enable-jlink \
83	--enable-osbdm \
84	--enable-opendous \
85	--enable-aice \
86	--enable-vsllink \
87	--enable-usbprog \
88	--enable-rlink \
89	--enable-armjtagew \
90	--enable-parport \
91	--enable-jtag_vpi \
92	--enable-usb-blaster \
93	--enable-amtjtagaccel \
94	--enable-gw16012 \
95	--enable-presto \
96	--enable-openjtag \
97	--enable-buspirate \
98	--enable-sysfsgpio \
99	--oldincludedir=$(HOST_DIR)/include \
100	--includedir=$(HOST_DIR)/include \
101	--disable-doxygen-html \
102	--disable-internal-jimtcl \
103	--disable-shared \
104	--enable-dummy \
105	--disable-werror
106
107HOST_OPENOCD_DEPENDENCIES = host-jimtcl host-libftdi host-libusb host-libusb-compat
108
109# Avoid documentation rebuild. On PowerPC64(le), we patch the
110# configure script. Due to this, the version.texi files gets
111# regenerated, and then since it has a newer date than openocd.info,
112# openocd build system rebuilds the documentation. Unfortunately, this
113# documentation rebuild fails on old machines. We work around this by
114# faking the date of the generated version.texi file, to make the
115# build system believe the documentation doesn't need to be
116# regenerated.
117define OPENOCD_FIX_VERSION_TEXI
118	touch -r $(@D)/doc/openocd.info $(@D)/doc/version.texi
119endef
120OPENOCD_POST_BUILD_HOOKS += OPENOCD_FIX_VERSION_TEXI
121HOST_OPENOCD_POST_BUILD_HOOKS += OPENOCD_FIX_VERSION_TEXI
122
123$(eval $(autotools-package))
124$(eval $(host-autotools-package))
125