]> git.saurik.com Git - apple/coreosmakefiles.git/blob - ReleaseControl/Common.make
CoreOSMakefiles-75.tar.gz
[apple/coreosmakefiles.git] / ReleaseControl / Common.make
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
38 ifndef CoreOSMakefiles
39 CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
40 endif
41
42 include $(CoreOSMakefiles)/Standard/Standard.make
43
44 ##
45 # Some reasonable defaults for RC variables
46 ##
47
48 RC_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)
49 RC_RELEASE = unknown
50 RC_VERSION = unknown
51
52 SRCROOT = /tmp/$(ProjectName)/Sources
53 OBJROOT = /tmp/$(ProjectName)/Build
54 SYMROOT = /tmp/$(ProjectName)/Debug
55 DSTROOT = /tmp/$(ProjectName)/Release
56
57 ##
58 # My variables
59 ##
60
61 ifndef Project
62 Project = UNTITLED_PROJECT
63 endif
64
65 ifndef ProjectName
66 ProjectName = $(Project)
67 endif
68
69 ifneq ($(RC_VERSION),unknown)
70 Version = RC_VERSION
71 else
72 Version = $(RC_ProjectSourceVersion)
73 ifeq ($(Version),)
74 Version = 0
75 endif
76 endif
77
78 Sources = $(SRCROOT)
79 Platforms = $(patsubst %,%-apple-rhapsody$(RhapsodyVersion),$(RC_ARCHS:ppc=powerpc))
80 BuildDirectory = $(OBJROOT)
81
82 CC_Archs = $(RC_ARCHS:%=-arch %)
83 #CPP_Defines += -DPROJECT_VERSION=\"$(Project)-$(Version)\"
84
85 Environment += CC="$(CC)"
86 Environment += CXX="$(CXX)"
87
88 ifneq "$(strip $(CFLAGS))" ""
89 Environment += CFLAGS="$(CFLAGS)"
90 endif
91 ifneq "$(strip $(CXXFLAGS))" ""
92 Environment += CCFLAGS="$(CXXFLAGS)" CXXFLAGS="$(CXXFLAGS)"
93 endif
94 ifneq "$(strip $(LDFLAGS))" ""
95 Environment += LDFLAGS="$(LDFLAGS)"
96 endif
97 ifneq "$(strip $(CPPFLAGS))" ""
98 Environment += CPPFLAGS="$(CPPFLAGS)"
99 endif
100 Environment += $(Extra_Environment)
101
102 VPATH=$(Sources)
103
104 ManPageDirectories = /usr/share/man
105
106 ##
107 # Targets
108 ##
109
110 .PHONY: all install installhdrs install_headers lazy_installsrc lazy_install_source installsrc install_source build clean recurse
111
112 all: build
113
114 $(DSTROOT): install
115
116 install:: install_headers build
117
118 # For RC
119 installhdrs:: install_headers
120
121 install_headers::
122
123 lazy_install_source::
124 $(_v) if [ ! -f "$(SRCROOT)/Makefile" ]; then $(MAKE) install_source; fi
125
126 install_source::
127 ifneq ($(CommonNoInstallSource),YES)
128 @echo "Installing source for $(Project)..."
129 $(_v) $(MKDIR) "$(SRCROOT)"
130 $(_v) $(TAR) -cp $(Tar_Cruft) . | $(TAR) -pox -C "$(SRCROOT)"
131 endif
132
133 ifndef ShadowTestFile
134 ShadowTestFile = $(BuildDirectory)/Makefile
135 endif
136
137 shadow_source:: $(ShadowTestFile)
138
139 $(ShadowTestFile):
140 echo "Creating pseudo-copy of sources in the build directory...";
141 $(_v) mkdir -p $(BuildDirectory);
142 $(_v) for dir in $$( cd $(Sources) && $(FIND) . -type d ); do \
143 cd $(BuildDirectory) && if [ ! -d $$dir ]; then $(MKDIR) $$dir; fi; \
144 done
145 $(_v) for file in $$( cd $(Sources) && $(FIND) . -type f ); do \
146 cd $(BuildDirectory) && $(LN) -fs $(Sources)/$$file $$file; \
147 done
148
149 # For RC
150 installsrc: install_source
151
152 build:: lazy_install_source
153
154 clean::
155 @echo "Cleaning $(Project)..."
156 $(_v) $(RMDIR) -f "$(BuildDirectory)" || true
157
158 $(Passed_Targets) $(Extra_Passed_Targets):
159 $(_v) umask $(Install_Mask) ; $(MAKE) -C $(BuildDirectory) $(Environment) $@
160
161 recurse:
162 ifdef SubProjects
163 $(_v) for SubProject in $(SubProjects); do \
164 $(MAKE) -C $$SubProject $(TARGET) \
165 OBJROOT=$(OBJROOT) \
166 SYMROOT=$(SYMROOT) \
167 DSTROOT=$(DSTROOT) \
168 BuildDirectory=$(BuildDirectory)/$${SubProject} \
169 Sources=$(Sources)/$${SubProject} \
170 CoreOSMakefiles=$(CoreOSMakefiles) || exit 1 ; \
171 done
172 endif
173
174 rshowvar: showvar
175 $(_v) $(MAKE) recurse TARGET=rshowvar
176
177 compress_man_pages:
178 @echo "Man pages are no longer compressed. Please remove the compress_man_pages target from your Makefile."