-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocumentation.tex
91 lines (60 loc) · 2.71 KB
/
documentation.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
\chapter{Documenting a makefile for this manual}
This chapter will show you how to document (in \LaTeX) a makefile for this manual. While \LaTeX{} may look intimidating if you haven't used it before, it is fairly straightforward to use. We have created a number of tools to help you insert your makefile into this manual.
\section{How Makefile Documentation Should Look}
Notice how documentation will begin on a new page and a new page will be created at the end of the documentations. This is necessary to allow for wider margins that make the code easier to read.
\newgeometry{scale=0.85, centering}
\lstset{language=make,
gobble=8,
basicstyle=\small\ttfamily,
breaklines=true,
escapeinside={\%*}{*}}
\begin{lstlisting}
PROJHOME=/projects2/act-plus/subjects/session1
cwd=$(shell pwd)
SUBJECTS=$(shell cat /projects2/act-plus/uds/good_subjects.txt)
%*\lnote*export OMP_NUM_THREADS=1
\end{lstlisting}
You can break up and explain your code. For example, \lnum{1} sets the number of threads to allow \maken{} to parallelize.
\begin{lstlisting}
export SUBJECTS_DIR=/projects2/act-plus/freesurfer
export QA_TOOLS=/usr/local/freesurfer/QAtools_v1.1
%*\lnote* export FREESURFER_SETUP = /usr/local/freesurfer/stable5_3/SetUpFreeSurfer.sh
export RECON_ALL = /usr/local/freesurfer/stable5_3/bin/recon-all $(RECON_FLAGS)
export TKMEDIT = /usr/local/freesurfer/stable5_3/bin/tkmedit
export SHELL=/bin/bash
.PHONY: qa clean mostlyclean output noninteractive
noninteractive: setup freesurfer
all: noninteractive
output=$(SUBJECTS:%=%/mri/aparc+aseg.mgz) $(SUBJECTS:%=%/mri/brainmask.nii.gz)
freesurfer: $(output)
#recon-all $(RECON_FLAGS) -subjid $${subj} -FLAIR $${subj}/flair.nii.gz -FLAIRpial;\
qafiles=$(SUBJECTS:%=QA/%)
qa: $(qafiles)
QA/%: %
source $$FREESURFER_SETUP ;\
$(QA_TOOLS)/recon_checker -s $*
%/mri/aparc+aseg.mgz: $(PROJHOME)/%/memprage/T1.nii.gz
rm -rf `dirname $@`/IsRunning.*
source /usr/local/freesurfer/stable5_3/SetUpFreeSurfer.sh ;\
export SUBJECTS_DIR=$(SUBJECTS_DIR) ;\
/usr/local/freesurfer/stable5_3/bin/recon-all -i $< -subjid $* -all ;\
/usr/local/freesurfer/stable5_3/bin/recon-all -s $* -T2
$(PROJHOME)/$*/flair/Flair.nii.gz -T2pial
%/mri/brainmask.nii.gz: $(SUBJECTS_DIR)/%/mri/aparc+aseg.mgz
source /usr/local/freesurfer/stable5_3/SetUpFreeSurfer.sh ;\
mri_convert $(SUBJECTS_DIR)/$*/mri/brainmask.mgz $@
clean:
echo rm -rf $(inputdirs)
mostlyclean:
@echo "Here I would delete things that are not necessary after all is said and done."
output:
@echo "Nothing yet"
setup: $(SUBJECTS)
%: $(PROJHOME)/%/memprage/T1.nii.gz
mkdir -p $@/mri/orig; \
cp $^ $@/mri/orig; \
cd $@/mri/orig; \
mri_convert T1.nii.gz 001.mgz
help:
$(usage)
\end{lstlisting}