# ============================================================== # Copyright (c) 1996-1998 Tim Barbour. # Copyright (c) 1998-1999 ACT Financial Systems Pty Ltd. # All Rights Reserved. # This make library may be used and distributed under the terms # of the GNU LGPL, as published by the Free Software Foundation. # See the file COPYING for details. # ============================================================== # $Id: master.mk,v 1.106 2001/12/11 10:00:52 trb Exp $ #------------------------------------------------------------------------------------------------------- # This file must be included at the end of all user makefiles #------------------------------------------------------------------------------------------------------- # Need to build up these lists of libraries whether the target is scoped or not. # We only set these on the first pass, in case the user variables are similarly protected, # otherwise we will pick up empty values from them on subsequent passes ifeq ($($(already_seen)),) # inherit any libraries from the parent level plus any additional prepended or appended libraries # we do this for unscoped and scoped targets alike (scoped_targets.prl needs these values) # libraries from other parts of our project export project_libs = $(PRE_PROJECT_LIBS) $(parent_project_libs) $(POST_PROJECT_LIBS) # libraries from outside the project export foreign_libs = $(PRE_FOREIGN_LIBS) $(parent_foreign_libs) $(POST_FOREIGN_LIBS) endif # precondition: initial target must be either "make", or a scoped target (e.g. "make ^") # detect and handle plain make invocation, with no explicit targets ifeq ($(strip $(MAKECMDGOALS)),) include $(MKINC)/default_target.mk else # detect and handle scoped targets ifneq ($(strip $(shell echo "$(MAKECMDGOALS)" | $(MKINC)/match_scoped.prl)),) # any scoped target is handled entirely by perl, ignoring the rest of this file %: @echo "$@" | $(MKINC)/scoped_targets.prl export MAKE # so perl knows how to invoke make properly # kludge, because Windoze perl cannot handle lowercase environment variables # these uppercase copies are picked up in scoped_targets.prl export SOURCE_ROOT = $(source_root) export TRAIL = $(trail) export PROJECT_LIBS = $(project_libs) export FOREIGN_LIBS = $(foreign_libs) else include $(MKINC)/unscoped.mk endif # only do this if we have visited the top-level Makefile, otherwise MAKEFILES will be unset, so we # will not see the definition of already_seen in early.mk ifneq ($(source_root),) # by the time we get here, any user variables have been read (and, in particular appended) # this is set to show when make recurses back into the same sub-directory, so it must be exported export $(already_seen) = done endif endif