actions.jam   [plain text]


# Copyright (c) 1999-2002 Apple Computer, Inc.
# All rights reserved.

# High level rules for build actions on targets

# Actions <product>
# Defines all available build actions
rule Actions
{
    Clean clean : $(1) ;
    BuildAction build : $(1) ;
    BuildAction copysrc : $(1) ;
    NOTFILE copysrc ;
    BuildAction copyhdrs : $(1) ;
    NOTFILE copyhdrs ;
    BuildAction copyrsrcs : $(1) ;
    NOTFILE copyrsrcs ;
    BuildAction install : $(1) ;
    BuildAction installdebugonly : $(1) ;
    NOTFILE installdebug ;
    BuildAction installprofileonly : $(1) ;
    NOTFILE installprofile ;
    BuildAction installdebugprofileonly : $(1) ;
    NOTFILE installdebugprofile ;
    BuildAction installsrc : $(1) ;
    NOTFILE installsrc ;
    BuildAction installhdrs : $(1) ;
    NOTFILE installhdrs ;
    BuildAction installrsrcs : $(1) ;
    NOTFILE installrsrcs ;
}

# Clean clean : <product>
# Deletes the product and the files associated with building it
rule Clean
{
    # locate built product and remove
    local BUILT_PRODUCT = $(2:G=) ;
    LOCATE on $(BUILT_PRODUCT) = $(TARGET_BUILD_DIR) ;
    Clean.Remove clean : $(BUILT_PRODUCT) ;

    # remove temporary directories
    Clean.Remove clean : $(TEMP_DIR) ;

    # Removal of archive in case of tools that are class archives,
    # this is which don't necessarily end with TOOL_SUFFIX.
    local ARCHIVE_SUFFIX ;
    local ARCHIVE_TARGET ;
    if $(JAVA_ARCHIVE_TYPE) = JAR {
        ARCHIVE_SUFFIX default = .jar ;
    }
    if $(JAVA_ARCHIVE_TYPE) = ZIP {
        ARCHIVE_SUFFIX default = .zip ;
    }
    ARCHIVE_SUFFIX default = "" ;
    ARCHIVE_TARGET = $(2:G=)$(ARCHIVE_SUFFIX) ;
    LOCATE on $(ARCHIVE_TARGET) = $(TARGET_BUILD_DIR) ;
    Clean.RemoveArchive clean : $(ARCHIVE_TARGET) ;
    # remove project header clones for this target
    if $(PROJECT_HEADER_DIR) {
        Clean.Remove clean : $(PROJECT_HEADER_DIR) ;
    }
    if $(WRAPPER_CLONE_DIR) {
        Clean.Remove clean : $(WRAPPER_CLONE_DIR) ;
    }
    # whole project content to remove on full clean
    Clean.Remove clean : $(PRECOMP_TRUSTFILE) ;
}

actions quietly piecemeal together existing Clean.Remove 
{
    $(RM) -rf "$(2)"
}

actions Clean.RemoveArchive
{
    if [ -f "$(2)" ]; then
        $(RM) -rf "$(2)"
    fi
}

rule BuildAction
{
    local ACTION_TARGET = $(2:G=$(1)BuildAction) ;
    ACTION on $(2) = $(ACTION) ;
    DEPENDS $(1) : $(ACTION_TARGET) ;
    DEPENDS $(ACTION_TARGET) : $(2) ;
    NOTFILE $(ACTION_TARGET) ;
}

# RunVariantHackScript varianthack : <product>
# Runs /AppleInternal/Developer/Tools/AppleInternalDebugAndProfileBuild.sh,
rule RunVariantHackScript
{
    if $(RC_JASPER) || $(INTERNAL_BUILD_VARIANTS_ONLY_IN_JASPER) != YES {
        local VARIANT_HACK_TARGET = $(1:G=varianthack) ;
        DEPENDS $(1) : $(VARIANT_HACK_TARGET) ;
        NOTFILE $(VARIANT_HACK_TARGET) ;
    }
}
actions exportvars RunVariantHackScript
{
    /bin/sh /AppleInternal/Developer/Tools/AppleInternalDebugAndProfileBuilder.sh $(INTERNAL_BUILD_VARIANTS)
}