-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
GNUSource.make
186 lines (161 loc) · 5.64 KB
/
GNUSource.make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
## -*- Makefile -*-
# Makefile for Apple Release Control (GNU source projects)
#
# Wilfredo Sanchez | [email protected]
# Copyright (c) 1997-1999 Apple Computer, Inc.
#
# @APPLE_LICENSE_HEADER_START@
#
# Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
# Reserved. This file contains Original Code and/or Modifications of
# Original Code as defined in and that are subject to the Apple Public
# Source License Version 1.1 (the "License"). You may not use this file
# except in compliance with the License. Please obtain a copy of the
# License at http://www.apple.com/publicsource and read it before using
# this file.
#
# The Original Code and all software distributed under the License are
# distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
# License for the specific language governing rights and limitations
# under the License.
#
# @APPLE_LICENSE_HEADER_END@
##
# Set these variables as needed, then include this file, then:
#
# Install_Prefix [ $(USRDIR) ]
# Install_Man [ $(MANDIR) ]
# Install_Info [ $(SHAREDIR)/info ]
# Install_HTML [ <depends> ]
# Install_Source [ $(NSSOURCEDIR)/Commands/$(ProjectName) ]
# Configure [ $(Sources)/configure ]
# Extra_Configure_Flags
# Extra_Install_Flags
# Passed_Targets [ check ]
#
# Additional variables inherited from ReleaseControl/Common.make
##
NCPU := "-j`sysctl -n hw.activecpu`"
ifndef CoreOSMakefiles
CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
endif
Passed_Targets += check
include $(CoreOSMakefiles)/ReleaseControl/Common.make
##
# My variables
##
Sources = $(SRCROOT)/$(Project)
ConfigStamp = $(BuildDirectory)/configure-stamp
Workaround_3678855 = /BogusHTMLInstallationDir
ifndef Install_Prefix
Install_Prefix = $(USRDIR)
endif
ifndef Install_Man
Install_Man = $(MANDIR)
endif
ifndef Install_Info
Install_Info = $(SHAREDIR)/info
endif
ifndef Install_HTML
ifeq "$(UserType)" "Developer"
Install_HTML = $(Workaround_3678855)
else
Install_HTML = $(NSDOCUMENTATIONDIR)/$(ToolType)/$(ProjectName)
endif
endif
ifndef Install_Source
Install_Source = $(NSSOURCEDIR)/$(ToolType)/$(ProjectName)
endif
RC_Install_Prefix = $(DSTROOT)$(Install_Prefix)
RC_Install_Man = $(DSTROOT)$(Install_Man)
RC_Install_Info = $(DSTROOT)$(Install_Info)
RC_Install_HTML = $(DSTROOT)$(Install_HTML)
ifneq ($(Install_Source),)
RC_Install_Source = $(DSTROOT)$(Install_Source)
endif
ifndef Configure
Configure = $(Sources)/configure
endif
Environment += TEXI2HTML="$(TEXI2HTML) -subdir ."
Environment += CC="$(CC) -arch $$arch" CXX="$(CXX) -arch $$arch"
Environment += AS="$(AS) -arch $$arch" LD="$(LD) -arch $$arch"
Environment += NM="nm -arch $$arch"
Environment += AR=$(AR) STRIP=$(STRIP) RANLIB=ranlib
CC_Archs = # set by CC
# FIXME: Common.make shouldn't be setting this in the first place.
Extra_CC_Flags =
# -arch arguments are different than configure arguments. We need to
# translate them.
TRANSLATE_ARCH=$(SED) -e s/ppc/powerpc/ -e s/i386/i686/
# Could use config.guess here, if we had a copy available.
BUILD=`$(ARCH) | $(TRANSLATE_ARCH)`-apple-darwin
Configure_Flags = --prefix="$(Install_Prefix)" \
--mandir="$(Install_Man)" \
--infodir="$(Install_Info)" \
--build=$(BUILD) \
--host=`echo $$arch | $(TRANSLATE_ARCH)`-apple-darwin \
$(Extra_Configure_Flags)
Install_Flags = DESTDIR=$(BuildDirectory)/install-$$arch \
$(Extra_Install_Flags)
Install_Target = install-strip
##
# Targets
##
.PHONY: configure almostclean
install:: build
ifneq ($(GnuNoInstall),YES)
$(_v) for arch in $(RC_ARCHS) ; do \
echo "Installing $(Project) for $$arch..." && \
$(MKDIR) $(BuildDirectory)/install-$$arch && \
umask $(Install_Mask) && \
$(MAKE) $(NCPU) -C $(BuildDirectory)/$$arch $(Environment) \
$(Install_Flags) $(Install_Target) || exit 1 ; \
done
rm -rf "$(BuildDirectory)/install-x86_64/./usr/local/lib"
./merge-lipo `for arch in $(RC_ARCHS) ; do echo $(BuildDirectory)/install-$$arch ; done` $(DSTROOT)
$(_v) $(FIND) $(DSTROOT) $(Find_Cruft) | $(XARGS) $(RMDIR)
$(_v) $(FIND) $(SYMROOT) $(Find_Cruft) | $(XARGS) $(RMDIR)
ifneq ($(GnuNoChown),YES)
$(_v)- $(CHOWN) -R $(Install_User):$(Install_Group) $(DSTROOT) $(SYMROOT)
endif
endif
ifdef GnuAfterInstall
$(_v) $(MAKE) $(GnuAfterInstall)
endif
$(_v) if [ -d "$(DSTROOT)$(Workaround_3678855)" ]; then \
$(INSTALL_DIRECTORY) "$(DSTROOT)$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)"; \
$(MV) "$(DSTROOT)$(Workaround_3678855)" \
"$(DSTROOT)$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)/$(ProjectName)"; \
fi
build:: configure
ifneq ($(GnuNoBuild),YES)
$(_v) for arch in $(RC_ARCHS) ; do \
echo "Building $(Project) for $$arch..." && \
$(MAKE) $(NCPU) -C $(BuildDirectory)/$$arch $(Environment) || exit 1; \
done
endif
configure:: lazy_install_source $(ConfigStamp)
reconfigure::
$(_v) $(RM) $(ConfigStamp)
$(_v) $(MAKE) configure
$(ConfigStamp):
ifneq ($(GnuNoConfigure),YES)
$(_v) $(MKDIR) $(BuildDirectory)
$(_v) for arch in $(RC_ARCHS) ; do \
echo "Configuring $(Project) for $$arch..." && \
$(MKDIR) $(BuildDirectory)/$$arch && \
cd $(BuildDirectory)/$$arch && \
$(Environment) $(Configure) $(Configure_Flags) || exit 1 ; \
done
endif
$(_v) touch $@
almostclean::
ifneq ($(GnuNoClean),YES)
@echo "Cleaning $(Project)..."
$(_v) for arch in $(RC_ARCHS) ; do \
$(MAKE) -C $(BuildDirectory)/$$arch clean || exit 1 ; \
done
endif