diff -r 549e9944d310 -r 79297dc5e081 corba/make/Makefile --- a/corba/make/Makefile Fri Nov 08 17:16:59 2013 -0800 +++ b/corba/make/Makefile Mon Nov 04 11:09:07 2013 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,171 +23,27 @@ # questions. # -# -# Makefile for building the corba workspace. -# - -BUILDDIR=. -include $(BUILDDIR)/common/Defs.gmk -include $(BUILDDIR)/common/CancelImplicits.gmk - -#----- commands - -CHMOD = chmod -CP = cp -ECHO = echo # FIXME -FIND = find -MKDIR = mkdir -SED = sed -ZIP = zip - -#----- locations and deliverables - -TOPDIR=.. -SRC_BIN_DIR = $(TOPDIR)/src/share/bin -SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes - -ifdef ALT_OUTPUTDIR - OUTPUTDIR = $(ALT_OUTPUTDIR) - BUILD_DIR = $(ALT_OUTPUTDIR) - DIST_DIR = $(ALT_OUTPUTDIR)/dist +# Locate this Makefile +ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) + makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) else - OUTPUTDIR = .. - BUILD_DIR = $(TOPDIR)/build/$(PLATFORM)-$(ARCH) - DIST_DIR = $(TOPDIR)/dist + makefile_path := $(lastword $(MAKEFILE_LIST)) endif -ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR)) - -CLASSES_DIR = $(BUILD_DIR)/classes -GENSRC_DIR = $(BUILD_DIR)/gensrc +repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path)) -LIB_DIR = $(DIST_DIR)/lib - -#----- - -ifndef JDK_MAJOR_VERSION - JDK_MAJOR_VERSION = 1 -endif - -ifndef JDK_MINOR_VERSION - JDK_MINOR_VERSION = 7 -endif - -ifndef JDK_MICRO_VERSION - JDK_MICRO_VERSION = 0 -endif +# What is the name of this subsystem (langtools, corba, etc)? +subsystem_name := $(notdir $(repo_dir)) -ifndef JDK_VERSION - JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION) -endif - -ifndef MILESTONE - MILESTONE = internal -endif - -# RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set -ifneq ($(MILESTONE),fcs) - RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE) +# Try to locate top-level makefile +top_level_makefile := $(repo_dir)/../Makefile +ifneq ($(wildcard $(top_level_makefile)), ) + $(info Will run $(subsystem_name) target on top-level Makefile) + $(info WARNING: This is a non-recommended way of building!) + $(info ===================================================) else - RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE) -endif - -# FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set -ifdef BUILD_NUMBER - FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER) -else - BUILD_NUMBER = b00 - USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`) - FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER) + $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) + $(error Build from top-level Makefile instead) endif -#----- useful macros - -SOURCE_LEVEL = 5 -BOOTSTRAP_TARGET_LEVEL = 5 - -ifdef TARGET_CLASS_VERSION - TARGET_LEVEL = $(TARGET_CLASS_VERSION) -else - TARGET_LEVEL = 7 -endif - -ifndef TARGET_JAVA - TARGET_JAVA = java -endif - -SELF = $(lastword $(MAKEFILE_LIST)) - -# for jdk, we generate the following: -# dist/lib/classes.jar: -# corba recompiled to run on the target JDK, -# ready for inclusion in rt.jar -# dist/lib/src.zip -# .properties and .java files for classes in classes.jar, -# ready for jdk src.zip -# dist/lib/bin.zip -# corba specific binaries: orb.idl, ir.idl - -# Default target -default: all - -#----- classes.jar - -CLASSES_JAR = $(LIB_DIR)/classes.jar -$(CLASSES_JAR): - $(MKDIR) -p $(@D) - $(BOOT_JAR_CMD) -cf $@ -C $(CLASSES_DIR) . - -#----- src.zip - -SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name \*-template \) -prune -o -type f -print ) - -SRC_ZIP = $(LIB_DIR)/src.zip -$(SRC_ZIP): $(SRC_ZIP_FILES) - abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \ - ( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \ - ( cd $(GENSRC_DIR) ; $(FIND) . -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; - -#----- bin.zip - -BIN_ZIP_FILES = $(BUILD_DIR/lib/orb.idl $(BUILD_DIR)/lib/ir.idl - -BIN_ZIP = $(LIB_DIR)/bin.zip -$(BIN_ZIP): $(BIN_ZIP_FILES) - abs_bin_zip=`cd $(@D) ; pwd`/$(@F) ; \ - ( cd $(BUILD_DIR) ; $(FIND) lib -name "*.idl" -print | $(ZIP) -q $$abs_bin_zip -@ ) ; - -# -# CORBA -# -SUBDIRS = tools javax org sun com - -build: - $(SUBDIRS-loop) - -all : build $(CLASSES_JAR) $(SRC_ZIP) $(BIN_ZIP) - -clean clobber: - $(RM) -r $(BUILD_DIR) - $(RM) -r $(DIST_DIR) - -#------------------------------------------------------------------- -# -# Targets for Sun's internal JPRT build system - -CD = cd -ZIP = zip - -JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip - -jprt_build_product jprt_build_debug jprt_build_fastdebug: all - ( $(CD) $(OUTPUTDIR) && \ - $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist ) - -#------------------------------------------------------------------- - - -# -# Phonies to avoid accidents. -# -.PHONY: all build clean clobber debug jprt_build_product jprt_build_debug jprt_build_fastdebug +all: + @$(MAKE) -f $(top_level_makefile) $(subsystem_name)