make/solaris/makefiles/rules.make

Tue, 24 Jun 2008 16:52:31 -0700

author
xlu
date
Tue, 24 Jun 2008 16:52:31 -0700
changeset 663
f232d7d67023
parent 633
6470a2a42f92
child 670
9c2ecc2ffb12
permissions
-rw-r--r--

6717128: Using relative path for ALT_OUTPUTDIR does not work properly
Summary: import the absolute output directory when launching sub make process and avoid including defs.make in rules.make
Reviewed-by: kamg, kvn

     1 #
     2 # Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.
     8 #
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 # version 2 for more details (a copy is included in the LICENSE file that
    13 # accompanied this code).
    14 #
    15 # You should have received a copy of the GNU General Public License version
    16 # 2 along with this work; if not, write to the Free Software Foundation,
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20 # CA 95054 USA or visit www.sun.com if you need additional information or
    21 # have any questions.
    22 #  
    23 #
    25 # Common rules/macros for the vm, adlc.
    27 # Tell make that .cpp is important
    28 .SUFFIXES: .cpp $(SUFFIXES)
    30 # For now.  Other makefiles use CPP as the c++ compiler, but that should really
    31 # name the preprocessor.
    32 ifeq    ($(CCC),)
    33 CCC             = $(CPP)
    34 endif
    36 DEMANGLER       = c++filt
    37 DEMANGLE        = $(DEMANGLER) < $@ > .$@ && mv -f .$@ $@
    39 # $(CC) is the c compiler (cc/gcc), $(CCC) is the c++ compiler (CC/g++).
    40 C_COMPILE       = $(CC) $(CPPFLAGS) $(CFLAGS)
    41 CC_COMPILE      = $(CCC) $(CPPFLAGS) $(CFLAGS)
    43 AS.S            = $(AS) $(ASFLAGS)
    45 COMPILE.c       = $(C_COMPILE) -c
    46 GENASM.c        = $(C_COMPILE) -S
    47 LINK.c          = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS)
    48 LINK_LIB.c      = $(CC) $(LFLAGS) $(SHARED_FLAG)
    49 PREPROCESS.c    = $(C_COMPILE) -E
    51 COMPILE.CC      = $(CC_COMPILE) -c
    52 GENASM.CC       = $(CC_COMPILE) -S
    53 LINK.CC         = $(CCC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS)
    54 LINK_NOPROF.CC  = $(CCC) $(LFLAGS) $(AOUT_FLAGS)
    55 LINK_LIB.CC     = $(CCC) $(LFLAGS) $(SHARED_FLAG)
    56 PREPROCESS.CC   = $(CC_COMPILE) -E
    58 # Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k".
    59 REMOVE_TARGET   = rm -f $@
    61 # Synonyms.
    62 COMPILE.cpp     = $(COMPILE.CC)
    63 GENASM.cpp      = $(GENASM.CC)
    64 LINK.cpp        = $(LINK.CC)
    65 LINK_LIB.cpp    = $(LINK_LIB.CC)
    66 PREPROCESS.cpp  = $(PREPROCESS.CC)
    68 # Note use of ALT_BOOTDIR to explicitly specify location of java and
    69 # javac; this is the same environment variable used in the J2SE build
    70 # process for overriding the default spec, which is BOOTDIR.
    71 # Note also that we fall back to using JAVA_HOME if neither of these is
    72 # specified.
    74 ifdef ALT_BOOTDIR
    76 RUN.JAVA  = $(ALT_BOOTDIR)/bin/java
    77 RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap
    78 RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah
    79 RUN.JAR   = $(ALT_BOOTDIR)/bin/jar
    80 COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac
    81 COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic
    82 BOOT_JAVA_HOME = $(ALT_BOOTDIR)
    84 else
    86 ifdef BOOTDIR
    88 RUN.JAVA  = $(BOOTDIR)/bin/java
    89 RUN.JAVAP = $(BOOTDIR)/bin/javap
    90 RUN.JAVAH = $(BOOTDIR)/bin/javah
    91 RUN.JAR   = $(BOOTDIR)/bin/jar
    92 COMPILE.JAVAC = $(BOOTDIR)/bin/javac
    93 COMPILE.RMIC  = $(BOOTDIR)/bin/rmic
    94 BOOT_JAVA_HOME = $(BOOTDIR)
    96 else
    98 ifdef JAVA_HOME
   100 RUN.JAVA  = $(JAVA_HOME)/bin/java
   101 RUN.JAVAP = $(JAVA_HOME)/bin/javap
   102 RUN.JAVAH = $(JAVA_HOME)/bin/javah
   103 RUN.JAR   = $(JAVA_HOME)/bin/jar
   104 COMPILE.JAVAC = $(JAVA_HOME)/bin/javac
   105 COMPILE.RMIC  = $(JAVA_HOME)/bin/rmic
   106 BOOT_JAVA_HOME = $(JAVA_HOME)
   108 else
   110 # take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined
   111 # note that this is to support hotspot build without SA. To build
   112 # SA along with hotspot, you need to define ALT_BOOTDIR, BOOTDIR or JAVA_HOME
   114 RUN.JAVA  = java
   115 RUN.JAVAP = javap
   116 RUN.JAVAH = javah
   117 RUN.JAR   = jar
   118 COMPILE.JAVAC = javac
   119 COMPILE.RMIC  = rmic
   121 endif
   122 endif
   123 endif
   125 SUM = /usr/bin/sum
   127 # 'gmake MAKE_VERBOSE=y' gives all the gory details.
   128 QUIETLY$(MAKE_VERBOSE)  = @
   129 RUN.JAR$(MAKE_VERBOSE) += >/dev/null
   131 # With parallel makes, print a message at the end of compilation.
   132 ifeq    ($(findstring j,$(MFLAGS)),j)
   133 COMPILE_DONE    = && { echo Done with $<; }
   134 endif
   136 # Include NONPIC_OBJ_FILES definition
   137 ifndef LP64
   138 include $(GAMMADIR)/make/pic.make
   139 endif
   141 # Sun compiler for 64 bit Solaris does not support building non-PIC object files.
   142 ifdef LP64
   143 %.o: %.cpp
   144 	@echo Compiling $<
   145 	$(QUIETLY) $(REMOVE_TARGET)
   146 	$(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
   147 else
   148 %.o: %.cpp
   149 	@echo Compiling $<
   150 	$(QUIETLY) $(REMOVE_TARGET)
   151 	$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
   152          $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \
   153          $(COMPILE.CC) -o $@ $< $(COMPILE_DONE))
   154 endif
   156 %.o: %.s
   157 	@echo Assembling $<
   158 	$(QUIETLY) $(REMOVE_TARGET)
   159 	$(QUIETLY) $(AS.S) -o $@ $< $(COMPILE_DONE)
   161 %.s: %.cpp
   162 	@echo Generating assembly for $<
   163 	$(QUIETLY) $(GENASM.CC) -o $@ $<
   164 	$(QUIETLY) $(DEMANGLE) $(COMPILE_DONE)
   166 # Intermediate files (for debugging macros)
   167 %.i: %.cpp
   168 	@echo Preprocessing $< to $@
   169 	$(QUIETLY) $(PREPROCESS.CC) $< > $@ $(COMPILE_DONE)
   171 #  Override gnumake built-in rules which do sccs get operations badly.
   172 #  (They put the checked out code in the current directory, not in the
   173 #  directory of the original file.)  Since this is a symptom of a teamware
   174 #  failure, and since not all problems can be detected by gnumake due
   175 #  to incomplete dependency checking... just complain and stop.
   176 %:: s.%
   177 	@echo "========================================================="
   178 	@echo File $@
   179 	@echo is out of date with respect to its SCCS file.
   180 	@echo This file may be from an unresolved Teamware conflict.
   181 	@echo This is also a symptom of a Teamware bringover/putback failure
   182 	@echo in which SCCS files are updated but not checked out.
   183 	@echo Check for other out of date files in your workspace.
   184 	@echo "========================================================="
   185 	@exit 666
   187 %:: SCCS/s.%
   188 	@echo "========================================================="
   189 	@echo File $@
   190 	@echo is out of date with respect to its SCCS file.
   191 	@echo This file may be from an unresolved Teamware conflict.
   192 	@echo This is also a symptom of a Teamware bringover/putback failure
   193 	@echo in which SCCS files are updated but not checked out.
   194 	@echo Check for other out of date files in your workspace.
   195 	@echo "========================================================="
   196 	@exit 666
   198 .PHONY: default

mercurial