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