file versus identical symlink as a target?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

file versus identical symlink as a target?

Robert P. J. Day-2

  i'm sure i will be embarrassed when i learn how simple the answer is
to this but here's a snippet of a makefile i'm dealing with:

===== start snippet =====

TOOL_SRC_DIR      := $(LOCAL_DIR)/$(PETALINUX_VERSION)
PETA_ARCHIVE      := $(LOCAL_DIR)/$(PETALINUX_VERSION).tar.gz
PETA_SRC_CFG_FILE := $(TOOL_SRC_DIR)/linux/settings.sh

# Runtime build variables
TOOL_DIR          := $(REPO_ROOT)
PETA_CFG_FILE     := $(TOOL_DIR)/linux/settings.sh
PETA_CFG          := source $(PETA_CFG_FILE)

prep := $(PROJECT_STAGE_DIR) $(PROJECT_OUTPUT_DIR)

$(TOOL_SRC_DIR):
        $(info docker building rules: $@)
        mkdir -p $@

$(PETA_ARCHIVE): | $(TOOL_SRC_DIR)
        $(info docker building rules: $@)
        curl -v -o $@ -O
"$(BASE_URL)/generic-local/$(PETALINUX_ARCHIVE_NAME)/${PETALINUX_VERSION}.tar.gz";

$(PETA_SRC_CFG_FILE): | $(PETA_ARCHIVE)
        $(info docker building rules: $@)
        tar -xf $(PETA_ARCHIVE) -C $(LOCAL_DIR)/$(PETALINUX_VERSION)

===== end snippet =====

  long story short, the above has a target of ${PETA_ARCHIVE), which
is the name of a sizable (7G) petalinux tarball that make expects to
find under the top-level local/ directory. if i git clone this
project, then manually create local/ and "cp" that tarball into
local/, make deems that rule satisfied, and proceeds to untar the
tarball without downloading it.

  if, however, i would rather create a symlink under local/ to the
tarball to avoid all that copying, make insists on downloading it
anyway.

  so, in summary, can a target be a symlink and, if so, how? thank you
kindly.

rday

--

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================