From c99945d962352e9082a425b5f845735b9cd2014a Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Sat, 25 Sep 2021 13:39:42 +0200 Subject: Makefile: move functions and macros to own file Move all define statements in its own file to tidy up the main Makefile. Change-Id: I451f2eeab2773982e02b2f2fdc9e8abe1cc87630 Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/flashrom/+/57935 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Angel Pons Reviewed-by: Felix Singer --- Makefile.include | 213 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 Makefile.include (limited to 'Makefile.include') diff --git a/Makefile.include b/Makefile.include new file mode 100644 index 000000000..36746c805 --- /dev/null +++ b/Makefile.include @@ -0,0 +1,213 @@ +# +# This file is part of the flashrom project. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +# Here are functions and macros defined for the Makefile + +define mark_unsupported +$(foreach p,$1, \ + $(if $(filter $($(p)),yes), \ + $(eval UNSUPPORTED_FEATURES += $(p)=yes), \ + $(eval override $(p) := no))) +endef + +define filter_deps +$(strip $(foreach p,$1, \ + $(if $(filter $($(p)),yes), \ + $(p)))) +endef + +define disable_all +$(foreach p,$1, \ + $(eval override $(p) := no)) +endef + + +define COMPILER_TEST +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return 0; +} +endef +export COMPILER_TEST + +define LIBPCI_TEST +/* Avoid a failing test due to libpci header symbol shadowing breakage */ +#define index shadow_workaround_index +#if !defined __NetBSD__ +#include +#else +#include +#endif +struct pci_access *pacc; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + pacc = pci_alloc(); + return 0; +} +endef +export LIBPCI_TEST + +define PCI_GET_DEV_TEST +/* Avoid a failing test due to libpci header symbol shadowing breakage */ +#define index shadow_workaround_index +#if !defined __NetBSD__ +#include +#else +#include +#endif +struct pci_access *pacc; +struct pci_dev *dev = {0}; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + pacc = pci_alloc(); + dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1); + return 0; +} +endef +export PCI_GET_DEV_TEST + +define LIBUSB1_TEST +#include +#include +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + libusb_init(NULL); + return 0; +} +endef +export LIBUSB1_TEST + +define LIBJAYLINK_TEST +#include +#include +int main(int argc, char **argv) +{ + struct jaylink_context *ctx; + + (void)argc; + (void)argv; + + jaylink_init(&ctx); + jaylink_exit(ctx); + + return 0; +} +endef +export LIBJAYLINK_TEST + +define FTDI_TEST +#include +#include +struct ftdi_context *ftdic = NULL; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return ftdi_init(ftdic); +} +endef +export FTDI_TEST + +define FTDI_232H_TEST +#include +enum ftdi_chip_type type = TYPE_232H; +endef +export FTDI_232H_TEST + +define UTSNAME_TEST +#include +struct utsname osinfo; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + uname (&osinfo); + return 0; +} +endef +export UTSNAME_TEST + +define LINUX_MTD_TEST +#include + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return 0; +} +endef +export LINUX_MTD_TEST + +define LINUX_SPI_TEST +#include +#include + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return 0; +} +endef +export LINUX_SPI_TEST + +define LINUX_I2C_TEST +#include +#include + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + return 0; +} +endef +export LINUX_I2C_TEST + +define CLOCK_GETTIME_TEST +#include + +int main(int argc, char **argv) +{ + struct timespec res; + clock_gettime(CLOCK_REALTIME, &res); + return 0; +} +endef +export CLOCK_GETTIME_TEST + +define NI845X_TEST +#include + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + char I2C_Device[256]; + NiHandle Dev_Handle; + uInt32 NumberFound = 0; + ni845xFindDevice(I2C_Device, &Dev_Handle, &NumberFound); + ni845xCloseFindDeviceHandle(Dev_Handle); + return 0; +} +endef +export NI845X_TEST -- cgit v1.2.3