jlaskey@3: # ihse@676: # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. jlaskey@3: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jlaskey@3: # jlaskey@3: # This code is free software; you can redistribute it and/or modify it jlaskey@3: # under the terms of the GNU General Public License version 2 only, as jlaskey@3: # published by the Free Software Foundation. Oracle designates this jlaskey@3: # particular file as subject to the "Classpath" exception as provided jlaskey@3: # by Oracle in the LICENSE file that accompanied this code. jlaskey@3: # jlaskey@3: # This code is distributed in the hope that it will be useful, but WITHOUT jlaskey@3: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jlaskey@3: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jlaskey@3: # version 2 for more details (a copy is included in the LICENSE file that jlaskey@3: # accompanied this code). jlaskey@3: # jlaskey@3: # You should have received a copy of the GNU General Public License version jlaskey@3: # 2 along with this work; if not, write to the Free Software Foundation, jlaskey@3: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jlaskey@3: # jlaskey@3: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jlaskey@3: # or visit www.oracle.com if you need additional information or have any jlaskey@3: # questions. jlaskey@3: # jlaskey@3: ihse@676: # Locate this Makefile ihse@676: ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) ihse@676: makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) ihse@676: else ihse@676: makefile_path := $(lastword $(MAKEFILE_LIST)) ihse@676: endif ihse@676: repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path)) jlaskey@3: ihse@676: # What is the name of this subsystem (langtools, corba, etc)? ihse@676: subsystem_name := $(notdir $(repo_dir)) jlaskey@3: ihse@676: # Try to locate top-level makefile ihse@676: top_level_makefile := $(repo_dir)/../Makefile ihse@676: ifneq ($(wildcard $(top_level_makefile)), ) ihse@676: $(info Will run $(subsystem_name) target on top-level Makefile) ihse@676: $(info WARNING: This is a non-recommended way of building!) ihse@676: $(info ===================================================) ihse@676: else ihse@676: $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) ihse@676: $(error Build from top-level Makefile instead) ihse@676: endif ihse@676: jlaskey@109: all: ihse@676: @$(MAKE) -f $(top_level_makefile) $(subsystem_name)