mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
Makefile: move determination test for the architecture to Makefile.d
Move the test code for architecture detection in a extra directory to split it from the main flashrom code. Change-Id: I29ce73be9c5cbe259a2471f8eea2f8745b68cdfa Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58269 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
parent
ba275d8bdb
commit
cf542aa1ce
10
Makefile
10
Makefile
@ -163,8 +163,7 @@ endif
|
||||
# is ever used (of course), but should come after any lines setting CC because
|
||||
# the lines below use CC itself.
|
||||
override TARGET_OS := $(call c_macro_test, Makefile.d/os_test.h)
|
||||
override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null \
|
||||
| tail -1 | cut -f 2 -d'"'))
|
||||
override ARCH := $(call c_macro_test, Makefile.d/arch_test.h)
|
||||
override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null \
|
||||
| tail -1))
|
||||
|
||||
@ -866,11 +865,8 @@ compiler: featuresavailable
|
||||
echo "found." || { echo "not found."; \
|
||||
rm -f .test.c .test$(EXEC_SUFFIX); exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
|
||||
@rm -f .test.c .test$(EXEC_SUFFIX)
|
||||
@printf "Target arch is "
|
||||
@# FreeBSD wc will output extraneous whitespace.
|
||||
@echo $(ARCH)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \
|
||||
( echo "unknown (\"$(ARCH)\"). Aborting."; exit 1)
|
||||
@printf "%s\n" '$(ARCH)'
|
||||
@echo Target arch is $(ARCH)
|
||||
@if [ $(ARCH) = unknown ]; then echo Aborting.; exit 1; fi
|
||||
@echo Target OS is $(TARGET_OS)
|
||||
@if [ $(TARGET_OS) = unknown ]; then echo Aborting.; exit 1; fi
|
||||
ifeq ($(TARGET_OS), libpayload)
|
||||
|
51
Makefile.d/arch_test.h
Normal file
51
Makefile.d/arch_test.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of the flashrom project.
|
||||
*
|
||||
* Copyright (C) 2011 Carl-Daniel Hailfinger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file determinate the target architecture. It should only be used
|
||||
* by the Makefile
|
||||
*/
|
||||
|
||||
#if defined (__i386__) || defined (__x86_64__) || defined(__amd64__)
|
||||
#define __FLASHROM_ARCH__ "x86"
|
||||
#elif defined (__mips) || defined (__mips__) || defined (__MIPS__) || defined (mips)
|
||||
#define __FLASHROM_ARCH__ "mips"
|
||||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || \
|
||||
defined(__ppc__) || defined(__ppc64__) || defined(_M_PPC) || defined(_ARCH_PPC) || \
|
||||
defined(_ARCH_PPC64) || defined(__ppc)
|
||||
#define __FLASHROM_ARCH__ "ppc"
|
||||
#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_ARM) || defined(_M_ARM) || defined(__arm) || \
|
||||
defined(__aarch64__)
|
||||
#define __FLASHROM_ARCH__ "arm"
|
||||
#elif defined (__sparc__) || defined (__sparc)
|
||||
#define __FLASHROM_ARCH__ "sparc"
|
||||
#elif defined (__alpha__)
|
||||
#define __FLASHROM_ARCH__ "alpha"
|
||||
#elif defined (__hppa__) || defined (__hppa)
|
||||
#define __FLASHROM_ARCH__ "hppa"
|
||||
#elif defined (__m68k__)
|
||||
#define __FLASHROM_ARCH__ "m68k"
|
||||
#elif defined (__riscv)
|
||||
#define __FLASHROM_ARCH__ "riscv"
|
||||
#elif defined (__sh__)
|
||||
#define __FLASHROM_ARCH__ "sh"
|
||||
#elif defined(__s390__) || defined(__s390x__) || defined(__zarch__)
|
||||
#define __FLASHROM_ARCH__ "s390"
|
||||
#elif defined(__arc__)
|
||||
#define __FLASHROM_ARCH__ "arc"
|
||||
#else
|
||||
#define __FLASHROM_ARCH__ "unknown"
|
||||
#endif
|
||||
__FLASHROM_ARCH__
|
@ -1,2 +0,0 @@
|
||||
#include "platform.h"
|
||||
__FLASHROM_ARCH__
|
12
platform.h
12
platform.h
@ -39,43 +39,31 @@
|
||||
|
||||
// Likewise for target architectures
|
||||
#if defined (__i386__) || defined (__x86_64__) || defined(__amd64__)
|
||||
#define __FLASHROM_ARCH__ "x86"
|
||||
#define IS_X86 1
|
||||
#elif defined (__mips) || defined (__mips__) || defined (__MIPS__) || defined (mips)
|
||||
#define __FLASHROM_ARCH__ "mips"
|
||||
#define IS_MIPS 1
|
||||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || \
|
||||
defined(__ppc__) || defined(__ppc64__) || defined(_M_PPC) || defined(_ARCH_PPC) || \
|
||||
defined(_ARCH_PPC64) || defined(__ppc)
|
||||
#define __FLASHROM_ARCH__ "ppc"
|
||||
#define IS_PPC 1
|
||||
#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_ARM) || defined(_M_ARM) || defined(__arm) || \
|
||||
defined(__aarch64__)
|
||||
#define __FLASHROM_ARCH__ "arm"
|
||||
#define IS_ARM 1
|
||||
#elif defined (__sparc__) || defined (__sparc)
|
||||
#define __FLASHROM_ARCH__ "sparc"
|
||||
#define IS_SPARC 1
|
||||
#elif defined (__alpha__)
|
||||
#define __FLASHROM_ARCH__ "alpha"
|
||||
#define IS_ALPHA 1
|
||||
#elif defined (__hppa__) || defined (__hppa)
|
||||
#define __FLASHROM_ARCH__ "hppa"
|
||||
#define IS_HPPA 1
|
||||
#elif defined (__m68k__)
|
||||
#define __FLASHROM_ARCH__ "m68k"
|
||||
#define IS_M68K 1
|
||||
#elif defined (__riscv)
|
||||
#define __FLASHROM_ARCH__ "riscv"
|
||||
#define IS_RISCV 1
|
||||
#elif defined (__sh__)
|
||||
#define __FLASHROM_ARCH__ "sh"
|
||||
#define IS_SH 1
|
||||
#elif defined(__s390__) || defined(__s390x__) || defined(__zarch__)
|
||||
#define __FLASHROM_ARCH__ "s390"
|
||||
#define IS_S390 1
|
||||
#elif defined(__arc__)
|
||||
#define __FLASHROM_ARCH__ "arc"
|
||||
#define IS_ARC 1
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user