Skip to content

Commit

Permalink
Merge pull request #713 from srz-zumix/feature/xcode_llvm_mapping
Browse files Browse the repository at this point in the history
Xcode と LLVM の対応を更新
  • Loading branch information
srz-zumix authored Mar 9, 2025
1 parent 183f477 commit c000dc3
Showing 1 changed file with 43 additions and 34 deletions.
77 changes: 43 additions & 34 deletions utils/xcode.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,36 @@ empty:=
space:=$(empty) $(empty)
APPLE_CLANGVERSION:=$(subst -,$(dot), $(APPLE_CLANGVERSION))
APPLE_CLANGVERSION:=$(subst $(dot),$(space), $(APPLE_CLANGVERSION))
APPLE_CLANGVERSION:=$(subst version,, $(APPLE_CLANGVERSION))

# $(warning ${APPLE_CLANGVERSION})

APPLE_CLANGMAJOR:=$(word 1, $(APPLE_CLANGVERSION))
APPLE_CLANGMINOR:=$(word 2, $(APPLE_CLANGVERSION))
APPLE_CLANGPATCH:=$(word 3, $(APPLE_CLANGVERSION))

# $(warning ${APPLE_CLANGMAJOR})
# $(warning ${APPLE_CLANGMINOR})
# $(warning ${APPLE_CLANGPATCH})

ifeq ($(words $(APPLE_CLANGVERSION)), 3)
APPLE_CLANGMAJOR:=$(word 2, $(APPLE_CLANGVERSION))
APPLE_CLANGMINOR:=$(word 3, $(APPLE_CLANGVERSION))
APPLE_CLANGPATCH:=$(word 4, $(APPLE_CLANGVERSION))
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 7 \)))

# https://en.wikipedia.org/wiki/Xcode#Toolchain_versions

ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 14 \)))
# 17
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 17 \)))
CLANGMAJOR:=19
CLANGMINOR:=0
# 16
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 16 \)))
CLANGMAJOR:=17
CLANGMINOR:=0
# 15
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 15 \)))
CLANGMAJOR:=16
CLANGMINOR:=0
# 14
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 14 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGPATCH) \>= 3 \)))
CLANGMAJOR:=15
Expand All @@ -42,10 +60,8 @@ CLANGMAJOR:=14
CLANGMINOR:=0
endif

else

# 13
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 13 \)))
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 13 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGMINOR) \>= 1 \)))
CLANGMAJOR:=13
Expand All @@ -55,10 +71,8 @@ CLANGMAJOR:=12
CLANGMINOR:=0
endif

else

# 12
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 12 \)))
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 12 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGPATCH) \>= 5 \)))
CLANGMAJOR:=11
Expand All @@ -68,10 +82,8 @@ CLANGMAJOR:=10
CLANGMINOR:=0
endif

else

# 11
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 11 \)))
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 11 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGPATCH) \>= 3 \)))
CLANGMAJOR:=9
Expand All @@ -81,10 +93,8 @@ CLANGMAJOR:=8
CLANGMINOR:=0
endif

else

# 10
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 10 \)))
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 10 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGMINOR) \>= 1 \)))
CLANGMAJOR:=7
Expand All @@ -94,10 +104,8 @@ CLANGMAJOR:=6
CLANGMINOR:=0
endif

else

# 9
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 9 \)))
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 9 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGMINOR) \>= 1 \)))
CLANGMAJOR:=5
Expand All @@ -107,34 +115,35 @@ CLANGMAJOR:=4
CLANGMINOR:=0
endif

else
# 8
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 8 \)))

CLANGMAJOR:=3

# 8
ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 8 \)))
CLANGMINOR:=9
else

# 7
else ifeq (1,$(shell expr \( $(APPLE_CLANGMAJOR) \>= 7 \)))

ifeq (1,$(shell expr \( $(APPLE_CLANGMINOR) \>= 3 \)))
CLANGMINOR:=8
else
CLANGMINOR:=7
endif # >= 8
endif # >= 9
endif # >= 10
endif # >= 11
endif # >= 12
endif # >= 13
endif # >= 14
endif # >= 7
endif

else

# 6 or older
CLANGMAJOR:=3
CLANGMINOR:=${APPLE_CLANGMAJOR}

endif

else

# failed word split
CLANGMAJOR:=0
CLANGMINOR:=0

endif

CXX_MAJOR=${CLANGMAJOR}
Expand All @@ -147,4 +156,4 @@ IUTEST_CXX_STRICT_NOWARN_FLAGS+=-Wno-inconsistent-missing-destructor-override
endif


endif
endif # Apple

0 comments on commit c000dc3

Please sign in to comment.