source: trunk/kBuild/darwin-common.kmk@ 3401

Last change on this file since 3401 was 3401, checked in by bird, 5 years ago

kBuild: Adding CLANGXXMACHO tool and MACOSX1013 sdk.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1# $Id: darwin-common.kmk 3401 2020-07-05 15:58:36Z bird $
2## @file
3# kBuild Common Darwin (macOS) Definitions - Used by tools and SDKs.
4#
5
6#
7# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34INCLUDED_DARWIN_COMMON_KMK := 1
35
36### @def DARWINCMN_XCODE_APP_DEVELOPER_DIRS
37# List 'Developer' directories inside 'Xcode.app' directories.
38# The idea was to use this as a basis for DARWINCMN_TOOLCHAIN_DIRS and
39# DARWINCMN_MACOSX_SDKS_DIRS, but that didn't pan out.
40#
41# Users can alter this by setting DARWINCMN_XCODE_APP_DIRS_PREFERRED,
42# DARWINCMN_XCODE_APP_DIRS_FALLBACK and DARWINCMN_XCODE_APP_DIRS_IGNORE_DEVTOOLS.
43#
44DARWINCMN_XCODE_APP_DEVELOPER_DIRS = $(DARWINCMN_XCODE_APP_DEVELOPER_DIRS_PREFERRED) \
45 $(if-expr defined(DARWINCMN_XCODE_APP_DIRS_IGNORE_DEVTOOLS),, \
46 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/xcode/v*/*.app/Contents/Developer)) \
47 $(if $(KBUILD_DEVTOOLS_HST_ALT),$(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/xcode/v*/*.app/Contents/Developer))) ) \
48 /Applications/Xcode.app/Contents/Developer \
49 $(DARWINCMN_XCODE_APP_DIRS_FALLBACK)
50
51## @def DARWINCMN_TOOLCHAIN_DIRS
52# List of toolchain directories containing compilers and stuff in a usr/bin subdir.
53#
54# Users can alter this by setting DARWINCMN_TOOLCHAIN_DIRS_PREFERRED and DARWINCMN_TOOLCHAIN_DIRS_FALLBACK.
55#
56# @note Would love to use DARWINCMN_XCODE_APP_DEVELOPER_DIRS here, but that doesn't really fly wrt directory priority.
57# Also, prefer avoiding using the longer Xcode.app paths when command line tools are installed.
58DARWINCMN_TOOLCHAIN_DIRS = $(DARWINCMN_TOOLCHAIN_DIRS_PREFERRED) \
59 $(if-expr defined(DARWINCMN_TOOLCHAIN_DIRS_IGNORE_DEVTOOLS),, \
60 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/CommandLineTools/v*)) \
61 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/xcode/v*/*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain)) \
62 $(if-expr "$(KBUILD_DEVTOOLS_HST_ALT)" != "", \
63 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/CommandLineTools/v*)) \
64 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/xcode/v*/*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain)) ,) \
65 ) \
66 /Library/Developer/CommandLineTools \
67 $(qwildcard ,/Applications/Xcode*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain) \
68 /. \
69 $(DARWINCMN_TOOLCHAIN_DIRS_FALLBACK)
70
71
72## @def DARWINCMN_MACOSX_SDKS_DIRS
73# List of 'SDKs' directories containing MacOSX (macOS) platform SDKs.
74# Users can alter this by setting DARWINCMN_MACOSX_SDKS_DIRS_PREFERRED and DARWINCMN_MACOSX_SDKS_DIRS_FALLBACK.
75DARWINCMN_MACOSX_SDKS_DIRS = $(DARWINCMN_MACOSX_SDKS_DIRS_PREFERRED) \
76 $(if-expr defined(DARWINCMN_MACOSX_SDKS_DIRS_IGNORE_DEVTOOLS),, \
77 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TGT)/SDKs)) \
78 $(if-expr "$(KBUILD_DEVTOOLS_TGT_ALT)" != "", \
79 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TGT_ALT)/SDKs)) ,)\
80 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/CommandLineTools/v*/SDKs)) \
81 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/xcode/v*/*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)) \
82 $(if-expr "$(KBUILD_DEVTOOLS_HST_ALT)" != "", \
83 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/CommandLineTools/v*)) \
84 $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/xcode/v*/*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)) ,) \
85 ) \
86 /Library/Developer/CommandLineTools/SDKs \
87 $(qwildcard ,/Applications/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs) \
88 /Developer/SDKs \
89 $(DARWINCMN_MACOSX_SDKS_DIRS_FALLBACK)
90
91## @def DARWINCMN_FN_FIND_MACOSX_SDK
92# Locate a given SDK.
93# @param 1 SDK name directory (e.g. MacOSX10.15.sdk).
94DARWINCMN_FN_FIND_MACOSX_SDK = $(firstfile $(qwildcard ,$(qaddsuffix ,/$(1),$(DARWINCMN_MACOSX_SDKS_DIRS))))
95## @def DARWINCMN_FN_ERROR_MACOSX_SDK
96# Generate complaint text about SDK that DARWINCMN_FN_FIND_MACOSX_SDK failed to locate.
97# @param 1 SDK name directory (e.g. MacOSX10.15.sdk).
98define DARWINCMN_FN_ERROR_MACOSX_SDK
99Failed to locate the MacOSX SDK '$(1)' directory after checking: $(foreachfile file,$(qaddsuffix ,/$(1),$(DARWINCMN_MACOSX_SDKS_DIRS)),$(NLTAB)$(file))
100Available SDKs: $(rversortfiles $(qnotdir ,$(qwildcard ,$(qaddsuffix ,/Mac*sdk,$(DARWINCMN_MACOSX_SDKS_DIRS)))))
101endef
102
Note: See TracBrowser for help on using the repository browser.