# Makefile to generate Linux brochure # Copyright 2003 Alan W. Irwin (irwin@beluga.phys.uvic.ca) # This file is part of the Linux Brochure Project (LBP) package. # LBP is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 # as published by the Free Software Foundation. # LBP is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with LBP; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA # Change this to a4 (i.e., make PAPERTYPE=a4) if that paper size is # appropriate for your organization. N.B. this parameter must be # letter or a4. Spelling case is important; A4 won't work. PAPERTYPE=a4 ifneq ($(PAPERTYPE),letter) ifneq ($(PAPERTYPE),a4) $(error PAPERTYPE must be letter or a4) endif endif ifeq ($(PAPERTYPE),letter) PS2EPSSIZE = 8.5x11in PAPERNAME= else PS2EPSSIZE = 21x29.7cm PAPERNAME=a4_ endif # Change these to your LUG (or other Linux organization) name and country code # (e.g., make NAME=vlug COUNTRYCODE=ca) # and provide the appropriate files in the subdirectory lugs (see use of # NAME and COUNTRYCODE in lugs/$(NAME)_$(COUNTRY_CODE)_icons.mk and # lugs/$(NAME)_$(COUNTRYCODE)_*.tex below). NAME=debian COUNTRYCODE=english # Adjust this shell command to change the format of any DATE you have # in the document (see sed substitution for DATE in document below). DATE=$(shell date +%Y%m%d) all: \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked_landscape.pdf \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)thumbnail.png \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)screenshot.png clean: $(RM) $(LUG_CLEAN) \ *~ icons/*~ lugs/*~ www/*~ \ geometry.tex \ left_whitewashed.eps left_whitewashed.pdf \ left.dvi left.aux left.log left.ps left.eps left.pdf \ right_whitewashed.eps right_whitewashed.pdf \ right.dvi right.aux right.log right.ps right.eps right.pdf \ linux_brochure_lug.tex linux_brochure_lug.dvi \ linux_brochure_lug.aux linux_brochure_lug.log \ linux_brochure_lug.ps linux_brochure_lug.pdf \ page123.ps page123.eps page123.aux page123.log page123.pdf \ page450.ps page450.eps page450.aux page450.log page450.pdf \ merge4.dvi merge4.aux merge4.log merge4.ps \ linux_brochure_watermarked.aux \ linux_brochure_watermarked.log \ linux_brochure_watermarked.pdf \ linux_brochure_watermarked_landscape.aux \ linux_brochure_watermarked_landscape.log # Special optional makefile fragment to define and create LUG_ICONS list # of icons and define the LUG_CLEAN list to remove all files created during # the LUG icon generation process. -include debian/$(NAME)_$(COUNTRYCODE)_icons.mk # N.B. All the artwork is generated from sketch files so you need the # sketch package installed. In particular the sk2ps command should be # installed as part of that package. sk2ps is used to convert sketch # files to eps (encapsulated postscript) files. SK2PS = sk2ps # N.B. need ps2eps from # http://www.telematik.informatik.uni-karlsruhe.de/~bless/ps2eps.html to # convert from one-paged postscript (ps) to encapsulated postscript (eps). # You need both ps2eps and bbox (from the package) in your path. The first # is a perl script and the second a small compiled executable required by # the script. # The much better known ps2epsi frankly sucks at this (just bombed out when # I tried it) for these purposes so use ps2eps instead! PS2EPS = ps2eps --removepreview --size $(PS2EPSSIZE) # convert (from ImageMagick) also does a fair job of converting from one-page # ps to eps, but it only copies scalable vector drawing stuff with no font # or letter metadata (helpful when doing antialised rendering). # N.B need epstopdf (from tetex-bin) to convert from eps to pdf since that # programme seems to do a better job than convert (which bitmaps!) for the # particular cases here. Also note, however, that even epstopdf loses the # font and character information (although it retains the vectorized # representation) so the results look bad (no anti-aliasing) when they # include characters. EPS2PDF = epstopdf # N.B. important tetex programmes LATEX = latex DVIPS = dvips -t $(PAPERTYPE) -f PDFLATEX = pdflatex # N.B. important psutils programme (this one actually works!) to merge # pages of a postscript file into a new postscript file PS2PS = pstops -p$(PAPERTYPE) # N.B. leaflet class file (not part of tetex so the leaflet package has # been downloaded from CTAN, and this file has been built from that package # and included in lbproject for convenience with some minor changes to # get the fold mark right). LEAFLET_CLASS = leaflet_$(PAPERTYPE).cls # Linux file copy, move, remove, compress, and stream edit commands CP = cp -f MV = mv -f RM = rm -f GZIP = gzip SED = sed # ImageMagick command for making montage thumbnail and screenshot versions. MONTAGE = montage ######### Geometry # (NOCLEAN) source of latex geometric information for particular PAPERTYPE geometry_$(PAPERTYPE).tex: geometry.tex: geometry_$(PAPERTYPE).tex $(CP) geometry_$(PAPERTYPE).tex geometry.tex ######### Watermarks. # (NOCLEAN) rotated whitewashed penguin icons suitable as watermarks. icons/left_whitewashed.sk: icons/right_whitewashed.sk: # create whitewashed icon suitable for watermark. left_whitewashed.eps: icons/left_whitewashed.sk $(SK2PS) icons/left_whitewashed.sk left_whitewashed.eps left_whitewashed.pdf: left_whitewashed.eps $(EPS2PDF) left_whitewashed.eps > left_whitewashed.pdf right_whitewashed.eps: icons/right_whitewashed.sk $(SK2PS) icons/right_whitewashed.sk right_whitewashed.eps right_whitewashed.pdf: right_whitewashed.eps $(EPS2PDF) right_whitewashed.eps > right_whitewashed.pdf # (NOCLEAN) very specific latex script to crop left_whitewashed.eps left.tex: left.dvi: left.tex geometry.tex left_whitewashed.eps $(LATEX) left.tex left.ps: left.dvi left_whitewashed.eps $(DVIPS) left.dvi > left.ps left.eps: left.ps $(RM) left.eps; $(PS2EPS) left.ps > left.eps left.pdf: left.tex geometry.tex left_whitewashed.pdf $(PDFLATEX) left.tex # (NOCLEAN) very specific latex script to crop right_whitewashed.eps right.tex: right.dvi: right.tex geometry.tex right_whitewashed.eps $(LATEX) right.tex right.ps: right.dvi right_whitewashed.eps $(DVIPS) right.dvi > right.ps right.eps: right.ps $(RM) right.eps; $(PS2EPS) right.ps > right.eps right.pdf: right.tex geometry.tex right_whitewashed.pdf $(PDFLATEX) right.tex ######### postscript 6-page output # (NOCLEAN) This is the one to edit if you want to change any of the core # generic wording. linux_brochure.tex: # This is a list of files that need to be edited to customize the look and # feel of any institution's Linux brochure. LUG_CUSTOMIZATION_FILES = \ debian/layout.tex debian/preamble.tex debian/$(COUNTRYCODE).tex $(LUG_CUSTOMIZATION_FILES): linux_brochure_lug.tex: linux_brochure.tex $(SED) \ -e "s?PAPERTYPE?$(PAPERTYPE)?g" \ -e "s?NAME?$(NAME)?g" \ -e "s?COUNTRYCODE?$(COUNTRYCODE)?g" \ -e "s?DATE?$(DATE)?g" \ linux_brochure_lug.tex # (NOCLEAN) $(LEAFLET_CLASS): linux_brochure_lug.dvi: linux_brochure_lug.tex \ $(LUG_ICONS) $(LEAFLET_CLASS) \ $(LUG_CUSTOMIZATION_FILES) $(LATEX) linux_brochure_lug.tex linux_brochure_lug.ps: linux_brochure_lug.dvi $(LUG_ICONS) $(DVIPS) linux_brochure_lug.dvi > linux_brochure_lug.ps ######## pdf output linux_brochure_lug.pdf: linux_brochure_lug.tex \ $(LUG_ICONS) $(LEAFLET_CLASS) \ $(LUG_CUSTOMIZATION_FILES) $(PDFLATEX) linux_brochure_lug.tex ######## "folded" postscript output (6 leaflet pages arranged on two sides ######## of sheet of paper that can be Z-folded to make the 6-page leaflet). # Prepare first side made up of pages 1,2,3 (where pages are numbered from # 0-5). Command is adapted from fold.sh script included with latex # leaflet package from CTAN. page123.ps: linux_brochure_lug.ps $(PS2PS) "6:1L(1h,0pt)+2L(1h,0.3333334h)+3L(1h,0.6666667h)" \ linux_brochure_lug.ps page123.ps page123.eps: page123.ps $(RM) page123.eps; $(PS2EPS) page123.ps > page123.eps page123.pdf: page123.pdflatex geometry.tex linux_brochure_lug.pdf $(PDFLATEX) page123.pdflatex # Prepare second side made up of pages 4,5,0 (where pages are numbered from # 0-5). Command is adapted from fold.sh script included with latex # leaflet package from CTAN. page450.ps: linux_brochure_lug.ps $(PS2PS) "6:4L(1h,0pt)+5L(1h,0.3333334h)+0L(1h,0.6666667h)" \ linux_brochure_lug.ps page450.ps page450.eps: page450.ps $(RM) page450.eps; $(PS2EPS) page450.ps > page450.eps page450.pdf: page450.pdflatex geometry.tex linux_brochure_lug.pdf $(PDFLATEX) page450.pdflatex # Make postscript file combining each side and the watermark for that # side in 4 separate pages. # (NOCLEAN) specific latex to do the merge of the eps files. merge4.tex: merge4.dvi: merge4.tex geometry.tex right.eps page123.eps left.eps page450.eps $(LATEX) merge4.tex merge4.ps: merge4.dvi right.eps page123.eps left.eps page450.eps $(DVIPS) merge4.dvi > merge4.ps # (Finally) make watermarked brochure. $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz: merge4.ps $(PS2PS) "4:0+1,2+3" merge4.ps linux_brochure_watermarked.ps; \ $(MV) linux_brochure_watermarked.ps \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps; \ $(RM) $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz; \ $(GZIP) $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps # (NOCLEAN) linux_brochure_watermarked.pdflatex: linux_brochure_watermarked.pdf: linux_brochure_watermarked.pdflatex \ geometry.tex right.pdf page123.pdf left.pdf page450.pdf $(PDFLATEX) linux_brochure_watermarked.pdflatex # (NOCLEAN) linux_brochure_watermarked_landscape.pdflatex: $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked_landscape.pdf: \ linux_brochure_watermarked.pdf \ linux_brochure_watermarked_landscape.pdflatex geometry.tex $(PDFLATEX) linux_brochure_watermarked_landscape.pdflatex; \ $(MV) linux_brochure_watermarked_landscape.pdf \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked_landscape.pdf $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)thumbnail.png: \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz $(MONTAGE) -rotate 90 -geometry x90 \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz"[1]" \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz"[0]" \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)thumbnail.png $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)screenshot.png: \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz $(MONTAGE) -rotate 90 -geometry x900 \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz"[1]" \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)linux_brochure_watermarked.ps.gz"[0]" \ $(NAME)_$(COUNTRYCODE)_$(PAPERNAME)screenshot.png