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