1 # |
1 # |
2 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 # |
4 # |
5 # This code is free software; you can redistribute it and/or modify it |
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 |
6 # under the terms of the GNU General Public License version 2 only, as |
7 # published by the Free Software Foundation. Oracle designates this |
7 # published by the Free Software Foundation. Oracle designates this |
29 |
29 |
30 ifeq (,$(_MAKEBASE_GMK)) |
30 ifeq (,$(_MAKEBASE_GMK)) |
31 $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk) |
31 $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk) |
32 endif |
32 endif |
33 |
33 |
34 ifeq ($(COMPILER_TYPE),CC) |
34 ifneq ($(TOOLCHAIN_TYPE), microsoft) |
35 COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))" |
35 COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))" |
36 LINKING_MSG=echo $(LOG_INFO) "Linking $1" |
36 LINKING_MSG=echo $(LOG_INFO) "Linking $1" |
37 LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1" |
37 LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1" |
38 ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1" |
38 ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1" |
39 else |
39 else |
84 # And this is the dependency file for this obj file. |
84 # And this is the dependency file for this obj file. |
85 $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) |
85 $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) |
86 # Include previously generated dependency information. (if it exists) |
86 # Include previously generated dependency information. (if it exists) |
87 -include $$($1_$2_DEP) |
87 -include $$($1_$2_DEP) |
88 |
88 |
89 ifeq ($(COMPILER_TYPE),CL) |
89 ifeq ($(TOOLCHAIN_TYPE), microsoft) |
90 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ |
90 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ |
91 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) |
91 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) |
92 endif |
92 endif |
93 endif |
93 endif |
94 |
94 |
95 $$($1_$2_OBJ) : $2 |
95 $$($1_$2_OBJ) : $2 |
96 ifeq ($(COMPILER_TYPE),CC) |
96 ifneq ($(TOOLCHAIN_TYPE), microsoft) |
97 $$(call COMPILING_MSG,$2,$$($1_TARGET)) |
97 $$(call COMPILING_MSG,$2,$$($1_TARGET)) |
98 # The Sun studio compiler doesn't output the full path to the object file in the |
98 # The Solaris studio compiler doesn't output the full path to the object file in the |
99 # generated deps files. Fixing it with sed. If compiling assembly, don't try this. |
99 # generated deps files. Fixing it with sed. If compiling assembly, don't try this. |
100 ifeq ($(COMPILER_NAME)$$(filter %.s,$2),ossc) |
100 ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s,$2), solstudio) |
101 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP).tmp $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 |
101 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP).tmp $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 |
102 $(SED) 's|^$$(@F):|$$@:|' $$($1_$2_DEP).tmp > $$($1_$2_DEP) |
102 $(SED) 's|^$$(@F):|$$@:|' $$($1_$2_DEP).tmp > $$($1_$2_DEP) |
103 else |
103 else |
104 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 |
104 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 |
105 endif |
105 endif |
106 endif |
106 endif |
107 # The Visual Studio compiler lacks a feature for generating make dependencies, but by |
107 # The Visual Studio compiler lacks a feature for generating make dependencies, but by |
108 # setting -showIncludes, all included files are printed. These are filtered out and |
108 # setting -showIncludes, all included files are printed. These are filtered out and |
109 # parsed into make dependences. |
109 # parsed into make dependences. |
110 ifeq ($(COMPILER_TYPE),CL) |
110 ifeq ($(TOOLCHAIN_TYPE), microsoft) |
111 ($$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \ |
111 ($$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \ |
112 $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 ; echo $$$$? > $$($1_$2_DEP).exitvalue) \ |
112 $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 ; echo $$$$? > $$($1_$2_DEP).exitvalue) \ |
113 | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \ |
113 | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \ |
114 && exit `cat $$($1_$2_DEP).exitvalue` |
114 && exit `cat $$($1_$2_DEP).exitvalue` |
115 $(RM) $$($1_$2_DEP).exitvalue |
115 $(RM) $$($1_$2_DEP).exitvalue |