|
| 1 | +# |
| 2 | +# Copyright (c) 2023, 2024, Oracle and/or its affiliates. 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. Oracle designates this |
| 8 | +# particular file as subject to the "Classpath" exception as provided |
| 9 | +# by Oracle in the LICENSE file that accompanied this code. |
| 10 | +# |
| 11 | +# This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | +# version 2 for more details (a copy is included in the LICENSE file that |
| 15 | +# accompanied this code). |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License version |
| 18 | +# 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | +# |
| 21 | +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | +# or visit www.oracle.com if you need additional information or have any |
| 23 | +# questions. |
| 24 | +# |
| 25 | + |
| 26 | +# This must be the first rule |
| 27 | +default: all |
| 28 | + |
| 29 | +include $(SPEC) |
| 30 | +include MakeBase.gmk |
| 31 | +include CopyFiles.gmk |
| 32 | +include Execute.gmk |
| 33 | +include JavaCompilation.gmk |
| 34 | + |
| 35 | +ifeq ($(call isTargetOs, macosx), true) |
| 36 | + ############################################################################## |
| 37 | + # Build the XcodeProjectMaker java tool. |
| 38 | + |
| 39 | + PROJECT_MAKER_DIR := $(TOPDIR)/make/ide/xcode/hotspot |
| 40 | + TOOLS_OUTPUTDIR := $(MAKESUPPORT_OUTPUTDIR)/ide/xcode |
| 41 | + IDE_OUTPUTDIR := $(OUTPUTDIR)/xcode |
| 42 | + PROJECT_FILE_NAME := hotspot.xcodeproj |
| 43 | + |
| 44 | + COMPILE_COMMAND_FILE := $(OUTPUTDIR)/compile_commands.json |
| 45 | + LINKER_FLAGS_FILE := $(MAKESUPPORT_OUTPUTDIR)/compile-commands/jvm-ldflags.txt |
| 46 | + |
| 47 | + $(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \ |
| 48 | + TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \ |
| 49 | + SRC := $(PROJECT_MAKER_DIR)/src/classes, \ |
| 50 | + BIN := $(TOOLS_OUTPUTDIR), \ |
| 51 | + DISABLED_WARNINGS := rawtypes unchecked serial, \ |
| 52 | + )) |
| 53 | + |
| 54 | + TARGETS += $(BUILD_PROJECT_CREATOR) |
| 55 | + |
| 56 | + # Run the XcodeProjectMaker tool |
| 57 | + PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) XcodeProjectMaker |
| 58 | + |
| 59 | + ifneq ($(findstring $(LOG_LEVEL), debug trace), ) |
| 60 | + XCODE_PROJ_DEBUG_OPTION := -d |
| 61 | + endif |
| 62 | + |
| 63 | + XCODE_PROJ_VARDEPS := $(WORKSPACE_ROOT) $(IDE_OUTPUTDIR) \ |
| 64 | + $(PROJECT_MAKER_DIR)/data $(COMPILE_COMMAND_FILE) $(LINKER_FLAGS_FILE) |
| 65 | + XCODE_PROJ_VARDEPS_FILE := $(call DependOnVariable, XCODE_PROJ_VARDEPS, \ |
| 66 | + $(TOOLS_OUTPUTDIR)/xcodeproj.vardeps) |
| 67 | + |
| 68 | + $(eval $(call SetupExecute, build_xcode_project, \ |
| 69 | + WARN := Generating Xcode project file, \ |
| 70 | + DEPS := $(BUILD_PROJECT_CREATOR) $(COMPILE_COMMAND_FILE) \ |
| 71 | + $(LINKER_FLAGS_FILE) $(XCODE_PROJ_VARDEPS_FILE), \ |
| 72 | + OUTPUT_DIR := $(TOOLS_OUTPUTDIR), \ |
| 73 | + COMMAND := $(PROJECT_CREATOR_TOOL) $(WORKSPACE_ROOT) $(IDE_OUTPUTDIR) \ |
| 74 | + $(PROJECT_MAKER_DIR)/data $(COMPILE_COMMAND_FILE) \ |
| 75 | + $(LINKER_FLAGS_FILE) $(XCODE_PROJ_DEBUG_OPTION), \ |
| 76 | + )) |
| 77 | + |
| 78 | + TARGETS += $(build_xcode_project) |
| 79 | + |
| 80 | + $(eval $(call SetupCopyFiles, copy_xcode_project, \ |
| 81 | + DEST := $(IDE_OUTPUTDIR), \ |
| 82 | + FILES := $(PROJECT_MAKER_DIR)/data/script_before.sh $(PROJECT_MAKER_DIR)/data/script_after.sh , \ |
| 83 | + MACRO := copy-and-chmod-executable, \ |
| 84 | + )) |
| 85 | + |
| 86 | + TARGETS += $(copy_xcode_project) |
| 87 | + |
| 88 | + $(eval $(call SetupExecute, open_xcode_project, \ |
| 89 | + INFO := Opening Xcode project file, \ |
| 90 | + DEPS := $(build_xcodeproject_TARGET) FORCE, \ |
| 91 | + OUTPUT_DIR := $(TOOLS_OUTPUTDIR), \ |
| 92 | + COMMAND := open $(IDE_OUTPUTDIR)/$(PROJECT_FILE_NAME), \ |
| 93 | + )) |
| 94 | + |
| 95 | + TARGETS += $(open_xcode_project) |
| 96 | + |
| 97 | + # Always call open without considering dependencies being up to date |
| 98 | + FORCE: |
| 99 | + |
| 100 | + build: $(build_xcode_project) $(copy_xcode_project) |
| 101 | + |
| 102 | + open: $(open_xcode_project) |
| 103 | + |
| 104 | + all: $(TARGETS) |
| 105 | +else |
| 106 | + build: |
| 107 | + open: |
| 108 | + all: |
| 109 | + $(info Xcode projects are only supported on macOS) |
| 110 | +endif |
| 111 | + |
| 112 | +.PHONY: default all build open |
0 commit comments