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