# Top Makefile for linuxdoc-make RCS=$$Id: Makefile,v 1.94 2002/08/19 05:43:43 gilles Exp $ # $Log: Makefile,v $ # Revision 1.94 2002/08/19 05:43:43 gilles # Made make cleanf harder # # Revision 1.93 2002/08/15 00:39:43 gilles # Added html in "make doc" # # Revision 1.92 2002/08/15 00:19:12 gilles # In make clone, override.m4 is copied from proto.m4 # # Revision 1.91 2002/08/15 00:04:12 gilles # project name is taken from CLONE variable # # Revision 1.90 2002/08/14 23:33:21 gilles # Added message about override.m4 in "make clone" # # Revision 1.89 2002/07/28 22:47:38 gilles # clean-hd does not remove indexes now # # Revision 1.88 2002/07/28 22:43:37 gilles # Changed RCS definition # # Revision 1.87 2002/07/28 22:07:01 gilles # Added link test for index files # # Revision 1.86 2002/07/28 21:00:33 gilles # fixed clone .myname # # Revision 1.85 2002/06/09 00:37:39 gilles # Adapted to new navsquare release # # Revision 1.84 2002/06/08 20:33:29 gilles # use of $(INCLUDE) variable # # Revision 1.83 2002/06/08 18:43:46 gilles # Added local .index.memo to regenerate indexes # Added better automatic html index files # # Revision 1.82 2002/06/08 16:16:46 gilles # Added rcs log tag # include ./bin/variables include ./bin/rules M4PATH=include export M4PATH INCLUDE=include DEFINITIONS=$(INCLUDE)/definitions.m4 define VERSION $(shell \ if [ -f ./$(DEFINITIONS) ]; then\ (cat $(DEFINITIONS) ;\ echo M4_VERSION)|M4PATH=$(M4PATH) m4 -P;\ else \ echo "unknown";\ fi ) endef define DATE $(shell \ date '+%Y%m%d%H%M%S' ) endef INDEX.html=index.html INDEX.m4=.index.m4 define NAV.html $(shell \ if [ -f ./$(DEFINITIONS) ]; then\ (cat $(DEFINITIONS) ;\ echo M4_NAV_FILENAME)|M4PATH=$(M4PATH) m4 -P;\ else \ echo "unknown";\ fi ) endef define MYNAME.sh $(shell \ if bin/myname.sh 2>/dev/null 1>&2; then \ echo "bin/myname.sh";\ else \ echo @echo no myname.sh;\ fi ) endef define DIST_NAME $(shell \ if [ -f ./$(DEFINITIONS) ]; then\ (cat $(DEFINITIONS) ;\ echo M4_SOFTWARE)|M4PATH=$(M4PATH) m4 -P;\ else \ echo "unknown";\ fi ) endef DIST=$(DIST_NAME)-$(VERSION) DIST_DIR=./00_dist/ CLONE=clone .PHONY: default help help: default .PHONY: all html htm txt txt2 rtf dvi info lyx ps tex man pdf sgml \ clone clean-clone \ clean clean-html clean-htm clean-txt clean-txt2 clean-rtf \ clean-dvi clean-info clean-lyx clean-ps \ clean-tex clean-man \ dist clean-dist \ test \ navsquare ns \ lfo lfot rules rules-clean date dist-dir-test \ html_dir htm_dir txt_dir txt2_dir dvi_dir rtf_dir ps_dir tex_dir \ info_dir lyx_dir man_dir pdf_dir \ lh all: html htm txt rtf dvi ps lyx tex man pdf indexes info date: @date '+[%Y %m %d %H:%M:%S] %Y %B %d %A %Z %z' define MYNAME_LST $(shell \ echo `find . -name .myname|grep -v ./clone` ) endef define INDEX.m4_LST $(shell \ echo `find . -name $(INDEX.m4)|grep -v ./clone` ) endef INDEX.html_LST=$(patsubst %.myname,%$(INDEX.html), $(MYNAME_LST)) NAV_LST=$(patsubst %.myname,%$(NAV.html), $(MYNAME_LST)) SGML_LST_M4=$(patsubst %.m4,%.sgml, $(wildcard ./sgml/*.m4)) SGML_LST_LS=$(wildcard ./sgml/*.sgml) $(SGML_LST_M4) HTM_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(HTM_DIR)/%.htm, $(SGML_LST_LS)) HTML_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(HTML_DIR)/%.html, $(SGML_LST_LS)) TXT_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(TXT_DIR)/%.txt, $(SGML_LST_LS)) TXT2_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(TXT2_DIR)/%.txt, $(SGML_LST_LS)) DVI_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(DVI_DIR)/%.dvi, $(SGML_LST_LS)) RTF_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(RTF_DIR)/%.rtf, $(SGML_LST_LS)) PS_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(PS_DIR)/%.ps, $(SGML_LST_LS)) TEX_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(TEX_DIR)/%.tex, $(SGML_LST_LS)) INFO_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(INFO_DIR)/%.info, $(SGML_LST_LS)) LYX_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(LYX_DIR)/%.lyx, $(SGML_LST_LS)) MAN_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(MAN_DIR)/%.1, $(SGML_LST_LS)) PDF_FROM_SGML=$(patsubst ./sgml/%.sgml,./$(PDF_DIR)/%.pdf, $(SGML_LST_LS)) dump: @echo $(H) #---------------+ # indexes stuff | #---------------+ i: indexes if: clean-hd i indexes: .indexes.done INDEX.memo=.index.memo clean-hd: # rm -f $(INDEX.html_LST) rm -f .indexes.done $(INDEX.html_LST): $(MYNAME_LST) $(INDEX.m4_LST) .indexes.done: $(INDEX.html_LST) $(INDEX.m4_LST) .nav.done list="$(INDEX.html_LST)";\ for fhd in $${list}; do \ dirfhd=`dirname $$fhd`; \ fm4=$$dirfhd/$(INDEX.m4); \ fml=$$dirfhd/$(INDEX.html); \ fms=$$dirfhd/$(INDEX.memo); \ pwd=`pwd`; \ if [ -L $$fml ]; then \ echo "symlink $$fml" ;\ elif [ -f $$fm4 ]; then \ echo "exists $$fm4" ;\ cmd="M4PATH=$(M4PATH) m4 -P -DM4_HERE=$$dirfhd $$fm4 > $$fml" ;\ echo "$$cmd";\ echo "cd $$pwd && $$cmd" > $$fms;\ eval "$$cmd";\ else \ echo "no exists $$fm4" ;\ echo "creating $$fml" ;\ cat $(INCLUDE)/head.html $(INCLUDE)/body_begin.html > $$fml ;\ cat $$dirfhd/$(NAV.html) >> $$fml ;\ echo "
" >> $$fml ;\
			(ls -d .. && ls -CF -X -w 80 $$dirfhd) | bin/lshtml.pl >> $$fml;\
			echo "
