]> git.saurik.com Git - apple/coreosmakefiles.git/blame - ReleaseControl/Common.make
CoreOSMakefiles-64.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
e050961f 52SRCROOT = /tmp/$(ProjectName)/Sources
e050961f
A
53OBJROOT = /tmp/$(ProjectName)/Build
54SYMROOT = /tmp/$(ProjectName)/Debug
55DSTROOT = /tmp/$(ProjectName)/Release
fdbff003
A
56
57##
58# My variables
59##
60
61ifndef Project
62Project = UNTITLED_PROJECT
63endif
64
65ifndef ProjectName
66ProjectName = $(Project)
67endif
68
69ifneq ($(RC_VERSION),unknown)
70Version = RC_VERSION
71else
72Version := $(shell $(VERS_STRING) -f $(Project) 2>/dev/null | cut -d - -f 2)
73ifeq ($(Version),)
74Version = 0
75endif
76endif
77
78Sources = $(SRCROOT)
79Platforms = $(patsubst %,%-apple-rhapsody$(RhapsodyVersion),$(RC_ARCHS:ppc=powerpc))
80BuildDirectory = $(OBJROOT)
81
82CC_Archs = $(RC_ARCHS:%=-arch %)
83#CPP_Defines += -DPROJECT_VERSION=\"$(Project)-$(Version)\"
84
e50bb073
A
85ifneq "$(strip $(CFLAGS))" ""
86Environment += CFLAGS="$(CFLAGS)"
87endif
88ifneq "$(strip $(CXXFLAGS))" ""
89Environment += CCFLAGS="$(CXXFLAGS)" CXXFLAGS="$(CXXFLAGS)"
90endif
91ifneq "$(strip $(LDFLAGS))" ""
92Environment += LDFLAGS="$(LDFLAGS)"
93endif
94ifneq "$(strip $(CPPFLAGS))" ""
95Environment += CPPFLAGS="$(CPPFLAGS)"
96endif
97Environment += $(Extra_Environment)
fdbff003
A
98
99VPATH=$(Sources)
100
a44896e3
A
101ManPageDirectories = /usr/share/man
102
fdbff003
A
103##
104# Targets
105##
106
611bdc3f 107.PHONY: all install installhdrs install_headers lazy_installsrc lazy_install_source installsrc install_source build clean recurse _targetconfig
fdbff003
A
108
109all: build
110
111$(DSTROOT): install
112
611bdc3f
A
113install:: _targetconfig install_headers build
114
115_targetconfig::
116 @PRODUCT="`tconf --product 2>/dev/null`" ; \
117 if [ -z "$$PRODUCT" ]; then \
118 echo "Error: TargetConfig not defined" ; exit 1 ; \
119 else echo "TargetConfig: $$PRODUCT" ; fi
fdbff003
A
120
121# For RC
122installhdrs:: install_headers
123
124install_headers::
125
126lazy_install_source::
127 $(_v) if [ ! -f "$(SRCROOT)/Makefile" ]; then $(MAKE) install_source; fi
128
129install_source::
130ifneq ($(CommonNoInstallSource),YES)
131 @echo "Installing source for $(Project)..."
132 $(_v) $(MKDIR) "$(SRCROOT)"
90a5ffcc 133 $(_v) $(TAR) -cp $(Tar_Cruft) . | $(TAR) -pox -C "$(SRCROOT)"
fdbff003
A
134endif
135
136ifndef ShadowTestFile
137ShadowTestFile = $(BuildDirectory)/Makefile
138endif
139
140shadow_source:: $(ShadowTestFile)
141
142$(ShadowTestFile):
143 echo "Creating pseudo-copy of sources in the build directory...";
144 $(_v) mkdir -p $(BuildDirectory);
145 $(_v) for dir in $$( cd $(Sources) && $(FIND) . -type d ); do \
146 cd $(BuildDirectory) && if [ ! -d $$dir ]; then $(MKDIR) $$dir; fi; \
147 done
148 $(_v) for file in $$( cd $(Sources) && $(FIND) . -type f ); do \
149 cd $(BuildDirectory) && $(LN) -fs $(Sources)/$$file $$file; \
150 done
151
152# For RC
153installsrc: install_source
154
155build:: lazy_install_source
156
157clean::
158 @echo "Cleaning $(Project)..."
611bdc3f 159 $(_v) $(RMDIR) -f "$(BuildDirectory)" || true
fdbff003
A
160
161$(Passed_Targets) $(Extra_Passed_Targets):
162 $(_v) umask $(Install_Mask) ; $(MAKE) -C $(BuildDirectory) $(Environment) $@
163
164recurse:
165ifdef SubProjects
166 $(_v) for SubProject in $(SubProjects); do \
167 $(MAKE) -C $$SubProject $(TARGET) \
611bdc3f
A
168 OBJROOT=$(OBJROOT) \
169 SYMROOT=$(SYMROOT) \
170 DSTROOT=$(DSTROOT) \
fdbff003
A
171 BuildDirectory=$(BuildDirectory)/$${SubProject} \
172 Sources=$(Sources)/$${SubProject} \
859ae4bf 173 CoreOSMakefiles=$(CoreOSMakefiles) || exit 1 ; \
fdbff003
A
174 done
175endif
176
177rshowvar: showvar
178 $(_v) $(MAKE) recurse TARGET=rshowvar
a44896e3
A
179
180compress_man_pages:
181ifneq "$(strip $(ManPageDirectories))" ""
182 @echo "Compressing man pages for $(Project)..."
183 $(_v) $(COMPRESSMANPAGES) $(ManPageDirectories)
184endif