# Top Makefile for linuxdoc-make include ./bin/variables include ./bin/rules M4PATH=include export M4PATH RCS=$Id: Makefile,v 1.4 2002/09/20 23:50:00 gilles Exp $ 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 )v endef define DATE $(shell \ date '+%Y%m%d%H%M%S' ) endef INDEX.html=index.html INDEX.m4=.index.m4 INDEX.memo=.index.memo 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 rtf dvi info lyx ps tex man pdf sgml \ clone clean-clone \ clean clean-html clean-htm clean-txt clean-rtf \ clean-dvi clean-info clean-lyx clean-ps \ clean-tex clean-man \ dist clean-dist \ test \ i clean-indexes \ navsquare ns \ lfo rules date dist-dir-test \ html_dir htm_dir txt_dir dvi_dir rtf_dir ps_dir tex_dir \ info_dir lyx_dir man_dir pdf_dir all: html htm txt rtf dvi ps lyx tex man pdf h info date: @date '+[%Y %m %d %H:%M:%S] %Y %B %d %A %Z' define MYNAME_LST $(shell \ echo `find . -name .myname` ) endef define INDEX.m4_LST $(shell \ echo `find . -name $(INDEX.m4)`;\ ) 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)) 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) $(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); \ fms=$$dirfhd/$(INDEX.memo); \ pwd=`pwd`; \ if [ -f $$fm4 ]; then \ echo "exists $$fm4" ;\ cmd="M4PATH=include m4 -P -DM4_HERE=$$dirfhd $$fm4 > $$fml" ;\ echo "M4PATH=include m4 -P -DM4_HERE=$$dirfhd $$fm4 > $$fml" ;\ echo "cd $$pwd && $$cmd" > $$fms;\ 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 -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 | #-------------+ clean: find . -name "*~" -exec rm {} \; dist: dist-dir-test testf clean-test2 clean-dist cleanf doc nsf if clean-dvi mkdir -p $(DIST_DIR) # rm -f $(DIST_DIR)/$(DIST).tgz cd .. && ls -d ./$(DIST) && tar czvf ./$(DIST).tgz ./$(DIST) mv ../$(DIST).tgz $(DIST_DIR) cd $(DIST_DIR) && echo \ > ./README &&\ echo You can check the md5sum: >> ./README &&\ md5sum $(DIST).tgz >> README &&\ echo \ >> ./README du -sk $(DIST_DIR)/$(DIST).tgz @echo The Tarball is $(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 clean-dist: rm -f $(DIST_DIR)/*.tgz rm -f $(DIST_DIR)/README lfo: dist if rsync rsync: 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 # memo: # make tidy TIDY='echo aaa' TIDY=echo yoyo tidy: $(TIDY) #-----------------+ # 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' anything touch .nav.done navsquare: .nav.done ns: navsquare nsf: clean-nav ns #---------+ # default | #---------+ default: # @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo " BULDING THE DOCUMENTATION " @echo " You can do :" @echo " make all # to build everything" @echo " make indexes # to build $(INDEX.html)" @echo " make clean # to clean everything" @echo "" @echo " $(DIST_NAME) $(VERSION)" # @echo "" @echo "$(RCS)" # @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"