# recipe to propagate features around servers:
copy.log:
make /local/experiment/features.tar.gz
for s in server-1 server 2 server-3 server-4; do\
scp /local/experiment/features.tar.gz $${s}:/local/ ; \
ssh $${s} "mkdir -p /local/experiment/; cd /local/; mv features.tar.gz /local/experiment/; cd /local/experiment/; tar -xvzf features.tar.gz "; \
done > $@
# change extension or parts of a filename
BEST=$(PATH_ROOT)/sgdMat.dat
$(subst sgdMat.dat,sgdMatNorm.dat,$(BEST))
$(subst from,to,text)
for more check here
# From bash to Makefile always DOUBLE the $
in BASH :
for p in $(find -name filenam.jpgl); do echo $p; done
in Makefile :
for p in $$(find ./ -name filenam.jpgl); do \
echo $${p};\
done
$ indicates the variable of the makefile
$$ indicates the variable of the script
ANOTHER EXAMPLE
for t in $$(cat $(PATH_LISTS)/$(CORPUS).txt);do \
if [ `cat $${t} | grep -nH "\[$(ID)\]" | wc -l` -gt 0 ]; then \
echo $*; \
else \
echo "nothing"; \
fi; \
done; $@
# Note the differences between quotes in echo and awk:
for c in {'Tree', 'is', 'your','friend'}; do\
echo "$$c"; \
done;
BUT
cat file | awk '{print $$1}'
# if statement
foo: $(objects)
ifeq ($(CC),gcc)
$(CC) -o foo $(objects) $(libs_for_gcc)
else
$(CC) -o foo $(objects) $(normal_libs)
endif
# Execute the makefile inside /lt/directory/gt/
make -C /lt/directory/gt target
# The stem with which an implicit rule matches
$*
Example to clarify :
$(LIST)/%.nscr:
cat $(LIST)/$*.scr | $(SCRIPT)/normalize.pl $(X1) $(Y1) $(X2) $(Y2) > $@
$*=%
No comments:
Post a Comment