author | ohair |
Tue, 10 Apr 2012 08:22:03 -0700 | |
changeset 12317 | 9670c1610c53 |
permissions | -rw-r--r-- |
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
1 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
2 |
# Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
4 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
10 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
15 |
# accompanied this code). |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
16 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
20 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
23 |
# questions. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
24 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
25 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
26 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
27 |
# Native C/C++ Compile Rules |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
28 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
29 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
30 |
-include $(SPEC) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
31 |
-include $(VARS) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
32 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
33 |
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
34 |
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
35 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
36 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
37 |
# INCREMENTAL_BUILD: Record the #include file dependencies. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
38 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
39 |
# NOTE: We build make include files with the suffix |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
40 |
# $(DEPEND_SUFFIX) on every compilation. These are initially |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
41 |
# created as temp files just in case a ^C kills it in the middle. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
42 |
# Compiler is smart enough to handle ^C and not create the .o file, or |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
43 |
# is supposed to be that smart, but the .$(DEPEND_SUFFIX) file |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
44 |
# creation here isn't. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
45 |
# These .$(DEPEND_SUFFIX) files are included by Library.gmk and |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
46 |
# Program.gmk, when they exist (Search for 'make dependencies'). |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
47 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
48 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
49 |
ifeq ($(INCREMENTAL_BUILD),true) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
50 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
51 |
$(OBJDIR)/%.$(DEPEND_SUFFIX): %.c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
52 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
53 |
@$(ECHO) "Creating $@" |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
54 |
@$(RM) $@.temp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
55 |
@$(CC) $(CC_DEPEND) $(CPPFLAGS) $< 2> $(DEV_NULL) | \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
56 |
$(CC_DEPEND_FILTER) > $@.temp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
57 |
@$(MV) $@.temp $@ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
58 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
59 |
$(OBJDIR)/%.$(DEPEND_SUFFIX): %.cpp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
60 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
61 |
@$(ECHO) "Creating $@" |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
62 |
@$(RM) $@.temp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
63 |
@$(CXX) $(CC_DEPEND) $(CPPFLAGS) $(CXXFLAGS) $< 2> $(DEV_NULL) | \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
64 |
$(CC_DEPEND_FILTER) > $@.temp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
65 |
@$(MV) $@.temp $@ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
66 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
67 |
endif # INCREMENTAL_BUILD |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
68 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
69 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
70 |
# C, C++, asm files. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
71 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
72 |
# Normal or parallel compile rule is the same, but batch compiles require |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
73 |
# we save up the sources files that use the same compile line so that we |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
74 |
# can do one compile line. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
75 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
76 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
77 |
ifneq ($(COMPILE_APPROACH), batch) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
78 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
79 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
80 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
81 |
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
82 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
83 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
84 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.cpp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
85 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
86 |
$(COMPILE.cc) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
87 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
88 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
89 |
else |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
90 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
91 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
92 |
# Batch compiling might be faster if the compiler was smart about recognizing |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
93 |
# optimization opportunities available when all files are being compiled |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
94 |
# the same way. Unfortunately this is rare. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
95 |
# Automatic pre-compiled headers (pch) might be a possibility so we |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
96 |
# add any auto pch options here. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
97 |
# So we save all the source files that have the same compile line as the |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
98 |
# first file. A normal compile pass is made after the batch compile |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
99 |
# to catch anything missed. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
100 |
# If the compilers had a -o option that allowed us to direct where to |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
101 |
# write the object files to, then we would not need to save the object |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
102 |
# file list or move them from the make directory to the build directory. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
103 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
104 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
105 |
# Source names |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
106 |
COMPILE_LIST.c = $(OBJDIR)/.source_names_c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
107 |
COMPILE_LIST.cpp = $(OBJDIR)/.source_names_cpp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
108 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
109 |
# Object file list |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
110 |
COMPILE_OBJ_LIST.c = $(OBJDIR)/.obj_names_c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
111 |
COMPILE_OBJ_LIST.cpp = $(OBJDIR)/.obj_names_cpp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
112 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
113 |
# The compile line |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
114 |
COMPILE_BATCH.c = $(OBJDIR)/.compile_c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
115 |
COMPILE_BATCH.cpp = $(OBJDIR)/.compile_cpp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
116 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
117 |
# The compile line for the current target |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
118 |
THIS_COMPILE_BATCH.c = $(COMPILE_BATCH.c)-$(@F) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
119 |
THIS_COMPILE_BATCH.cpp = $(COMPILE_BATCH.cpp)-$(@F) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
120 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
121 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
122 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
123 |
@$(ECHO) "$(COMPILE.c) $(CFLAGS_GPROF)" > $(THIS_COMPILE_BATCH.c) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
124 |
@if [ ! -s $(COMPILE_BATCH.c) ] ; then \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
125 |
$(CP) $(THIS_COMPILE_BATCH.c) $(COMPILE_BATCH.c) ; \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
126 |
$(ECHO) $< > $(COMPILE_LIST.c); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
127 |
$(ECHO) $(@F) > $(COMPILE_OBJ_LIST.c); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
128 |
elif [ "`$(DIFF) -w -b $(THIS_COMPILE_BATCH.c) $(COMPILE_BATCH.c)`" \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
129 |
= "" ] ; then \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
130 |
$(ECHO) $< >> $(COMPILE_LIST.c); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
131 |
$(ECHO) $(@F) >> $(COMPILE_OBJ_LIST.c); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
132 |
fi |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
133 |
@$(RM) $(THIS_COMPILE_BATCH.c) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
134 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
135 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
136 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.cpp |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
137 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
138 |
@$(ECHO) "$(COMPILE.cc) $(CFLAGS_GPROF)" > $(THIS_COMPILE_BATCH.cpp) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
139 |
@if [ ! -s $(COMPILE_BATCH.cpp) ] ; then \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
140 |
$(CP) $(THIS_COMPILE_BATCH.cpp) $(COMPILE_BATCH.cpp) ; \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
141 |
$(ECHO) $< > $(COMPILE_LIST.cpp); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
142 |
$(ECHO) $(@F) > $(COMPILE_OBJ_LIST.cpp); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
143 |
elif [ "`$(DIFF) -w -b $(THIS_COMPILE_BATCH.cpp) $(COMPILE_BATCH.cpp)`"\ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
144 |
= "" ] ; then \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
145 |
$(ECHO) $< >> $(COMPILE_LIST.cpp); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
146 |
$(ECHO) $(@F) >> $(COMPILE_OBJ_LIST.cpp); \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
147 |
fi |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
148 |
@$(RM) $(THIS_COMPILE_BATCH.cpp) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
149 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
150 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
151 |
batch_compile: $(FILES_o) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
152 |
@$(ECHO) "Doing batch compilations" |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
153 |
@if [ -s $(COMPILE_LIST.c) ] ; then \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
154 |
$(ECHO) "$(COMPILE.c) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
155 |
`$(CAT) $(COMPILE_LIST.c)`" ; \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
156 |
( $(COMPILE.c) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
157 |
`$(CAT) $(COMPILE_LIST.c)` && \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
158 |
$(ECHO) "$(MV) `$(CAT) $(COMPILE_OBJ_LIST.c)` $(OBJDIR)" && \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
159 |
$(MV) `$(CAT) $(COMPILE_OBJ_LIST.c)` $(OBJDIR) ) || exit 1 ; \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
160 |
fi |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
161 |
@if [ -s $(COMPILE_LIST.cpp) ] ; then \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
162 |
$(ECHO) "$(COMPILE.cc) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
163 |
`$(CAT) $(COMPILE_LIST.cpp)`" ; \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
164 |
( $(COMPILE.cc) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
165 |
`$(CAT) $(COMPILE_LIST.cpp)` && \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
166 |
$(ECHO) "$(MV) `$(CAT) $(COMPILE_OBJ_LIST.cpp)` $(OBJDIR)" && \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
167 |
$(MV) `$(CAT) $(COMPILE_OBJ_LIST.cpp)` $(OBJDIR) ) || exit 1 ; \ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
168 |
fi |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
169 |
@$(RM) $(COMPILE_BATCH.c) $(COMPILE_LIST.c) $(COMPILE_OBJ_LIST.c) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
170 |
@$(RM) $(COMPILE_BATCH.cpp) $(COMPILE_LIST.cpp) $(COMPILE_OBJ_LIST.cpp) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
171 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
172 |
endif |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
173 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
174 |
# newer as does not handle c++ style comments |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
175 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.s |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
176 |
ifneq ($(CC_VERSION), gcc) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
177 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
178 |
$(COMPILE.s) $(CC_OBJECT_OUTPUT_FLAG)$@ $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
179 |
else |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
180 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
181 |
$(CPP) -x assembler-with-cpp $< | $(COMPILE.s) -o $@ |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
182 |
endif |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
183 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
184 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
185 |
# Obj-C files (Mac OS X only). |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
186 |
ifeq ($(PLATFORM), macosx) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
187 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.m |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
188 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
189 |
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
190 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
191 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
192 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.mm |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
193 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
194 |
$(COMPILE.cc) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
195 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
196 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
197 |
$(OBJDIR)/%.$(OBJECT_SUFFIX): %.c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
198 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
199 |
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
200 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
201 |
endif # PLATFORM |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
202 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
203 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
204 |
# Quick hack for making the compiler generate just the assembly file. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
205 |
# $ gnumake obj/sparc/myfile.s |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
206 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
207 |
$(OBJDIR)/%.s: %.c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
208 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
209 |
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ -S $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
210 |
@$(check-conventions) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
211 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
212 |
# remove the intermediate files from the directories. |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
213 |
# (If VARIANT=OPT, this removes all debug and fastdebug files too) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
214 |
clobber clean:: |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
215 |
$(RM) -r $(OBJDIR) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
216 |
$(RM) -r $(OBJDIR)_* |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
217 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
218 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
219 |
# Lint support |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
220 |
# (The 'lint' rule below is an older rule not using the .$(LINT_SUFFIX) files) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
221 |
# |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
222 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
223 |
ifeq ($(PLATFORM), solaris) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
224 |
$(OBJDIR)/%.$(LINT_SUFFIX): %.c |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
225 |
@$(prep-target) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
226 |
$(LINT.c) -dirout=$(OBJDIR) -c $< |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
227 |
lint.clean: |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
228 |
$(RM) $(OBJDIR)/*.$(LINT_SUFFIX) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
229 |
# Old rule |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
230 |
lint: $(FILES_c) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
231 |
ifneq ($(FILES_c),) |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
232 |
$(LINT.c) -Ncheck -Nlevel=3 $? $(LDLIBS) > lint.$(ARCH) 2>&1 |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
233 |
endif |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
234 |
endif |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
235 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
236 |
.PHONY: batch_compile |
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
237 |
|
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
238 |