ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/scriptome/Makefile
Revision: 1.27
Committed: Tue Jul 7 18:52:50 2009 UTC (7 years, 2 months ago) by amirkarger
Branch: MAIN
CVS Tags: HEAD
Changes since 1.26: +4 -4 lines
Log Message:
* Tweak Makefile
* Add change_split_fasta tool (Change.pod, all_params)
* html2scriptome wasn't handling q{} correctly (tidy() broke it)
* Make t/*.pl use dated sample file dir
* Remove unneeded BEGIN from choose_lines_col_more_than_limit

Line File contents
1 # Makefile for The Scriptome
2 #
3 # dev: create dev version of website AND a second copy in a web-viewable loc.
4 # prod: copy things from web_dev_dir to prod_dir
5 # dev_dirs: create dev_dir and sub-dirs of it. Also prod_dirs, web_dev_dirs
6 #
7 #
8 # TODO still need to put images into dependencies for prod_dir.
9 # Need to put them all into . also, so we keep everything together.
10
11
12 # make dev_dir/foo.html will also make a copy on the dev website
13
14 #################
15 # Variables
16 # Place to build a copy of the website
17 DEV_DIR = ./dev_dir
18 # Where the dev website lives (copied from DEV_DIR)
19 ifeq (Windows, $(findstring Windows, $(OS)))
20 WEB_DEV_DIR = ./website_dev
21 else
22 WEB_DEV_DIR = /usr/local/www/dev/public/lsdiv/scriptome
23 endif
24 # Place to put a copy of WEB_DEV_DIR which will get copied to real website
25 PROD_DIR = ./prod_dir
26 # Program that converts pod2html'd POD to Scriptome pages
27 H2S = html2scriptome.pl
28 # Program to create Scriptpack
29 PACK_SCRIPT = pack_tools.pl
30 PARAM_DESCS = all_params.tab
31
32 # Make two copies of pages for Windows, Non-Windows
33 # Stuff in PLATFORM_DIR gets copied into both of them (slightly changed)
34 UNIX_DIR = UNIX
35 WINDOWS_DIR = Windows
36 PLATFORM_DIR = Platform
37 TOOL_DIR = Tools
38 PROTOCOL_DIR = Protocols
39 IMAGE_DIR = images
40 INFO_DIR = Information
41 SCRIPTOME_BIN_DIR = bin
42
43 # Aggregate files
44 INFO_FILES = FAQ.html Help.html Overview.html Principles.html Resources.html Tips.html
45 PROTOCOL_FILES = Sequences.html Microarray.html
46 TOOL_FILES= Calc.html Change.html Choose.html Fetch.html Merge.html Sort.html
47 CSS = Stylesheet.css
48 JS = Scripts.js CSB_Scripts.js
49 IMAGE_FILES = CBG3.gif chromosome.gif logo_small.jpg spacer.gif t_compbio_win.gif t_compbio.gif triangle16_down.gif t_compbio_unix.gif triangle16_right.gif
50 # CSB image files
51 IMCD = imagescomm
52 IMCF = b_contact.gif b_search.gif ba_home.gif tagline.gif b_directories.gif ba_contact.gif ba_search.gif b_home.gif ba_directories.gif logo.gif
53 IMC = $(addprefix $(IMCD)/,$(IMCF))
54
55 ALL_WINDOWS_DIRS = $(WINDOWS_DIR) $(addprefix $(WINDOWS_DIR)/, $(TOOL_DIR) $(PROTOCOL_DIR) $(INFO_DIR))
56 ALL_UNIX_DIRS = $(UNIX_DIR) $(addprefix $(UNIX_DIR)/, $(TOOL_DIR) $(PROTOCOL_DIR) $(INFO_DIR))
57 ALL_OTHER_DIRS = $(SCRIPTOME_BIN_DIR) $(IMAGE_DIR) $(IMAGE_DIR)/$(IMCD)
58 ALL_DIRS = $(ALL_WINDOWS_DIRS) $(ALL_UNIX_DIRS) $(ALL_OTHER_DIRS)
59 DEV_ALL_DIRS = $(DEV_DIR) $(addprefix $(DEV_DIR)/, $(ALL_DIRS))
60 PROD_ALL_DIRS = $(PROD_DIR) $(addprefix $(PROD_DIR)/, $(ALL_DIRS))
61 WEB_DEV_ALL_DIRS = $(WEB_DEV_DIR) $(addprefix $(WEB_DEV_DIR)/, $(ALL_DIRS))
62
63 EXECUTABLES_NO_DIR = Scriptome ScriptPack Scriptome.bat ScriptPack.bat
64 EXECUTABLES = $(addprefix $(SCRIPTOME_BIN_DIR)/, $(EXECUTABLES_NO_DIR))
65 EXE_TAR = $(SCRIPTOME_BIN_DIR)/Scriptome_exe.tar.gz
66
67 # Files in directories
68 IMAGES = $(addprefix $(IMAGE_DIR)/,$(IMAGE_FILES) $(IMC))
69 UNIX_TOOLS = $(addprefix $(UNIX_DIR)/$(TOOL_DIR)/, $(TOOL_FILES))
70 WINDOWS_TOOLS = $(addprefix $(WINDOWS_DIR)/$(TOOL_DIR)/, $(TOOL_FILES))
71 UNIX_PROTS = $(addprefix $(UNIX_DIR)/$(PROTOCOL_DIR)/,$(PROTOCOL_FILES))
72 WINDOWS_PROTS = $(addprefix $(WINDOWS_DIR)/$(PROTOCOL_DIR)/,$(PROTOCOL_FILES))
73 UNIX_INFO = $(addprefix $(UNIX_DIR)/$(INFO_DIR)/, $(INFO_FILES))
74 WINDOWS_INFO = $(addprefix $(WINDOWS_DIR)/$(INFO_DIR)/, $(INFO_FILES))
75
76 # Bigger aggregates
77 ALL_WINDOWS = $(WINDOWS_TOOLS) $(WINDOWS_PROTS) $(WINDOWS_INFO) $(WINDOWS_DIR)/index.html
78 ALL_UNIX = $(UNIX_TOOLS) $(UNIX_PROTS) $(UNIX_INFO) $(UNIX_DIR)/index.html
79 ALL_TOOLS = $(UNIX_TOOLS) $(WINDOWS_TOOLS)
80 ALL_PROTS = $(UNIX_PROTS) $(WINDOWS_PROTS)
81 ALL_INFO = $(UNIX_INFO) $(WINDOWS_INFO)
82 SUPPORT_FILES = $(CSS) $(JS) $(IMAGES)
83 ALL_FILES = $(ALL_WINDOWS) $(ALL_UNIX) index.html $(SUPPORT_FILES) $(EXECUTABLES) $(EXE_TAR)
84 DEV_ALL = $(addprefix $(DEV_DIR)/,$(ALL_FILES))
85 PROD_ALL = $(addprefix $(PROD_DIR)/,$(ALL_FILES))
86
87 # Automatic variable reminder
88 # $@: target -- $(@D) is the directory part, $(@F) is the file part
89 # $<: first prerequisite
90 # $?: all prerequisites newer than target
91 # $*: stem with which an implicit rule matched.
92 # For rule a.%.b, dir/a.foo.b is dir/foo
93
94 #################
95 # MAIN TARGETS
96 dev: $(DEV_ALL)
97
98 all: index.html windows_all unix_all css javascript
99
100 unix_all: unix_tools unix_prots unix_info $(UNIX_DIR)/index.html
101 windows_all: windows_tools windows_prots windows_info $(WINDOWS_DIR)/index.html
102
103 tools: unix_tools windows_tools
104 unix_tools: $(UNIX_TOOLS)
105 windows_tools: $(WINDOWS_TOOLS)
106
107 protocols: unix_prots windows_prots
108 unix_prots: $(UNIX_PROTS)
109 windows_prots: $(WINDOWS_PROTS)
110
111 info: unix_info windows_info
112 unix_info: $(UNIX_INFO)
113 windows_info: $(WINDOWS_INFO)
114
115 css: $(CSS)
116 javascript: $(JS)
117
118 dev_dirs: $(DEV_ALL_DIRS)
119 web_dev_dirs: $(WEB_DEV_ALL_DIRS)
120 prod_dirs: $(PROD_ALL_DIRS)
121
122 .PHONY: all dev unix_all windows_all
123 .PHONY: tools protocols info prod_dir
124 .PHONY: windows_tools unix_tools
125 .PHONY: windows_prots unix_prots
126 .PHONY: windows_info unix_info
127 .PHONY: css javascript
128 .PHONY: echo scriptome.html
129 .PHONY: dev_dirs prod_dirs web_dev_dirs
130
131 echo:
132 @ echo $(WINDOWS_TOOLS)
133
134 test:
135 @cd t && prove
136
137 # Pack tools into a portable toolbox
138 bin/ScriptPack: bin/Scriptome $(PACK_SCRIPT) $(ALL_TOOLS)
139 perl $(PACK_SCRIPT) bin/Scriptome . > $@
140 ifneq (Windows, $(findstring Windows, $(OS)))
141 chmod +x $@
142 endif
143
144 # Create a tar.gz of the Scriptome executables
145 $(EXE_TAR): $(EXECUTABLES)
146 perl -MArchive::Tar -e "Archive::Tar->create_archive('$@', 1, qw($(EXECUTABLES))) or die Archive::Tar->error"
147
148 #################
149 # Create pre_html files by running pod2html on POD files
150 # --htmlroot = where root is compared to this file
151 # --htmldir = where this file is compared to root (?)
152 # --podpath = where to look for other pod files
153 # --norecurse = don't recursively look in pod files (esp. bad for '.')
154 PODPATH = Platform/Tools:Platform/Information:Platform/Protocols
155 %.pre_html: %.pod
156 pod2html --outfile=$@ --infile=$< --htmlroot=../.. --htmldir=$(@D) --podpath=.:$(PODPATH) --norecurse
157
158 # For non-tool pages, we don't want a TOC
159 Platform/Information/Principles.pre_html: Platform/Information/Principles.pod
160 pod2html --outfile=$@ --infile=$< --htmlroot=../.. --htmldir=$(@D) --podpath=.:$(PODPATH) --noindex --norecurse
161
162 Platform/Information/Overview.pre_html: Platform/Information/Overview.pod
163 pod2html --outfile=$@ --infile=$< --htmlroot=../.. --htmldir=$(@D) --podpath=.:$(PODPATH) --noindex --norecurse
164
165 Platform/index.pre_html: Platform/index.pod
166 pod2html --outfile=$@ --infile=$< --htmlroot=.. --htmldir=$(@D) --podpath=.:$(PODPATH) --noindex --norecurse
167
168 # No --htmldir needed
169 # Put . LAST in the path, so it finds things in Tools, etc. before recursing
170 # into ./prod_dir!
171 index.pre_html: Scriptome.pod
172 pod2html --outfile=$@ --infile=$< --htmlroot=. --podpath=$(PODPATH):. --noindex
173 # pod2html --outfile=$@ --infile=$< --htmlroot=. --podpath=Tools:Windows_Tools:Information:Protocols:. --noindex
174
175 scriptome.html:
176 echo "Make index.html instead"
177
178 #################
179 # Run html2scriptome to change pod2html'd pod into Scriptome pages
180 # (Puts on a navbar, makes tools look fancy, does a bit of cleanup, etc.)
181 $(UNIX_DIR)/%.html: Platform/%.pre_html $(H2S) $(PARAM_DESCS)
182 perl $(H2S) $< > $@
183
184 # (Almost) all Windows pages are just copies of Unix pages that get
185 # formatted a bit differently (to use -e "..." instead of -e '...' for example)
186 $(WINDOWS_DIR)/%.html: Platform/%.pre_html $(H2S) $(PARAM_DESCS)
187 perl $(H2S) -w $< > $@
188
189 # Special handling for home page
190 index.html: index.pre_html $(H2S)
191 perl $(H2S) -h $< > $@
192
193
194 # We do an automatic copy to the dev website. See comment on the
195 # $(WEB_DEV_DIR)/% target.
196 # Use $* so we don't copy to $WEB_DIR_DIR/$DEV_DIR/%
197 # Don't bother copying to WEB if we're on Windows
198 $(DEV_DIR)/%: %
199 ifeq (Windows, $(findstring Windows, $(OS)))
200 copy $(subst /,\,$< $@)
201 copy $(subst /,\,$< $(WEB_DEV_DIR)/$*)
202 else
203 cp $< $@
204 # cp $< $(WEB_DEV_DIR)/$*
205 endif
206
207 # DON'T use dependencies to copy from DEV_DIR into WEB_DEV_DIR. Otherwise,
208 # trying to create things in prod_dir will follow dependencies all the way back
209 # to the pod files in . But it's possible that I have older files in
210 # WEB_DEV_DIR that I'm sure are OK to copy to production, but some newer stuff
211 # in .
212 # Instead, we'll just do an automatic copy into WEB_DEV_DIR whenever we
213 # create a file in DEV_DIR
214 #$(WEB_DEV_DIR)/%: $(DEV_DIR)/%
215 # cp $< $@
216
217 # By default, make would delete all the pre_html files (except those explicitly
218 # mentioned in the Makefile). That worries me a bit, and why bother rerunning
219 # pod2html? So tell make not to delete them.
220 .PRECIOUS: %.pre_html
221
222 #################
223 # Create a copy of DEV_ALL that will then be copied to production
224 # (Latter step must be done on a Windows machine)
225 prod: $(PROD_ALL)
226
227 # Copy things that we're sure worked on the dev website into a dir
228 # which we'll then copy into the true website (which sits somewhere we
229 # can't access from Unix).
230 $(PROD_DIR)/%: $(WEB_DEV_DIR)/%
231 ifeq (Windows, $(findstring Windows, $(OS)))
232 copy $(subst /,\,$< $@)
233 else
234 cp $< $@
235 endif
236
237
238 #################
239 # Create directories
240 $(DEV_ALL_DIRS) $(PROD_ALL_DIRS) $(WEB_DEV_ALL_DIRS):
241 ifeq (Windows, $(findstring Windows, $(OS)))
242 mkdir $(subst /,\,$@)
243 else
244 mkdir $@
245 endif