Skip to content

Commit b8005c8

Browse files
committed
fix makefile logic for architecture specific flags
Some ifndef slipped through in place of ifdefs and are throwing the compiler for a loop. Use ifdef to match inclusive filters in the Makefile.
1 parent 178a7eb commit b8005c8

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Makefile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -397,19 +397,19 @@ ifeq ($(LLAMA_FATAL_WARNINGS),1)
397397
endif
398398

399399
# this version of Apple ld64 is buggy
400-
ifneq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
400+
ifeq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
401401
MK_CPPFLAGS += -DHAVE_BUGGY_APPLE_LINKER
402402
endif
403403

404404
# OS specific
405405
# TODO: support Windows
406-
ifneq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
406+
ifeq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
407407
MK_CFLAGS += -pthread
408408
MK_CXXFLAGS += -pthread
409409
endif
410410

411411
# detect Windows
412-
ifneq ($(findstring _NT,$(UNAME_S)),)
412+
ifeq ($(findstring _NT,$(UNAME_S)),)
413413
_WIN32 := 1
414414
endif
415415

@@ -459,7 +459,7 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
459459
#MK_CXXFLAGS += -mssse3
460460
endif
461461

462-
ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
462+
ifeq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
463463
# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
464464
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
465465
# https://github.com/ggerganov/llama.cpp/issues/2922
@@ -470,60 +470,60 @@ ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
470470
MK_CPPFLAGS += -D_WIN32_WINNT=0x602
471471
endif
472472

473-
ifneq ($(filter aarch64%,$(UNAME_M)),)
473+
ifeq ($(filter aarch64%,$(UNAME_M)),)
474474
# Apple M1, M2, etc.
475475
# Raspberry Pi 3, 4, Zero 2 (64-bit)
476476
# Nvidia Jetson
477477
MK_CFLAGS += -mcpu=native
478478
MK_CXXFLAGS += -mcpu=native
479479
JETSON_RELEASE_INFO = $(shell jetson_release)
480480
ifdef JETSON_RELEASE_INFO
481-
ifneq ($(filter TX2%,$(JETSON_RELEASE_INFO)),)
481+
ifeq ($(filter TX2%,$(JETSON_RELEASE_INFO)),)
482482
JETSON_EOL_MODULE_DETECT = 1
483483
CC = aarch64-unknown-linux-gnu-gcc
484484
cxx = aarch64-unknown-linux-gnu-g++
485485
endif
486486
endif
487487
endif
488488

489-
ifneq ($(filter armv6%,$(UNAME_M)),)
489+
ifeq ($(filter armv6%,$(UNAME_M)),)
490490
# Raspberry Pi 1, Zero
491491
MK_CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
492492
MK_CXXFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
493493
endif
494494

495-
ifneq ($(filter armv7%,$(UNAME_M)),)
495+
ifeq ($(filter armv7%,$(UNAME_M)),)
496496
# Raspberry Pi 2
497497
MK_CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations
498498
MK_CXXFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations
499499
endif
500500

501-
ifneq ($(filter armv8%,$(UNAME_M)),)
501+
ifeq ($(filter armv8%,$(UNAME_M)),)
502502
# Raspberry Pi 3, 4, Zero 2 (32-bit)
503503
MK_CFLAGS += -mfp16-format=ieee -mno-unaligned-access
504504
MK_CXXFLAGS += -mfp16-format=ieee -mno-unaligned-access
505505
endif
506506

507-
ifneq ($(filter ppc64%,$(UNAME_M)),)
507+
ifeq ($(filter ppc64%,$(UNAME_M)),)
508508
POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)
509-
ifneq (,$(findstring POWER9,$(POWER9_M)))
509+
ifeq (,$(findstring POWER9,$(POWER9_M)))
510510
MK_CFLAGS += -mcpu=power9
511511
MK_CXXFLAGS += -mcpu=power9
512512
endif
513513
endif
514514

515-
ifneq ($(filter ppc64le%,$(UNAME_M)),)
515+
ifeq ($(filter ppc64le%,$(UNAME_M)),)
516516
MK_CFLAGS += -mcpu=powerpc64le
517517
MK_CXXFLAGS += -mcpu=powerpc64le
518518
CUDA_POWER_ARCH = 1
519519
endif
520520

521-
ifneq ($(filter loongarch64%,$(UNAME_M)),)
521+
ifeq ($(filter loongarch64%,$(UNAME_M)),)
522522
MK_CFLAGS += -mlasx
523523
MK_CXXFLAGS += -mlasx
524524
endif
525525

526-
ifneq ($(filter riscv64%,$(UNAME_M)),)
526+
ifeq ($(filter riscv64%,$(UNAME_M)),)
527527
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
528528
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
529529
endif
@@ -625,7 +625,7 @@ ifdef LLAMA_FATAL_WARNINGS
625625
MK_NVCCFLAGS += -Werror all-warnings
626626
endif # LLAMA_FATAL_WARNINGS
627627

628-
ifndef JETSON_EOL_MODULE_DETECT
628+
ifdef JETSON_EOL_MODULE_DETECT
629629
MK_NVCCFLAGS += --forward-unknown-to-host-compiler
630630
endif # JETSON_EOL_MODULE_DETECT
631631

0 commit comments

Comments
 (0)