SHELL = /bin/sh DESTDIR = $(ZIP_DIR)/bulk TEMP_BULKDIR = $(DESTDIR)/tmp-bulkmake ZIP = bulk.zip # We build a careful list of files to include in the bulk file. # (We don't want any Makefiles, READMEs, or other debris.) # ROOTFILES = abbrev.html begin.html bfaq.html faq.html \ glossary.html help.html history.html \ index-author.html index-names.html index-number.html index-similes.html \ index-subject.html index-sutta.html index-title.html index.html \ search.html # (note that we don't include the news files). # These are non-html files (shell scripts, etc.) GEEKWARE = \ tech/includes/*\ tech/scripts/* INCLUDE = $(ROOTFILES) \ canon/*.html \ canon/abhidhamma/*.html\ canon/vinaya/*.html\ canon/sutta/*.html\ canon/sutta/digha/*.html\ canon/sutta/majjhima/*.html\ canon/sutta/samyutta/*.html\ canon/sutta/anguttara/*.html\ canon/sutta/khuddaka/*.html\ canon/sutta/khuddaka/dhp/*.html canon/sutta/khuddaka/dhp/*/*.html\ canon/sutta/khuddaka/iti/*.html\ canon/sutta/khuddaka/khp/*.html\ canon/sutta/khuddaka/suttanipata/*.html\ canon/sutta/khuddaka/theragatha/*.html\ canon/sutta/khuddaka/therigatha/*.html\ canon/sutta/khuddaka/udana/*.html\ canon/sutta/khuddaka/miln/*.html canon/sutta/khuddaka/miln/*/*.html\ cdrom/*html\ css/*.css\ icon/*.gif icon/*.jpg icon/*.ico\ icon/flags/*.gif\ lib/*.html\ lib/study/*.html\ lib/study/aids/*.html\ lib/authors/*.html\ lib/authors/*/*.html\ lib/authors/*/images/*.gif\ lib/authors/*/images/*.jpg\ lib/authors/*/*/*.html\ lib/authors/*/*/images/*.gif\ lib/authors/*/*/images/*.jpg\ lib/bps/*.html\ lib/bps/misc/*.html\ lib/bps/news/*.html\ lib/bps/wheels/*.html\ lib/bps/wheels/wheel206/*.html\ lib/thai/*.html lib/thai/*/*.html\ noncanon/*.html noncanon/*/*.html\ outsources/*.html\ ptf/*.html\ ptf/dhamma/*.html\ ptf/dhamma/dana/*.html ptf/dhamma/sila/*.html\ ptf/dhamma/sagga/*.html ptf/dhamma/nekkhamma/*.html\ ptf/dhamma/adinava/*.html ptf/dhamma/sacca/*.html\ ptf/dhamma/sacca/sacca?/*.html\ ptf/dhamma/sacca/sacca4/samma-*/*.html\ tech/*.html\ tech/*/*html\ $(GEEKWARE)\ zip/bulk/bulk.html ################################################################# # These are the files that contain tags concerning the bulk file. # Some may have to be edited, others may need to be stamped with # the bulk version number and bulk date. They all need to be # examined. # # To generate this list, do # # find . -type f -name \*html -exec grep -l _BULK {} \; | sed -e "s/\.\///" -e "s/html/html\\/" # # and paste the results below (put a backslash at the end of every line but the last): BULKFIX = \ 404.html\ canon/index.html\ cdrom/index.html\ extras/index.html\ faq.html\ glossary.html\ help.html\ index-author.html\ index-names.html\ index-number.html\ index-similes.html\ index-subject.html\ index-sutta.html\ index-title.html\ index.html\ lib/authors/bullitt/learningpali.html\ lib/authors/desilva/index.html\ lib/authors/medhanandi/index.html\ lib/authors/nanananda/index.html\ lib/authors/nyanasamvara/index.html\ lib/authors/thanissaro/index.html\ lib/bpslist.html\ lib/index.html\ news/index.html\ noncanon/index.html\ outsources/index.html\ ptf/dhamma/sila/uposatha2005.html\ ptf/index.html\ search.html\ tech/download/bulk.html\ tech/index.html\ tech/youcanhelp.html # jtb 050314 # These are the files that need to have the bulk version no. updated # # To generate the list, do # # find . -type f -name \*html -exec grep -l _BULKVERSION {} \; | sed -e "s/\.\///" -e "s/html/html\\/" # # and paste the results below (adding the backslash to all but the last line): BULKVERSION_FILES = \ index.html\ news/index.html\ tech/download/bulk.html ################################################################# # Prevent careless execution of this makefile by intercepting the default all: @ echo Warning\! Use \'makebulk\' to run this makefile. @ Goodbye. ################################################################# ################################################################# # Update the zip file to include any changed files from the website # $(ZIP): $(INCLUDE) @ echo "New bulk version $(makebulk_BULK_VERSION) ($(makebulk_BULK_DATE))" stamp_bulk $(makebulk_BULK_VERSION) $(makebulk_BULK_DATE) $(makebulk_BULK_NAME) $(BULKVERSION_FILES) stamp_rev-date $(BULKVERSION_FILES) @ echo "Updating $(ZIP)" zip -u $(DESTDIR)/$(ZIP) $(INCLUDE) chmod a+r $(DESTDIR)/$(ZIP) echo done. ################################################################# ################################################################# # After bulk.zip has been updated, it may contain some files # that require editing -- for example, files from the live website # that refer to the search engine, or files that need a bulk version # stamp, etc. These files are edited by un-commenting or deleting # specially tagged chunks of text. # The following takes care of this by extracting the relevant files, # sed'ing them, and then replacing them. # # jtb 010719: The following zip command may insert new zero-size # files (directories) into the bulk file. These files are unnecessary # and unaestethic. But it's easiest just to let them be, and # sed them out of file listings. See my comment in bulklist. bulkfix: $(BULKFIX) @ cd $(DESTDIR) ;\ mkdir $(TEMP_BULKDIR) #create a temporary space in which to work @ cd $(TEMP_BULKDIR); \ unzip $(DESTDIR)/$(ZIP) $(BULKFIX); \ find . -type f -exec bulkfix $(makebulk_BULK_VERSION) $(makebulk_BULK_DATE) $(makebulk_BULK_NAME) {} \; ;\ echo "bulkfixes are done." ; \ echo "Now updating $(DESTDIR)/$(ZIP)" ; \ zip -u -r $(DESTDIR)/$(ZIP) * @ /bin/rm -fR $(TEMP_BULKDIR) @ echo BULKMAKE done. ################################################################# kill: rm $(DESTDIR)/$(ZIP)