Always propagate HAVE_/NO_ values from ARCHCONFIG when FORCE is enabled
You can end up in a situation where the HAVE_x/NO_x flags are used for compiling param.h but not Makefile.conf which leads to further inconsistencies. This uses the existing logic to parse ARCHCONFIG and ensures it ends up in the eventual Makefile.conf whenever FORCE is enabled.
This commit is contained in:
parent
42cbfd2d17
commit
274f0fd3e7
|
@ -1742,6 +1742,9 @@ export HAVE_NEON
|
||||||
ifndef NO_MSA
|
ifndef NO_MSA
|
||||||
export HAVE_MSA
|
export HAVE_MSA
|
||||||
export MSA_FLAGS
|
export MSA_FLAGS
|
||||||
|
else
|
||||||
|
HAVE_MSA =
|
||||||
|
MSA_FLAGS =
|
||||||
endif
|
endif
|
||||||
export KERNELDIR
|
export KERNELDIR
|
||||||
export FUNCTION_PROFILE
|
export FUNCTION_PROFILE
|
||||||
|
|
166
getarch.c
166
getarch.c
|
@ -1,5 +1,7 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Copyright (c) 2011-2014, The OpenBLAS Project
|
Copyright (c) 2011-2014, The OpenBLAS Project
|
||||||
|
Copyright (c) 2022, Arm Limited and/or its affiliates <open-source-office@arm.com>
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -1815,6 +1817,69 @@ static int get_num_cores(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FORCE
|
||||||
|
static void split_archconfig_makefile(char* buffer) {
|
||||||
|
sprintf(buffer, "%s", ARCHCONFIG);
|
||||||
|
|
||||||
|
char* p = &buffer[0];
|
||||||
|
|
||||||
|
while (*p) {
|
||||||
|
if ((*p == '-') && (*(p + 1) == 'D')) {
|
||||||
|
p += 2;
|
||||||
|
if (*p != 'H' && *p != 'N') {
|
||||||
|
while( (*p != ' ') && (*p != '-') && (*p != '\0') && (*p != '\n')) {p++; }
|
||||||
|
if (*p == '-') continue;
|
||||||
|
}
|
||||||
|
while ((*p != ' ') && (*p != '\0')) {
|
||||||
|
|
||||||
|
if (*p == '=') {
|
||||||
|
printf("=");
|
||||||
|
p ++;
|
||||||
|
while ((*p != ' ') && (*p != '\0')) {
|
||||||
|
printf("%c", *p);
|
||||||
|
p ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("%c", *p);
|
||||||
|
p ++;
|
||||||
|
if ((*p == ' ') || (*p =='\0')) printf("=1\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else p ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void split_archconfig_header(char* buffer) {
|
||||||
|
sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME);
|
||||||
|
|
||||||
|
char* p = &buffer[0];
|
||||||
|
while (*p) {
|
||||||
|
if ((*p == '-') && (*(p + 1) == 'D')) {
|
||||||
|
p += 2;
|
||||||
|
printf("#define ");
|
||||||
|
|
||||||
|
while ((*p != ' ') && (*p != '\0')) {
|
||||||
|
|
||||||
|
if (*p == '=') {
|
||||||
|
printf(" ");
|
||||||
|
p ++;
|
||||||
|
while ((*p != ' ') && (*p != '\0')) {
|
||||||
|
printf("%c", *p);
|
||||||
|
p ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (*p != '\n')
|
||||||
|
printf("%c", *p);
|
||||||
|
p ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
} else p ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
|
|
||||||
#ifdef FORCE
|
#ifdef FORCE
|
||||||
|
@ -1846,77 +1911,12 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
printf("NUM_CORES=%d\n", get_num_cores());
|
printf("NUM_CORES=%d\n", get_num_cores());
|
||||||
|
|
||||||
#if defined(__arm__)
|
#ifdef FORCE
|
||||||
#if !defined(FORCE)
|
split_archconfig_makefile(buffer);
|
||||||
fprintf(stderr,"get features!\n");
|
#elif defined(__arm__)
|
||||||
get_features();
|
get_features();
|
||||||
#else
|
#elif defined(INTEL_AMD)
|
||||||
fprintf(stderr,"split archconfig!\n");
|
|
||||||
sprintf(buffer, "%s", ARCHCONFIG);
|
|
||||||
|
|
||||||
p = &buffer[0];
|
|
||||||
|
|
||||||
while (*p) {
|
|
||||||
if ((*p == '-') && (*(p + 1) == 'D')) {
|
|
||||||
p += 2;
|
|
||||||
if (*p != 'H') {
|
|
||||||
while( (*p != ' ') && (*p != '-') && (*p != '\0') && (*p != '\n')) {p++; }
|
|
||||||
if (*p == '-') continue;
|
|
||||||
}
|
|
||||||
while ((*p != ' ') && (*p != '\0')) {
|
|
||||||
|
|
||||||
if (*p == '=') {
|
|
||||||
printf("=");
|
|
||||||
p ++;
|
|
||||||
while ((*p != ' ') && (*p != '\0')) {
|
|
||||||
printf("%c", *p);
|
|
||||||
p ++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("%c", *p);
|
|
||||||
p ++;
|
|
||||||
if ((*p == ' ') || (*p =='\0')) printf("=1\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else p ++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef INTEL_AMD
|
|
||||||
#ifndef FORCE
|
|
||||||
get_sse();
|
get_sse();
|
||||||
#else
|
|
||||||
|
|
||||||
sprintf(buffer, "%s", ARCHCONFIG);
|
|
||||||
|
|
||||||
p = &buffer[0];
|
|
||||||
|
|
||||||
while (*p) {
|
|
||||||
if ((*p == '-') && (*(p + 1) == 'D')) {
|
|
||||||
p += 2;
|
|
||||||
|
|
||||||
while ((*p != ' ') && (*p != '\0')) {
|
|
||||||
|
|
||||||
if (*p == '=') {
|
|
||||||
printf("=");
|
|
||||||
p ++;
|
|
||||||
while ((*p != ' ') && (*p != '\0')) {
|
|
||||||
printf("%c", *p);
|
|
||||||
p ++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("%c", *p);
|
|
||||||
p ++;
|
|
||||||
if ((*p == ' ') || (*p =='\0')) printf("=1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
} else p ++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
@ -1945,33 +1945,7 @@ printf("ELF_VERSION=2\n");
|
||||||
|
|
||||||
case '1' : /* For config.h */
|
case '1' : /* For config.h */
|
||||||
#ifdef FORCE
|
#ifdef FORCE
|
||||||
sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME);
|
split_archconfig_header(buffer);
|
||||||
|
|
||||||
p = &buffer[0];
|
|
||||||
while (*p) {
|
|
||||||
if ((*p == '-') && (*(p + 1) == 'D')) {
|
|
||||||
p += 2;
|
|
||||||
printf("#define ");
|
|
||||||
|
|
||||||
while ((*p != ' ') && (*p != '\0')) {
|
|
||||||
|
|
||||||
if (*p == '=') {
|
|
||||||
printf(" ");
|
|
||||||
p ++;
|
|
||||||
while ((*p != ' ') && (*p != '\0')) {
|
|
||||||
printf("%c", *p);
|
|
||||||
p ++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (*p != '\n')
|
|
||||||
printf("%c", *p);
|
|
||||||
p ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
} else p ++;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
get_cpuconfig();
|
get_cpuconfig();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue