]> git.saurik.com Git - apple/coreosmakefiles.git/blame - ReleaseControl/Common.make
CoreOSMakefiles-30.tar.gz
[apple/coreosmakefiles.git] / ReleaseControl / Common.make
CommitLineData
fdbff003
A
1##
2# Makefile for Apple Release Control (common)
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# Project [ UNTITLED_PROJECT ]
30# ProjectName [ $(Project) ]
31# SubProjects
32# Extra_Environment
33# Passed_Targets
34#
35# Additional variables inherited from Standard/Standard.make
36##
37
38ifndef CoreOSMakefiles
39CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
40endif
41
42include $(CoreOSMakefiles)/Standard/Standard.make
43
44##
45# Some reasonable defaults for RC variables
46##
47
e50bb073 48RC_ARCHS = $(shell for i in `file /usr/lib/libSystem.B.dylib | grep 'shared library ' | sed 's|.*shared library ||'`; do $(CC) -arch $$i -E -x c /dev/null > /dev/null 2>&1 && echo $$i; done)
fdbff003
A
49RC_RELEASE = unknown
50RC_VERSION = unknown
51
52ifeq ($(COPY_SOURCES),YES)
e050961f 53SRCROOT = /tmp/$(ProjectName)/Sources
fdbff003
A
54else
55SRCROOT = $(shell pwd)
56endif
57
e050961f
A
58OBJROOT = /tmp/$(ProjectName)/Build
59SYMROOT = /tmp/$(ProjectName)/Debug
60DSTROOT = /tmp/$(ProjectName)/Release
fdbff003
A
61
62##
63# My variables
64##
65
66ifndef Project
67Project = UNTITLED_PROJECT
68endif
69
70ifndef ProjectName
71ProjectName = $(Project)
72endif
73
74ifneq ($(RC_VERSION),unknown)
75Version = RC_VERSION
76else
77Version := $(shell $(VERS_STRING) -f $(Project) 2>/dev/null | cut -d - -f 2)
78ifeq ($(Version),)
79Version = 0
80endif
81endif
82
83Sources = $(SRCROOT)
84Platforms = $(patsubst %,%-apple-rhapsody$(RhapsodyVersion),$(RC_ARCHS:ppc=powerpc))
85BuildDirectory = $(OBJROOT)
86
87CC_Archs = $(RC_ARCHS:%=-arch %)
88#CPP_Defines += -DPROJECT_VERSION=\"$(Project)-$(Version)\"
89
90Extra_CC_Flags += $(RC_CFLAGS)
91
e50bb073
A
92ifneq "$(strip $(CFLAGS))" ""
93Environment += CFLAGS="$(CFLAGS)"
94endif
95ifneq "$(strip $(CXXFLAGS))" ""
96Environment += CCFLAGS="$(CXXFLAGS)" CXXFLAGS="$(CXXFLAGS)"
97endif
98ifneq "$(strip $(LDFLAGS))" ""
99Environment += LDFLAGS="$(LDFLAGS)"
100endif
101ifneq "$(strip $(CPPFLAGS))" ""
102Environment += CPPFLAGS="$(CPPFLAGS)"
103endif
104Environment += $(Extra_Environment)
fdbff003
A
105
106VPATH=$(Sources)
107
108##
109# Targets
110##
111
112.PHONY: all install installhdrs install_headers lazy_installsrc lazy_install_source installsrc install_source build clean recurse
113
114all: build
115
116$(DSTROOT): install
117
118install:: install_headers build
119
120# For RC
121installhdrs:: install_headers
122
123install_headers::
124
125lazy_install_source::
126 $(_v) if [ ! -f "$(SRCROOT)/Makefile" ]; then $(MAKE) install_source; fi
127
128install_source::
129ifneq ($(CommonNoInstallSource),YES)
130 @echo "Installing source for $(Project)..."
131 $(_v) $(MKDIR) "$(SRCROOT)"
132ifneq ($(wildcard $(PAX)),)
133 $(_v) $(PAX) -rw . "$(SRCROOT)"
134else
135 $(_v) $(TAR) cf - . | (cd "$(SRCROOT)" ; $(TAR) xfp -)
136endif
137 $(_v) $(FIND) "$(SRCROOT)" $(Find_Cruft) | $(XARGS) $(RMDIR)
138endif
139
140ifndef ShadowTestFile
141ShadowTestFile = $(BuildDirectory)/Makefile
142endif
143
144shadow_source:: $(ShadowTestFile)
145
146$(ShadowTestFile):
147 echo "Creating pseudo-copy of sources in the build directory...";
148 $(_v) mkdir -p $(BuildDirectory);
149 $(_v) for dir in $$( cd $(Sources) && $(FIND) . -type d ); do \
150 cd $(BuildDirectory) && if [ ! -d $$dir ]; then $(MKDIR) $$dir; fi; \
151 done
152 $(_v) for file in $$( cd $(Sources) && $(FIND) . -type f ); do \
153 cd $(BuildDirectory) && $(LN) -fs $(Sources)/$$file $$file; \
154 done
155
156# For RC
157installsrc: install_source
158
159build:: lazy_install_source
160
161clean::
162 @echo "Cleaning $(Project)..."
163 $(_v) $(RMDIR) -f "$(BuildDirectory)"
164
165$(Passed_Targets) $(Extra_Passed_Targets):
166 $(_v) umask $(Install_Mask) ; $(MAKE) -C $(BuildDirectory) $(Environment) $@
167
168recurse:
169ifdef SubProjects
170 $(_v) for SubProject in $(SubProjects); do \
171 $(MAKE) -C $$SubProject $(TARGET) \
172 BuildDirectory=$(BuildDirectory)/$${SubProject} \
173 Sources=$(Sources)/$${SubProject} \
174 CoreOSMakefiles=$(CoreOSMakefiles); \
175 done
176endif
177
178rshowvar: showvar
179 $(_v) $(MAKE) recurse TARGET=rshowvar