help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with lists for scripts of various types


From: Ken Smith
Subject: Re: Need help with lists for scripts of various types
Date: Fri, 21 Dec 2007 10:21:21 -0800

On Dec 21, 2007 6:40 AM, Billy Patton <address@hidden> wrote:
> I have a list :
> SCRIPTS         :=  \
>                     diffFiles.pl \
>                     summarize_v2sv.pl \
>                     summarize_svcomp.pl \
>                     summarize_sv.pl \
>                     summarize_output.sh \
>                     summarize_lv.pl \
>                     summarize_lfmscheck.pl \
>
>
> I have a colon definition ( I know it's probably wrong)
> xxxx : $(addprefix ${BIN_DIR}/,$(SCRIPTS))  probably need to remove the .pl
>
> I also have :
> ${BIN_DIR}/% : %.pl
>   @$(PRINTF) "Copying %s to ${BIN_DIR}/%s\n" "$<" "$@"
>   @$(COPY) $< ${BIN_DIR}/$@
>   @$(CHMOD) +x ${BIN_DIR}/$@

You would definitely need to remove the extensions if you want this to
work.  Here is one way to do this.

SCRIPTS-noext := $(SCRIPTS:.pl=)
SCRIPTS-noext := $(SCRIPTS-noext:.sh=)
SCRIPTS-noext := $(SCRIPTS-noext:.bash=)
SCRIPTS-noext := $(SCRIPTS-noext:.csh=)
SCRIPTS-installed := $(addprefix $(BIN_DIR)/,$(SCRIPTS-noext))

then xxxx is

xxxx: $(SCRIPTS-installed)

The final issue I see with what you propose is that your copy and
chmod commands repeat ${BIN_DIR} even though $@ already contains it.

Here's a working demo of the above suggestions.

SCRIPTS         :=  \
                   diffFiles.pl \
                   summarize_v2sv.pl \
                   summarize_svcomp.pl \
                   summarize_sv.pl \
                   summarize_output.sh \
                   summarize_lv.pl \
                   summarize_lfmscheck.pl

BIN_DIR := dogs/cast/sheep/bin

SCRIPTS-noext := $(SCRIPTS:.pl=)
SCRIPTS-noext := $(SCRIPTS-noext:.sh=)
SCRIPTS-noext := $(SCRIPTS-noext:.bash=)
SCRIPTS-noext := $(SCRIPTS-noext:.csh=)
SCRIPTS-installed := $(addprefix $(BIN_DIR)/,$(SCRIPTS-noext))

.PHONY: xxxx
xxxx: $(SCRIPTS-installed)

$(BIN_DIR)/%: %.pl | $(BIN_DIR); cp $< $@
$(BIN_DIR)/%: %.sh | $(BIN_DIR); cp $< $@
$(BIN_DIR)/%: %.bash | $(BIN_DIR); cp $< $@
$(BIN_DIR)/%: %.csh | $(BIN_DIR); cp $< $@

$(BIN_DIR):;mkdir -p $@

# this is only necessary because I didn't have a copy of
# your scripts
$(SCRIPTS):; touch $@

#EOF

The above could be shortened with a couple calls to $(foreach) but I
didn't want to muddy the example.

   Ken




reply via email to

[Prev in Thread] Current Thread [Next in Thread]