" >> $$fml ;\ cat $(INCLUDE)/body_end.html $(INCLUDE)/tail.html >> $$fml ;\ fi ;\ done touch .indexes.done h-htm: htm_dir $(HTM_FROM_SGML) i #-------------+ # directories | #-------------+ html_dir: mkdir -p $(HTML_DIR) -$(MYNAME.sh) $(HTML_DIR) htm_dir: mkdir -p $(HTM_DIR) -$(MYNAME.sh) $(HTM_DIR) txt_dir: mkdir -p $(TXT_DIR) -$(MYNAME.sh) $(TXT_DIR) txt2_dir: mkdir -p $(TXT2_DIR) -$(MYNAME.sh) $(TXT2_DIR) dvi_dir: mkdir -p $(DVI_DIR) -$(MYNAME.sh) $(DVI_DIR) rtf_dir: mkdir -p $(RTF_DIR) -$(MYNAME.sh) $(RTF_DIR) ps_dir: mkdir -p $(PS_DIR) -$(MYNAME.sh) $(PS_DIR) tex_dir: mkdir -p $(TEX_DIR) -$(MYNAME.sh) $(TEX_DIR) info_dir: mkdir -p $(INFO_DIR) -$(MYNAME.sh) $(INFO_DIR) lyx_dir: mkdir -p $(LYX_DIR) -$(MYNAME.sh) $(LYX_DIR) man_dir: mkdir -p $(MAN_DIR) -$(MYNAME.sh) $(MAN_DIR) pdf_dir: tex_dir mkdir -p $(PDF_DIR) -$(MYNAME.sh) $(PDF_DIR) sgml: $(SGML_LST_M4) html: html_dir $(HTML_FROM_SGML) htm: htm_dir $(HTM_FROM_SGML) txt: txt_dir $(TXT_FROM_SGML) txt2: txt2_dir $(TXT2_FROM_SGML) dvi: dvi_dir $(DVI_FROM_SGML) rtf: rtf_dir $(RTF_FROM_SGML) ps: ps_dir $(PS_FROM_SGML) .SECONDARY: $(TEX_FROM_SGML) .INTERMEDIATE: $(TEX_FROM_SGML) tex: tex_dir $(TEX_FROM_SGML) info: info_dir $(INFO_FROM_SGML) lyx: lyx_dir $(LYX_FROM_SGML) man: man_dir $(MAN_FROM_SGML) pdf: pdf_dir $(PDF_FROM_SGML) clean: clean-html clean-htm clean-txt clean-rtf \ clean-dvi clean-info clean-lyx clean-ps \ clean-tex clean-man clean-pdf clean-sgml \ clean-hd find . -name "*~" -exec rm {} \; cleanf: clean cleanf-rtf cleanf-html clean-sgml \ clean-memo clean-clone clean-rules clean-dist \ clean-dist clean-nav clean-memo: find . -name $(INDEX.memo) -exec rm {} \; clean-sgml: rm -f $(SGML_LST_M4) clean-html: -rm -f $(HTML_FROM_SGML) cleanf-html: -rm -f $(HTML_DIR)/*.html clean-htm: -rm -f $(HTM_FROM_SGML) clean-txt: -rm -f $(TXT_FROM_SGML) clean-dvi: -rm -f $(DVI_FROM_SGML) clean-rtf: -rm -f $(RTF_FROM_SGML) cleanf-rtf: -rm -f rtf/*.rtf clean-ps: -rm -f $(PS_FROM_SGML) clean-tex: -rm -f $(TEX_FROM_SGML) clean-info: -rm -f $(INFO_FROM_SGML) clean-lyx: -rm -f $(LYX_FROM_SGML) clean-man: -rm -f $(MAN_FROM_SGML) clean-pdf: -rm -f $(PDF_FROM_SGML) clonef: clean-clone clone clone: mkdir -p $(CLONE) &&\ cd $(CLONE) &&\ mkdir -p bin $(INCLUDE) sgml &&\ cp -f ../sgml/.myname ./sgml &&\ cp -f ../bin/makerules.pl ../bin/rules ../bin/variables \ ../bin/formatav.pl ../bin/date.pl ../bin/listfiles.pl \ ../bin/lshtml.pl ../bin/myname.sh \ ./bin/ &&\ cp -f ../Makefile ../$(INDEX.m4) . &&\ echo "$(CLONE)" > .myname &&\ echo "m4_define(\`M4_SOFTWARE',\`$(CLONE)')m4_dnl" > ./$(INCLUDE)/clone.m4 &&\ cp -f ../$(INCLUDE)/proto.m4 ./$(INCLUDE)/override.m4 &&\ cp -f ../$(INCLUDE)/*.m4 ./$(INCLUDE) &&\ chmod u+w ./$(INCLUDE)/override.m4 &&\ cp -f ../$(INCLUDE)/*.html ./$(INCLUDE) @echo "You can rename and move the directory named ./$(CLONE)/" @echo "and use it exactly like this one (./)" @echo "Update the file ./$(CLONE)/$(INCLUDE)/override.m4" @echo "Happy doc !" clonee: clone cp -f ./sgml/lidoma-model.??.sgml $(CLONE)/sgml clean-clone: rm -rf $(CLONE) clean-test2: rm -rf $(CLONE) doc: html htm txt clean-rules: rm -f bin/rules-* rules: bin/rules bin/rules: bin/makerules.pl @echo saving file $@ to $@-$(DATE) if [ -f $@ ]; then cp $@ $@-$(DATE); fi ./bin/makerules.pl > $@ # This is my local section. Will be less local in next release. dist-dir-test: @if [ -d ../$(DIST) ]; then \ echo good ../$(DIST) exists;\ else \ echo bad ../$(DIST) is not a directory;\ /bin/false;\ fi README=./README.html tarball: mkdir -p $(DIST_DIR) # rm -f $(DIST_DIR)/$(DIST).tgz cd .. && ls -d ./$(DIST) && tar czvf ./$(DIST).tgz ./$(DIST) mv ../$(DIST).tgz $(DIST_DIR) du -sk $(DIST_DIR)/$(DIST).tgz @echo The Tarball is $(DIST_DIR)/$(DIST).tgz tarball-pre: dist-dir-test testf clean-test2 \ clean-rules clean-dist cleanf doc nsf clean-dvi if dist: tarball-pre tarball md5dist dist-check: cd ../linuxdoc-make-check &&\ tar xzvf ../$(DIST)/$(DIST_DIR)/$(DIST).tgz t1: tarball-pre t2: clean-hd if clean-dist: rm -f $(DIST_DIR)/*.tgz # echo coucou > $(DIST_DIR)/$(README) # touch $(DIST_DIR)/$(DIST).tgz testf: clean-test test md5dist: cd $(DIST_DIR) && echo \ > $(README) &&\ echo You can check the md5sum: >> $(README) &&\ md5sum $(DIST).tgz >> $(README) &&\ echo \ >> $(README) md5distt: cd $(DIST_DIR) && md5sum $(DIST).tgz clean-test: clean-clone test: clone if [ ! -f clone/sgml/lidoma-model.fr.sgml ]; then \ cp sgml/lidoma-model.??.sgml clone/sgml/ ;\ fi cd clone/ && make pdf s lfo: dist clean-hd if rsync lfot: dist clean-hd if rsync: mkdir -p ../$(DIST_NAME)-archive cp $(DIST_DIR)/$(DIST).tgz ../$(DIST_NAME)-archive/ rsync -alptvz --delete ./ \ /home/gilles/public_html/www.linux-france.org/html/prj/$(DIST_NAME) du -sk $(DIST_DIR)/$(DIST).tgz s: site site: clean-hd h-htm # make tidy TIDY='echo aaa' TIDY=tidy -i -latin1 -m tidy: -$(TIDY) $(HTM_DIR)/*.htm -$(TIDY) $(HTML_DIR)/*.html #-----------------+ # navsquare stuff | #-----------------+ $(NAV_LST): $(MYNAME_LST) clean-nav: rm -f .nav.md5 .nav.done find . -name $(NAV.html) | xargs rm -f .nav.done: $(NAV_LST) $(MYNAME_LST) navsquare --output=$(NAV.html) --root=. --nosave \ $(INDEX.html_LST) touch .nav.done navsquare: .nav.done ns: navsquare nsf: clean-nav ns #---------+ # default | #---------+ hl: @echo "make rules # The old file will be saved with the current date" @echo "make md5dist # generate 00_dist/$(README)" @echo "make dist # generate the tarball" default: # @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo " BULDING THE DOCUMENTATION " @echo " make all # to build everything" @echo " make i # to build $(INDEX.html)" @echo " make clean # to clean everything" @echo " make clean-xxx # to clean xxx output (make clean-html per ex.)" @echo " make html # build html in several pages ending with .html" @echo " make htm # build html in one single page ending with .htm" @echo " make tidy # cleanup html files with tidy" @echo " make txt # build ASCII files" @echo " make txt2 # build ASCII files with lynx" @echo " make man # build man pages (buggy)" @echo " make pdf # build PDF files" @echo " make ps # build postscript" @echo " make info # build info files (buggy)" @echo " make lyx # build lyx files" @echo " make dvi # build dvi files" @echo " make tex # build LaTeX files" @echo " make rtf # build RTF files (ugly)" @echo "" @echo " BULDING A CLONE " @echo " make clone # build a clone directory to be moved anywhere" @echo " make clone CLONE=foo # build a clone directory named foo" @echo "" @echo " $(DIST_NAME) $(VERSION)" # @echo "" @echo "RCS tag $(RCS)" # @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"