1.1 --- a/make/Makefile Tue Dec 03 14:13:15 2013 +0400 1.2 +++ b/make/Makefile Thu Dec 05 16:37:35 2013 +0400 1.3 @@ -1,5 +1,5 @@ 1.4 # 1.5 -# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 # 1.9 # This code is free software; you can redistribute it and/or modify it 1.10 @@ -23,37 +23,27 @@ 1.11 # questions. 1.12 # 1.13 1.14 -# 1.15 -# On Solaris, the standard 'make' utility will not work with these makefiles. 1.16 -# This little rule is only understood by Solaris make, and is harmless 1.17 -# when seen by the GNU make tool. If using Solaris make, this causes the 1.18 -# make command to fail. 1.19 -# 1.20 -SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 1.21 +# Locate this Makefile 1.22 +ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) 1.23 + makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) 1.24 +else 1.25 + makefile_path := $(lastword $(MAKEFILE_LIST)) 1.26 +endif 1.27 +repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path)) 1.28 1.29 +# What is the name of this subsystem (langtools, corba, etc)? 1.30 +subsystem_name := $(notdir $(repo_dir)) 1.31 1.32 -# Default target and expected 'do everything' target 1.33 +# Try to locate top-level makefile 1.34 +top_level_makefile := $(repo_dir)/../Makefile 1.35 +ifneq ($(wildcard $(top_level_makefile)), ) 1.36 + $(info Will run $(subsystem_name) target on top-level Makefile) 1.37 + $(info WARNING: This is a non-recommended way of building!) 1.38 + $(info ===================================================) 1.39 +else 1.40 + $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) 1.41 + $(error Build from top-level Makefile instead) 1.42 +endif 1.43 + 1.44 all: 1.45 - echo Nashorn can only be built with NEWBUILD=true 1.46 - 1.47 -# Standard make clobber target 1.48 -clobber: 1.49 - 1.50 -#------------------------------------------------------------------- 1.51 -# 1.52 -# Targets for Oracle's internal JPRT build system 1.53 - 1.54 -CD = cd 1.55 -ZIP = zip 1.56 - 1.57 -JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip 1.58 - 1.59 -jprt_build_product jprt_build_debug jprt_build_fastdebug: all 1.60 - ( $(CD) $(OUTPUTDIR) && \ 1.61 - $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist ) 1.62 - 1.63 -#------------------------------------------------------------------- 1.64 - 1.65 -# Declare these phony (not filenames) 1.66 -.PHONY: $(ANT_TARGETS) all clobber \ 1.67 - jprt_build_product jprt_build_debug jprt_build_fastdebug 1.68 + @$(MAKE) -f $(top_level_makefile) $(subsystem_name)