2 # Makefile for Apple Release Control (common)
4 # Wilfredo Sanchez | wsanchez@apple.com
5 # Copyright (c) 1997-1999 Apple Computer, Inc.
7 # @APPLE_LICENSE_HEADER_START@
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
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
25 # @APPLE_LICENSE_HEADER_END@
27 # Set these variables as needed, then include this file, then:
29 # Project [ UNTITLED_PROJECT ]
30 # ProjectName [ $(Project) ]
35 # Additional variables inherited from Standard/Standard.make
38 ifndef CoreOSMakefiles
39 CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
42 include $(CoreOSMakefiles)/Standard/Standard.make
45 # Some reasonable defaults for RC variables
48 RC_ARCHS = $(shell file /usr/lib/libSystem.B.dylib | grep 'shared library ' | sed 's|.*shared library ||')
52 ifeq ($(COPY_SOURCES),YES)
53 SRCROOT = /tmp/$(ProjectName)/Sources
55 SRCROOT = $(shell pwd)
58 OBJROOT = /tmp/$(ProjectName)/Build
59 SYMROOT = /tmp/$(ProjectName)/Debug
60 DSTROOT = /tmp/$(ProjectName)/Release
67 Project = UNTITLED_PROJECT
71 ProjectName = $(Project)
74 ifneq ($(RC_VERSION),unknown)
77 Version := $(shell $(VERS_STRING) -f $(Project) 2>/dev/null | cut -d - -f 2)
84 Platforms = $(patsubst %,%-apple-rhapsody$(RhapsodyVersion),$(RC_ARCHS:ppc=powerpc))
85 BuildDirectory = $(OBJROOT)
87 CC_Archs = $(RC_ARCHS:%=-arch %)
88 #CPP_Defines += -DPROJECT_VERSION=\"$(Project)-$(Version)\"
90 Extra_CC_Flags += $(RC_CFLAGS)
92 Environment = CFLAGS="$(CFLAGS)" \
93 CCFLAGS="$(CXXFLAGS)" \
94 CXXFLAGS="$(CXXFLAGS)" \
95 LDFLAGS="$(LDFLAGS)" \
104 .PHONY: all install installhdrs install_headers lazy_installsrc lazy_install_source installsrc install_source build clean recurse
110 install:: install_headers build
113 installhdrs:: install_headers
117 lazy_install_source::
118 $(_v) if [ ! -f "$(SRCROOT)/Makefile" ]; then $(MAKE) install_source; fi
121 ifneq ($(CommonNoInstallSource),YES)
122 @echo "Installing source for $(Project)..."
123 $(_v) $(MKDIR) "$(SRCROOT)"
124 ifneq ($(wildcard $(PAX)),)
125 $(_v) $(PAX) -rw . "$(SRCROOT)"
127 $(_v) $(TAR) cf - . | (cd "$(SRCROOT)" ; $(TAR) xfp -)
129 $(_v) $(FIND) "$(SRCROOT)" $(Find_Cruft) | $(XARGS) $(RMDIR)
132 ifndef ShadowTestFile
133 ShadowTestFile = $(BuildDirectory)/Makefile
136 shadow_source:: $(ShadowTestFile)
139 echo "Creating pseudo-copy of sources in the build directory...";
140 $(_v) mkdir -p $(BuildDirectory);
141 $(_v) for dir in $$( cd $(Sources) && $(FIND) . -type d ); do \
142 cd $(BuildDirectory) && if [ ! -d $$dir ]; then $(MKDIR) $$dir; fi; \
144 $(_v) for file in $$( cd $(Sources) && $(FIND) . -type f ); do \
145 cd $(BuildDirectory) && $(LN) -fs $(Sources)/$$file $$file; \
149 installsrc: install_source
151 build:: lazy_install_source
154 @echo "Cleaning $(Project)..."
155 $(_v) $(RMDIR) -f "$(BuildDirectory)"
157 $(Passed_Targets) $(Extra_Passed_Targets):
158 $(_v) umask $(Install_Mask) ; $(MAKE) -C $(BuildDirectory) $(Environment) $@
162 $(_v) for SubProject in $(SubProjects); do \
163 $(MAKE) -C $$SubProject $(TARGET) \
164 BuildDirectory=$(BuildDirectory)/$${SubProject} \
165 Sources=$(Sources)/$${SubProject} \
166 CoreOSMakefiles=$(CoreOSMakefiles); \
171 $(_v) $(MAKE) recurse TARGET=rshowvar