lkml.org 
[lkml]   [2021]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4 1/2] Makefile: infer --target from ARCH for CC=clang
On Fri, Jul 30, 2021 at 1:17 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> +ifeq ($(SRCARCH),arm)
> +CLANG_FLAGS += --target=arm-linux-gnueabi
..,.

Ugh.

A wise man once said: "All problems in computer science can be solved
with another level of indirection".

Just do it like this:

CLANG_TARGET_FLAGS_arm = arm-linux-gnueabi
CLANG_TARGET_FLAGS_hexagon = hexagon-linux-gnu
..
CLANG_TARGET_FLAGS = $(CLANG_TARGET_FLAGS_$(ARCH))

Which is a lot denser and simpler.

And then the only if-statement can be something along the lines of

ifeq ($(CLANG_TARGET_FLAGS),)
$(error Specify clang target flags)
else
CLANG_FLAGS += --target=$(CLANG_TARGET_FLAGS)
endif

Plus add *random handwaving* about all the details for CROSS_COMPILE
and friends.

Linus

\
 
 \ /
  Last update: 2021-07-30 23:57    [W:0.035 / U:1.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site