make/common/internal/NativeCompileRules.gmk

changeset 196
0a91416c1402
parent 189
3821536d79ab
parent 195
d6297db2b9dd
child 197
ae60f98d2f42
     1.1 --- a/make/common/internal/NativeCompileRules.gmk	Tue Sep 07 15:16:24 2010 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,214 +0,0 @@
     1.4 -#
     1.5 -# Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
     1.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 -#
     1.8 -# This code is free software; you can redistribute it and/or modify it
     1.9 -# under the terms of the GNU General Public License version 2 only, as
    1.10 -# published by the Free Software Foundation.  Oracle designates this
    1.11 -# particular file as subject to the "Classpath" exception as provided
    1.12 -# by Oracle in the LICENSE file that accompanied this code.
    1.13 -#
    1.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 -# version 2 for more details (a copy is included in the LICENSE file that
    1.18 -# accompanied this code).
    1.19 -#
    1.20 -# You should have received a copy of the GNU General Public License version
    1.21 -# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 -#
    1.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 -# or visit www.oracle.com if you need additional information or have any
    1.26 -# questions.
    1.27 -#
    1.28 -
    1.29 -#
    1.30 -# Native C/C++ Compile Rules
    1.31 -#
    1.32 -
    1.33 -#
    1.34 -# INCREMENTAL_BUILD: Record the #include file dependencies.
    1.35 -#
    1.36 -# NOTE: We build make include files with the suffix
    1.37 -#       $(DEPEND_SUFFIX) on every compilation. These are initially 
    1.38 -#       created as temp files just in case a ^C kills it in the middle.
    1.39 -#	Compiler is smart enough to handle ^C and not create the .o file, or
    1.40 -#	is supposed to be that smart, but the .$(DEPEND_SUFFIX) file 
    1.41 -#       creation here isn't.
    1.42 -#	These .$(DEPEND_SUFFIX) files are included by Library.gmk and 
    1.43 -#       Program.gmk, when they exist (Search for 'make dependencies').
    1.44 -#
    1.45 -
    1.46 -ifeq ($(INCREMENTAL_BUILD),true)
    1.47 -
    1.48 -$(OBJDIR)/%.$(DEPEND_SUFFIX): %.c
    1.49 -	@$(prep-target)
    1.50 -	@$(ECHO) "Creating $@"
    1.51 -	@$(RM) $@.temp
    1.52 -	@$(CC) $(CC_DEPEND) $(CPPFLAGS) $< 2> $(DEV_NULL) | \
    1.53 -	    $(CC_DEPEND_FILTER) > $@.temp
    1.54 -	@$(MV) $@.temp $@
    1.55 -
    1.56 -$(OBJDIR)/%.$(DEPEND_SUFFIX): %.cpp
    1.57 -	@$(prep-target)
    1.58 -	@$(ECHO) "Creating $@"
    1.59 -	@$(RM) $@.temp
    1.60 -	@$(CXX) $(CC_DEPEND) $(CPPFLAGS) $(CXXFLAGS) $< 2> $(DEV_NULL) | \
    1.61 -	    $(CC_DEPEND_FILTER) > $@.temp
    1.62 -	@$(MV) $@.temp $@
    1.63 -
    1.64 -endif # INCREMENTAL_BUILD
    1.65 -
    1.66 -#
    1.67 -# C, C++, asm files.
    1.68 -#
    1.69 -# Normal or parallel compile rule is the same, but batch compiles require
    1.70 -#  we save up the sources files that use the same compile line so that we
    1.71 -#  can do one compile line.
    1.72 -#
    1.73 -
    1.74 -ifneq ($(COMPILE_APPROACH), batch)
    1.75 -
    1.76 -$(OBJDIR)/%.$(OBJECT_SUFFIX): %.c
    1.77 -	@$(prep-target)
    1.78 -	$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $<
    1.79 -	@$(check-conventions)
    1.80 -
    1.81 -$(OBJDIR)/%.$(OBJECT_SUFFIX): %.cpp
    1.82 -	@$(prep-target)
    1.83 -	$(COMPILE.cc) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $<
    1.84 -	@$(check-conventions)
    1.85 -
    1.86 -else
    1.87 -  
    1.88 -  #
    1.89 -  # Batch compiling might be faster if the compiler was smart about recognizing
    1.90 -  #   optimization opportunities available when all files are being compiled
    1.91 -  #   the same way. Unfortunately this is rare.
    1.92 -  #   Automatic pre-compiled headers (pch) might be a possibility so we
    1.93 -  #   add any auto pch options here.
    1.94 -  # So we save all the source files that have the same compile line as the
    1.95 -  #   first file. A normal compile pass is made after the batch compile
    1.96 -  #   to catch anything missed.
    1.97 -  # If the compilers had a -o option that allowed us to direct where to
    1.98 -  #   write the object files to, then we would not need to save the object
    1.99 -  #   file list or move them from the make directory to the build directory.
   1.100 -  #
   1.101 -
   1.102 -  # Source names
   1.103 -  COMPILE_LIST.c         = $(OBJDIR)/.source_names_c
   1.104 -  COMPILE_LIST.cpp       = $(OBJDIR)/.source_names_cpp
   1.105 -
   1.106 -  # Object file list
   1.107 -  COMPILE_OBJ_LIST.c     = $(OBJDIR)/.obj_names_c
   1.108 -  COMPILE_OBJ_LIST.cpp   = $(OBJDIR)/.obj_names_cpp
   1.109 -  
   1.110 -  # The compile line
   1.111 -  COMPILE_BATCH.c        = $(OBJDIR)/.compile_c
   1.112 -  COMPILE_BATCH.cpp      = $(OBJDIR)/.compile_cpp
   1.113 -
   1.114 -  # The compile line for the current target
   1.115 -  THIS_COMPILE_BATCH.c   = $(COMPILE_BATCH.c)-$(@F)
   1.116 -  THIS_COMPILE_BATCH.cpp = $(COMPILE_BATCH.cpp)-$(@F)
   1.117 -
   1.118 -$(OBJDIR)/%.$(OBJECT_SUFFIX): %.c
   1.119 -	@$(prep-target)
   1.120 -	@$(ECHO) "$(COMPILE.c) $(CFLAGS_GPROF)" > $(THIS_COMPILE_BATCH.c)
   1.121 -	@if [ ! -s $(COMPILE_BATCH.c) ] ; then \
   1.122 -	  $(CP) $(THIS_COMPILE_BATCH.c) $(COMPILE_BATCH.c) ; \
   1.123 -	  $(ECHO) $< > $(COMPILE_LIST.c); \
   1.124 -	  $(ECHO) $(@F) > $(COMPILE_OBJ_LIST.c); \
   1.125 -	elif [ "`$(DIFF) -w -b $(THIS_COMPILE_BATCH.c) $(COMPILE_BATCH.c)`" \
   1.126 -	       = "" ] ; then \
   1.127 -	  $(ECHO) $< >> $(COMPILE_LIST.c); \
   1.128 -	  $(ECHO) $(@F) >> $(COMPILE_OBJ_LIST.c); \
   1.129 -	fi
   1.130 -	@$(RM) $(THIS_COMPILE_BATCH.c)
   1.131 -	@$(check-conventions)
   1.132 -
   1.133 -$(OBJDIR)/%.$(OBJECT_SUFFIX): %.cpp
   1.134 -	@$(prep-target)
   1.135 -	@$(ECHO) "$(COMPILE.cpp) $(CFLAGS_GPROF)" > $(THIS_COMPILE_BATCH.cpp)
   1.136 -	@if [ ! -s $(COMPILE_BATCH.cpp) ] ; then \
   1.137 -	  $(CP) $(THIS_COMPILE_BATCH.cpp) $(COMPILE_BATCH.cpp) ; \
   1.138 -	  $(ECHO) $< > $(COMPILE_LIST.cpp); \
   1.139 -	  $(ECHO) $(@F) > $(COMPILE_OBJ_LIST.cpp); \
   1.140 -	elif [ "`$(DIFF) -w -b $(THIS_COMPILE_BATCH.cpp) $(COMPILE_BATCH.cpp)`"\
   1.141 -	       = "" ] ; then \
   1.142 -	  $(ECHO) $< >> $(COMPILE_LIST.cpp); \
   1.143 -	  $(ECHO) $(@F) >> $(COMPILE_OBJ_LIST.cpp); \
   1.144 -	fi
   1.145 -	@$(RM) $(THIS_COMPILE_BATCH.cpp)
   1.146 -	@$(check-conventions)
   1.147 -
   1.148 -batch_compile: $(FILES_o)
   1.149 -	@$(ECHO) "Doing batch compilations"
   1.150 -	@if [ -s $(COMPILE_LIST.c) ] ; then \
   1.151 -	  $(ECHO) "$(COMPILE.c) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \
   1.152 -	   `$(CAT) $(COMPILE_LIST.c)`" ; \
   1.153 -	  ( $(COMPILE.c) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \
   1.154 -	    `$(CAT) $(COMPILE_LIST.c)` && \
   1.155 -	    $(ECHO) "$(MV) `$(CAT) $(COMPILE_OBJ_LIST.c)` $(OBJDIR)" && \
   1.156 -	    $(MV) `$(CAT) $(COMPILE_OBJ_LIST.c)` $(OBJDIR) ) || exit 1 ; \
   1.157 -	fi
   1.158 -	@if [ -s $(COMPILE_LIST.cpp) ] ; then \
   1.159 -	  $(ECHO) "$(COMPILE.cpp) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \
   1.160 -	   `$(CAT) $(COMPILE_LIST.cpp)`" ; \
   1.161 -	  ( $(COMPILE.cpp) $(CFLAGS_GPROF) $(AUTOMATIC_PCH_OPTION) \
   1.162 -	    `$(CAT) $(COMPILE_LIST.cpp)` && \
   1.163 -	    $(ECHO) "$(MV) `$(CAT) $(COMPILE_OBJ_LIST.cpp)` $(OBJDIR)" && \
   1.164 -	    $(MV) `$(CAT) $(COMPILE_OBJ_LIST.cpp)` $(OBJDIR) ) || exit 1 ; \
   1.165 -	fi
   1.166 -	@$(RM) $(COMPILE_BATCH.c)   $(COMPILE_LIST.c)   $(COMPILE_OBJ_LIST.c)
   1.167 -	@$(RM) $(COMPILE_BATCH.cpp) $(COMPILE_LIST.cpp) $(COMPILE_OBJ_LIST.cpp)
   1.168 -
   1.169 -endif
   1.170 -
   1.171 -# newer as does not handle c++ style comments
   1.172 -$(OBJDIR)/%.$(OBJECT_SUFFIX): %.s
   1.173 -    ifneq ($(CC_VERSION), gcc)
   1.174 -	@$(prep-target)
   1.175 -	$(COMPILE.s) $(CC_OBJECT_OUTPUT_FLAG)$@ $<
   1.176 -    else
   1.177 -	@$(prep-target)
   1.178 -	$(CPP) -x assembler-with-cpp $< | $(COMPILE.s) -o $@
   1.179 -    endif
   1.180 -	@$(check-conventions)
   1.181 -
   1.182 -#
   1.183 -# Quick hack for making the compiler generate just the assembly file.
   1.184 -#	$ gnumake obj/sparc/myfile.s
   1.185 -#
   1.186 -$(OBJDIR)/%.s: %.c
   1.187 -	@$(prep-target)
   1.188 -	$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ -S $<
   1.189 -	@$(check-conventions)
   1.190 -
   1.191 -# remove the intermediate files from the directories.
   1.192 -#    (If VARIANT=OPT, this removes all debug and fastdebug files too)
   1.193 -clobber clean::
   1.194 -	$(RM) -r $(OBJDIR)
   1.195 -	$(RM) -r $(OBJDIR)_*
   1.196 -
   1.197 -#
   1.198 -# Lint support
   1.199 -# (The 'lint' rule below is an older rule not using the .$(LINT_SUFFIX) files)
   1.200 -#
   1.201 -
   1.202 -ifeq ($(PLATFORM), solaris)
   1.203 -$(OBJDIR)/%.$(LINT_SUFFIX): %.c
   1.204 -	@$(prep-target)
   1.205 -	$(LINT.c) -dirout=$(OBJDIR) -c $<
   1.206 -lint.clean:
   1.207 -	$(RM) $(OBJDIR)/*.$(LINT_SUFFIX)
   1.208 -# Old rule
   1.209 -lint: $(FILES_c)
   1.210 -        ifneq ($(FILES_c),)
   1.211 -	  $(LINT.c) -Ncheck -Nlevel=3 $? $(LDLIBS) > lint.$(ARCH) 2>&1
   1.212 -        endif
   1.213 -endif
   1.214 -
   1.215 -.PHONY: batch_compile
   1.216 -
   1.217 -

mercurial