blob: 62c040cc69f5bd09f8188998b49aa964dbaef479 [file] [log] [blame]
Thomas Heijligen90fa8152021-09-25 13:39:42 +02001#
2# This file is part of the flashrom project.
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; version 2 of the License.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13
14# Here are functions and macros defined for the Makefile
15
16define mark_unsupported
17$(foreach p,$1, \
18 $(if $(filter $($(p)),yes), \
19 $(eval UNSUPPORTED_FEATURES += $(p)=yes), \
20 $(eval override $(p) := no)))
21endef
22
23define filter_deps
24$(strip $(foreach p,$1, \
25 $(if $(filter $($(p)),yes), \
26 $(p))))
27endef
28
29define disable_all
30$(foreach p,$1, \
31 $(eval override $(p) := no))
32endef
33
34
35define COMPILER_TEST
36int main(int argc, char **argv)
37{
38 (void) argc;
39 (void) argv;
40 return 0;
41}
42endef
43export COMPILER_TEST
44
45define LIBPCI_TEST
46/* Avoid a failing test due to libpci header symbol shadowing breakage */
47#define index shadow_workaround_index
48#if !defined PCIUTILS_PCI_H
49#include <pci/pci.h>
50#else
51#include <pciutils/pci.h>
52#endif
53struct pci_access *pacc;
54int main(int argc, char **argv)
55{
56 (void) argc;
57 (void) argv;
58 pacc = pci_alloc();
59 return 0;
60}
61endef
62export LIBPCI_TEST
63
64define PCI_GET_DEV_TEST
65/* Avoid a failing test due to libpci header symbol shadowing breakage */
66#define index shadow_workaround_index
67#if !defined PCIUTILS_PCI_H
68#include <pci/pci.h>
69#else
70#include <pciutils/pci.h>
71#endif
72struct pci_access *pacc;
73struct pci_dev *dev = {0};
74int main(int argc, char **argv)
75{
76 (void) argc;
77 (void) argv;
78 pacc = pci_alloc();
79 dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
80 return 0;
81}
82endef
83export PCI_GET_DEV_TEST
84
85define LIBUSB1_TEST
86#include <stddef.h>
87#include <libusb.h>
88int main(int argc, char **argv)
89{
90 (void)argc;
91 (void)argv;
92 libusb_init(NULL);
93 return 0;
94}
95endef
96export LIBUSB1_TEST
97
98define LIBJAYLINK_TEST
99#include <stddef.h>
100#include <libjaylink/libjaylink.h>
101int main(int argc, char **argv)
102{
103 struct jaylink_context *ctx;
104
105 (void)argc;
106 (void)argv;
107
108 jaylink_init(&ctx);
109 jaylink_exit(ctx);
110
111 return 0;
112}
113endef
114export LIBJAYLINK_TEST
115
116define FTDI_TEST
117#include <stdlib.h>
118#include <ftdi.h>
119struct ftdi_context *ftdic = NULL;
120int main(int argc, char **argv)
121{
122 (void) argc;
123 (void) argv;
124 return ftdi_init(ftdic);
125}
126endef
127export FTDI_TEST
128
129define FTDI_232H_TEST
130#include <ftdi.h>
131enum ftdi_chip_type type = TYPE_232H;
132endef
133export FTDI_232H_TEST
134
135define UTSNAME_TEST
136#include <sys/utsname.h>
137struct utsname osinfo;
138int main(int argc, char **argv)
139{
140 (void) argc;
141 (void) argv;
142 uname (&osinfo);
143 return 0;
144}
145endef
146export UTSNAME_TEST
147
148define LINUX_MTD_TEST
149#include <mtd/mtd-user.h>
150
151int main(int argc, char **argv)
152{
153 (void) argc;
154 (void) argv;
155 return 0;
156}
157endef
158export LINUX_MTD_TEST
159
160define LINUX_SPI_TEST
161#include <linux/types.h>
162#include <linux/spi/spidev.h>
163
164int main(int argc, char **argv)
165{
166 (void) argc;
167 (void) argv;
168 return 0;
169}
170endef
171export LINUX_SPI_TEST
172
173define LINUX_I2C_TEST
174#include <linux/i2c-dev.h>
175#include <linux/i2c.h>
176
177int main(int argc, char **argv)
178{
179 (void) argc;
180 (void) argv;
181 return 0;
182}
183endef
184export LINUX_I2C_TEST
185
186define CLOCK_GETTIME_TEST
187#include <time.h>
188
189int main(int argc, char **argv)
190{
191 struct timespec res;
192 clock_gettime(CLOCK_REALTIME, &res);
193 return 0;
194}
195endef
196export CLOCK_GETTIME_TEST
197
198define NI845X_TEST
199#include <ni845x.h>
200
201int main(int argc, char **argv)
202{
203 (void) argc;
204 (void) argv;
205 char I2C_Device[256];
206 NiHandle Dev_Handle;
207 uInt32 NumberFound = 0;
208 ni845xFindDevice(I2C_Device, &Dev_Handle, &NumberFound);
209 ni845xCloseFindDeviceHandle(Dev_Handle);
210 return 0;
211}
212endef
213export NI845X_TEST