# Top Makefile for linuxdoc-make include ./bin/variables include ./bin/rules M4PATH=include export M4PATH RCS=$Id: Makefile,v 1.78 2002/01/11 08:13:22 gilles Exp gilles $ INCLUDE=include DEFINITIONS=$(INCLUDE)/definitions.m4 define VERSION $(shell \ if [ -f ./$(DEFINITIONS) ]; then\ (cat $(DEFINITIONS) ;\ echo M4_VERSION)|M4PATH=include 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=include 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=include 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 \ i clean-indexes \ 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 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 \ echo "file $$fhd"; \ dirfhd=`dirname $$fhd`; \ fm4=$$dirfhd/$(INDEX.m4); \ fml=$$dirfhd/$(INDEX.html); \ if [ -f $$fm4 ]; then \ echo "exists $$fm4" ;\ echo "M4PATH=include m4 -P -DM4_HERE=$$dirfhd $$fm4 > $$fml" ;\ M4PATH=include m4 -P -DM4_HERE=$$dirfhd $$fm4 > $$fml;\ else \ echo "no exists $$fm4" ;\ echo "creating $$fml" ;\ cat include/head.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/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-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 &&\ cp -f ../$(INCLUDE)/*.m4 ./$(INCLUDE) &&\ cp -f ../$(INCLUDE)/lidoma.m4 ./$(INCLUDE)/override.m4 &&\ 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 "Happy doc !" clonee: clone cp -f ./sgml/lidoma-model.??.sgml $(CLONE)/sgml clean-clone: rm -rf $(CLONE) clean-test2: rm -rf $(CLONE) doc: htm txt pdf rules-clean: 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 \ rules-clean clean-dist cleanf doc nsf clean-dvi if dist: tarball-pre tarball md5dist t1: tarball-pre t2: clean-hd if clean-dist: rm -f $(DIST_DIR)/*.tgz echo coucou > $(DIST_DIR)/$(README) 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:clean-myml clean-myml: rm -f $(NAV_LST) .nav.done: $(NAV_LST) $(MYNAME_LST) navsquare --output=$(NAV.html) \ --root=./ --topbottom --nosave --sbgcolor '00FFFF' 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)" # @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"