]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.cmd
xnu-1699.22.81.tar.gz
[apple/xnu.git] / makedefs / MakeInc.cmd
1 #
2 # Commands for the build environment
3 #
4 ##
5 # Verbosity
6 ##
7 ifeq ($(RC_XBS),YES)
8 VERBOSE = YES
9 else
10 VERBOSE = NO
11 endif
12 ifeq ($(VERBOSE),YES)
13 _v =
14 _vstdout =
15 else
16 _v = @
17 _vstdout = > /dev/null
18 endif
19
20 ifeq ($(VERBOSE),YES)
21 XCRUN = /usr/bin/xcrun -verbose -log
22 else
23 XCRUN = /usr/bin/xcrun
24 endif
25
26 SDKROOT ?= /
27 HOST_SDKROOT ?= /
28
29 ifeq ($(PLATFORM),)
30 export PLATFORM := $(shell xcodebuild -sdk $(SDKROOT) -version PlatformPath | head -1 | sed 's,^.*/\([^/]*\)\.platform$$,\1,')
31 ifeq ($(PLATFORM),)
32 export PLATFORM := MacOSX
33 endif
34 endif
35
36 # CC/CXX get defined by make(1) by default, so we can't check them
37 # against the empty string to see if they haven't been set
38 ifeq ($(origin CC),default)
39 ifneq ($(findstring iPhone,$(PLATFORM)),)
40 export CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find gcc-4.2)
41 else
42 export CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find cc)
43 endif
44 endif
45 ifeq ($(origin CXX),default)
46 ifneq ($(findstring iPhone,$(PLATFORM)),)
47 export CXX := $(shell $(XCRUN) -sdk $(SDKROOT) -find g++-4.2)
48 else
49 export CXX := $(shell $(XCRUN) -sdk $(SDKROOT) -find c++)
50 endif
51 endif
52 ifeq ($(MIG),)
53 export MIG := $(shell $(XCRUN) -sdk $(SDKROOT) -find mig)
54 endif
55 ifeq ($(MIGCC),)
56 export MIGCC := $(CC)
57 endif
58 ifeq ($(RELPATH),)
59 export RELPATH := $(shell $(XCRUN) -sdk $(SDKROOT) -find relpath)
60 endif
61 ifeq ($(STRIP),)
62 export STRIP := $(shell $(XCRUN) -sdk $(SDKROOT) -find strip)
63 endif
64 ifeq ($(LIPO),)
65 export LIPO := $(shell $(XCRUN) -sdk $(SDKROOT) -find lipo)
66 endif
67 ifeq ($(LIBTOOL),)
68 export LIBTOOL := $(shell $(XCRUN) -sdk $(SDKROOT) -find libtool)
69 endif
70 ifeq ($(NM),)
71 export NM := $(shell $(XCRUN) -sdk $(SDKROOT) -find nm)
72 endif
73 ifeq ($(UNIFDEF),)
74 export UNIFDEF := $(shell $(XCRUN) -sdk $(SDKROOT) -find unifdef)
75 endif
76 ifeq ($(DECOMMENT),)
77 export DECOMMENT := $(shell $(XCRUN) -sdk $(SDKROOT) -find decomment)
78 endif
79 ifeq ($(DSYMUTIL),)
80 export DSYMUTIL := $(shell $(XCRUN) -sdk $(SDKROOT) -find dsymutil)
81 endif
82 ifeq ($(CTFCONVERT),)
83 export CTFCONVERT := $(shell $(XCRUN) -sdk $(SDKROOT) -find ctfconvert)
84 endif
85 ifeq ($(CTFMERGE),)
86 export CTFMERGE := $(shell $(XCRUN) -sdk $(SDKROOT) -find ctfmerge)
87 endif
88 ifeq ($(CTFSCRUB),)
89 export CTFSCRUB := $(shell $(XCRUN) -sdk $(SDKROOT) -find ctfdump) -r
90 endif
91 ifeq ($(NMEDIT),)
92 export NMEDIT := $(shell $(XCRUN) -sdk $(SDKROOT) -find nmedit)
93 endif
94
95 # Platform-specific tools
96 ifneq ($(findstring iPhone,$(PRODUCT)),)
97 ifeq ($(IPHONEOS_OPTIMIZE),)
98 export IPHONEOS_OPTIMIZE := $(shell $(XCRUN) -sdk $(SDKROOT) -find iphoneos-optimize)
99 endif
100 endif
101
102 # Scripts or tools we build ourselves
103 SEG_HACK := $(OBJROOT)/SETUP/setsegname/setsegname
104 KEXT_CREATE_SYMBOL_SET := $(OBJROOT)/SETUP/kextsymboltool/kextsymboltool
105 NEWVERS = $(SRCROOT)/config/newvers.pl
106
107 # Standard BSD tools
108 MD = /usr/bin/md
109 RM = /bin/rm -f
110 CP = /bin/cp
111 MV = /bin/mv
112 LN = /bin/ln -fs
113 CAT = /bin/cat
114 MKDIR = /bin/mkdir -p
115 FIND = /usr/bin/find
116 INSTALL = /usr/bin/install
117 TAR = /usr/bin/gnutar
118 BASENAME = /usr/bin/basename
119 TR = /usr/bin/tr
120
121 # Platform-specific tools
122 ifeq (iPhoneOS,$(PLATFORM))
123 ifeq ($(IPHONEOS_OPTIMIZE),)
124 export IPHONEOS_OPTIMIZE := $(shell $(XCRUN) -sdk $(SDKROOT) -find iphoneos-optimize || echo /usr/bin/true)
125 endif
126 endif
127
128 CTFINSERT = $(XCRUN) -sdk $(SDKROOT) ctf_insert
129
130 #
131 # Command to generate host binaries. Intentionally not
132 # $(CC), which controls the target compiler
133 #
134 ifeq ($(HOST_CC),)
135 export HOST_CC := $(shell $(XCRUN) -sdk $(HOST_SDKROOT) -find cc)
136 endif
137 ifeq ($(HOST_FLEX),)
138 export HOST_FLEX := $(shell $(XCRUN) -sdk $(HOST_SDKROOT) -find flex)
139 endif
140 ifeq ($(HOST_BISON),)
141 export HOST_BISON := $(shell $(XCRUN) -sdk $(HOST_SDKROOT) -find bison)
142 endif
143 ifeq ($(HOST_CODESIGN),)
144 export HOST_CODESIGN := $(shell $(XCRUN) -sdk $(HOST_SDKROOT) -find codesign)
145 endif
146
147 #
148 # Command to build libkmod.a/libkmodc++.a, which are
149 # linked into kext binaries, and should be built as if
150 # they followed system-wide policies
151 #
152 ifeq ($(LIBKMOD_CC),)
153 export LIBKMOD_CC := $(shell $(XCRUN) -sdk $(SDKROOT) -find cc)
154 endif
155
156 # vim: set ft=make: