aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.de>2021-09-25 13:39:42 +0200
committerNico Huber <nico.h@gmx.de>2021-09-28 22:09:58 +0000
commitc99945d962352e9082a425b5f845735b9cd2014a (patch)
tree8408c878ded985093a06ac8033b733ab3a272104 /Makefile
parent29ff205e6f10895cd6c53678398b962eb18694d2 (diff)
downloadflashrom-c99945d962352e9082a425b5f845735b9cd2014a.tar.gz
flashrom-c99945d962352e9082a425b5f845735b9cd2014a.tar.bz2
flashrom-c99945d962352e9082a425b5f845735b9cd2014a.zip
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 <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/57935 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Singer <felixsinger@posteo.net>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile199
1 files changed, 2 insertions, 197 deletions
diff --git a/Makefile b/Makefile
index df67e0f4..8e06deeb 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,8 @@
# GNU General Public License for more details.
#
+include Makefile.include
+
PROGRAM = flashrom
###############################################################################
@@ -133,23 +135,6 @@ DEPENDS_ON_LIBFTDI := \
DEPENDS_ON_LIBJAYLINK := \
CONFIG_JLINK_SPI \
-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
ifeq ($(CONFIG_ENABLE_LIBUSB1_PROGRAMMERS), no)
$(call disable_all,$(DEPENDS_ON_LIBUSB1))
@@ -896,16 +881,6 @@ strip: $(PROGRAM)$(EXEC_SUFFIX)
# to define test programs we use verbatim variables, which get exported
# to environment variables and are referenced with $$<varname> later
-define COMPILER_TEST
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export COMPILER_TEST
-
compiler: featuresavailable
@printf "Checking for a C compiler... " | tee -a $(BUILD_DETAILS_FILE)
@echo "$$COMPILER_TEST" > .test.c
@@ -930,77 +905,6 @@ ifeq ($(TARGET_OS), libpayload)
echo "This might work but usually does not, please beware." )
endif
-define LIBPCI_TEST
-/* Avoid a failing test due to libpci header symbol shadowing breakage */
-#define index shadow_workaround_index
-#if !defined __NetBSD__
-#include <pci/pci.h>
-#else
-#include <pciutils/pci.h>
-#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 <pci/pci.h>
-#else
-#include <pciutils/pci.h>
-#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 <stddef.h>
-#include <libusb.h>
-int main(int argc, char **argv)
-{
- (void)argc;
- (void)argv;
- libusb_init(NULL);
- return 0;
-}
-endef
-export LIBUSB1_TEST
-
-define LIBJAYLINK_TEST
-#include <stddef.h>
-#include <libjaylink/libjaylink.h>
-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
-
hwlibs: compiler
@printf "" > .libdeps
ifeq ($(CHECK_LIBPCI), yes)
@@ -1096,105 +1000,6 @@ ifneq ($(UNSUPPORTED_FEATURES), )
@false
endif
-define FTDI_TEST
-#include <stdlib.h>
-#include <ftdi.h>
-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 <ftdi.h>
-enum ftdi_chip_type type = TYPE_232H;
-endef
-export FTDI_232H_TEST
-
-define UTSNAME_TEST
-#include <sys/utsname.h>
-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 <mtd/mtd-user.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export LINUX_MTD_TEST
-
-define LINUX_SPI_TEST
-#include <linux/types.h>
-#include <linux/spi/spidev.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export LINUX_SPI_TEST
-
-define LINUX_I2C_TEST
-#include <linux/i2c-dev.h>
-#include <linux/i2c.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export LINUX_I2C_TEST
-
-define CLOCK_GETTIME_TEST
-#include <time.h>
-
-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 <ni845x.h>
-
-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
-
features: compiler
@echo "FEATURES := yes" > .features.tmp
ifneq ($(NEED_LIBFTDI), )