• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revision581c7fb69305b7c1a4085a57898fed0a0b6ff6da (tree)
Time2014-09-18 15:47:06
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: for Loop of Small Tools
new file: TIPS/LoopCommand/Makefile
new file: TIPS/LoopCommand/Makefile.config

Change Summary

Incremental Difference

--- /dev/null
+++ b/TIPS/LoopCommand/Makefile
@@ -0,0 +1,31 @@
1+#
2+# This is Main Makefile for loop of small tools.(Sample)
3+#
4+
5+
6+#### Input extention ####
7+
8+#### Suffixes rule ####
9+# Defined at Sub
10+
11+#### INCLUDE ####
12+-include Makefile.config
13+
14+#### Definition ####
15+## For define varioable
16+CALC_SCALE=15.6
17+
18+#### Rules of the list created ####
19+
20+##### Commands #####
21+all::
22+ EXE_COMMAND=anglediffchk \
23+ FIXED_OPTION="-r 90" \
24+ VARIABLE_OPTION="-t $(CALC_S) $(VAR) / 7 $(CALC_E) " \
25+ VARIABLE_OPTION=$(CALC_VAR) \
26+ LOOP_MIN=0 \
27+ LOOP_MAX=10 \
28+ LOOP_DELTA=1 \
29+ make LoopCommand;
30+
31+##### Commands(Input to Output) #####
--- /dev/null
+++ b/TIPS/LoopCommand/Makefile.config
@@ -0,0 +1,40 @@
1+#
2+# This is Sub Makefile for loop of small tools.(for include)
3+#
4+
5+
6+#### Input extention ####
7+
8+#### Suffixes rule ####
9+# Defined at Main
10+
11+#### INCLUDE ####
12+
13+#### Definition ####
14+### Define the following essential data at Main Makefile.
15+# EXE_COMMAND: Loop Command Name (e.g. mrcImageNoiseAdd)
16+# FIXED_OPTION: No Change Option (e.g. "-i Input.mrc -SD 1")
17+# VARIABLE_OPTION: Change Option by Loop (e.g. "-NS $(VAR) -SD $(CALC_S)$(VAR) / 7 $(CALC_E)")
18+# CALC_SCALE: Calculation Scale (e.g. 15.6)
19+# LOOP_MIN: LoopMinValue
20+# LOOP_MAX: LoopMaxValue
21+# LOOP_DELTA: LoopDeltaValue
22+
23+## For SubMakefile
24+VAR=LoopNumber
25+CALC_S=CalculationStart
26+CALC_E=CalculationEnd
27+
28+#### Rules of the list created ####
29+CALC_VAR=$$(echo $$VARIABLE_OPTION | sed s/$(VAR)/'$$$$loopnum'/g | sed s/$(CALC_S)/'$$$$(echo "scale=$(CALC_SCALE);'/g | sed s/$(CALC_E)/'" | bc)'/g)
30+
31+##### Commands #####
32+LoopCommand::
33+ @for (( loopnum = $(LOOP_MIN); loopnum <= $(LOOP_MAX); loopnum += $(LOOP_DELTA) )) \
34+ do \
35+ echo "Loop: $$loopnum ($(EXE_COMMAND))"; \
36+ $(EXE_COMMAND) $(FIXED_OPTION) $(VARIABLE_OPTION); \
37+ done;
38+
39+##### Commands(Input to Output) #####
40+
Show on old repository browser