#---------------------------------------------------------------------
# Copyright (C) GFD Dennou Club, 2005. All rights reserved.
#---------------------------------------------------------------------
#= Export source codes from cvsroot, and compress them.
#
# * Yasuhiro MORIKAWA, Masaki ISHIWATARI
# * 2006/08/09 (Yasuhiro MORIKAWA) "rdoc-dennou" is renamed to "rdoc-f95"
# * 2005/10/10 (Yasuhiro MORIKAWA) "CURTAG" is devided to "TAG" and "DIR".
# "OVERWRITE", "CLEANARCH" are added.
# * 2005/06/30 (Yasuhiro MORIKAWA) "Current_CVS_Tag.mk" is included
# * 2005/06/23 (Yasuhiro MORIKAWA) Japanese commends are added
# * 2005/06/12 (Yasuhiro MORIKAWA) Create
#
######################################################################
#
#== Settings
#
# [JAPANESE] 各種設定項目
INCLUDEFILE = Current_CVS_Tag.mk
include $(INCLUDEFILE) # Include file (optional)
# [JA] インクルードファイル (任意)
CVS_ROOT = /GFD_Dennou_Club/ftp/arch/dcmodel/cvsroot
# cvsroot (necessary)
# [JA] cvsroot のディレクトリ (必須)
RUBY = ruby
#RUBYMAJORVER = 1.9
RUBYMAJORVER = 1.8
#RUBYMINORVER = 1.9.0-0
RUBYMINORVER = 1.8.7-p72
MAKEDOC = cd $(DIR) ; \
RUBYLIB=/GFD_Dennou_Club/ftp/arch/dcmodel/lib/ruby/1.8 \
PATH=/GFD_Dennou_Club/ftp/arch/dcmodel/bin:$$PATH \
make doc ; \
cd ../ ; \
test -f add_prefix_href.rb && \
$(RUBY) add_prefix_href.rb --prefix rdoc-f95/doc/files $(DIR)/doc/files/README_ja.html \
| sed 's|
.*|Enhanced version of RDoc Fortran 90/95 parser|' \
| sed 's|\.\./\.\./rdoc-f95-mailto\.png|rdoc-f95/rdoc-f95-mailto.png|' \
> ../index.html ;\
test -d patch_tmp || mkdir patch_tmp ; cd patch_tmp ; \
wget ftp://ftp.ruby-lang.org/pub/ruby/$(RUBYMAJORVER)/ruby-$(RUBYMINORVER).tar.gz ; \
tar xvfz ruby-$(RUBYMINORVER).tar.gz ;\
diff -Nur --exclude=doc ruby-$(RUBYMINORVER)/lib/rdoc/ ../$(DIR)/ > ../$(RDOCTAG)_ruby$(RUBYMINORVER).patch ;\
test -d ruby-$(RUBYMINORVER) && rm -r ruby-$(RUBYMINORVER) ; rm ruby-$(RUBYMINORVER).tar.gz ;\
cd .. ; rmdir patch_tmp ;\
test -f $(RDOCTAG)_ruby$(RUBYMINORVER).patch && ln -sf $(RDOCTAG)_ruby$(RUBYMINORVER).patch rdoc-f95_ruby$(RUBYMINORVER).patch
# sed 's|||' $(DIR)/doc/files/README_ja.html | \
# sed 's| ../index.html ;\
# Commands excuted after exported (optional)
# [JA] export 後, tar によるアーカイブ
# 前に実行するコマンド群 (任意)
PROJECT = $(RDOCPROJ)
# Project name in cvs (necessary)
# [JA] cvs のプロジェクト名 (必須)
TAG = -r $(RDOCTAG)
#TAG = -D "2030-12-31"
# Tag (-r) or date (-D) in cvs (necessary)
# [JA] タグ (-r) または日付 (-d) (必須)
DIR = $(RDOCTAG)
# Directory name for archive (necessary)
# [JA] 展開するディレクトリ名 (必須)
#CURNAME =
CURNAME = $(PROJECT)_current
# Latest symbolic link (optional)
# [JA] 最新版につけるシンボリック
# リンク名. 空の場合, シンボ
# リックリンクは作成しない (任意)
TGZ = tgz
# Suffix of archive (necessary)
# [JA] アーカイブの拡張子 (必須)
TGZLIST =
#TGZLIST = /GFD_Dennou_Club/ftp/arch/dcmodel/bin/tgzlist-html.rb
# "tgzlist-html.rb" command that create
# archive list HTML (optional)
# [JA] HTML のアーカイブリストを作成する
# "tgzlist-html.rb" へのパス.
# 空の場合, リストは作成されない. (任意)
OVERWRITE = 0
# Overwrite mode (optional)
# [JA] 1 にすると, 既に DIR が
# 存在しても上書きする (任意)
CLEANARCH = 0
# Clean directory and tar archive (optional)
# [JA] 1 にすると, 展開したディレク
# トリを削除し, tgz アーカイブ
# を作成しない. (任意)
RUBY = ruby1.8 # Path to Ruby (optional)
# [JA] Ruby へのパス (任意)
CVS = cvs # cvs command (necessary)
# [JA] cvs へのパス (必須)
GATE = /usr/local/bin/gate-user-show
# Path to "gate-user-show" (optional)
# [JA] "gate-user-show" へのパス (任意)
# 空の場合, SIGEN ファイルを作成しない
# End Settings [JA] 設定項目ここまで
######################################################################
#== SIGEN file
#
SIGENDIR = $(DIR).SIGEN
SIGENTGZ = $(DIR).$(TGZ).SIGEN
######################################################################
#== Get Japanese name from gate-toroku-system
#
GATEJPNAME=`$(GATE) $(USER) | grep kname | cut -d":" -f 2`
######################################################################
#== Generate archive list by "tgzlist-html.rb"
#
TGZLIST_CMD = $(RUBY) $(TGZLIST) \
-o index --exclude $(CURNAME).$(TGZ),$(CURNAME)
######################################################################
#== Rules
#
all: export
help:
@echo ""
@echo " make [export] :"
@echo " Export $(PROJECT) source from cvsroot. "
@echo " Expand source in" $(PROJECT) "."
@echo " Generate documentations from them."
@if [ "$(CURNAME)" != "" ] && [ "$(CLEANARCH)" != "1" ]; then \
echo " Compress them into" $(PROJECT)/$(CURNAME).$(TGZ) "." ;\
fi
@if [ "$(GATE)" != "" ] && [ "$(CLEANARCH)" != "1" ]; then \
echo " Create SIGEN file" $(SIGENDIR) $(SIGENTGZ) ;\
fi
@if [ "$(TGZLIST)" != "" ] && [ "$(RUBY)" != "" ]; then \
echo " Update Archive List. " ;\
fi
@echo ""
@echo " make tgzlist :"
@echo " Only Update Archive List. "
@echo ""
clean:
rm -f *~
clean.all: clean
export: varcheck tagcheck expand makedoc mktgz sigen tgzlist
varcheck:
@if [ "$(PROJECT)" = "" ]; then \
echo -e "\n Specify \"PROJECT\" in Makefile.export \n" ;\
exit 1 ;\
fi
@if [ "$(TAG)" = "" ]; then \
echo -e "\n Specify \"TAG\" in Makefile.export \n" ;\
exit 1 ;\
fi
@if [ "$(DIR)" = "" ]; then \
echo -e "\n Specify \"DIR\" in Makefile.export \n" ;\
exit 1 ;\
fi
@if [ "$(CVS)" = "" ]; then \
echo -e "\n Specify \"CVS\" in Makefile.export \n" ;\
exit 1 ;\
fi
@if [ "$(TGZ)" = "" ]; then \
echo -e "\n Specify \"TGZ\" in Makefile.export \n" ;\
exit 1 ;\
fi
@if [ "$(CVS_ROOT)" = "" ]; then \
echo -e "\n Specify \"CVS_ROOT\" in Makefile.export \n" ;\
exit 1 ;\
fi
tagcheck:
@if [ -d "$(DIR)" ] && [ "$(OVERWRITE)" != "1" ]; then \
echo -e \
"\n " $(DIR) "is already exported .\n" \
" Please change \"DIR\" in \"Makefile.export\" to latest tag.\n" \
" or remove \"" $(DIR) "\".\n" \
" And do \"make export\" again.\n" ;\
exit 1 ;\
fi
@if [ -d "$(DIR)" ] && [ "$(OVERWRITE)" = "1" ]; then \
echo rm -rf $(DIR) ;\
rm -rf $(DIR) ;\
fi
expand:
$(CVS) -d $(CVS_ROOT) export $(TAG) \
-d $(DIR) $(PROJECT) \
|| \
eval " rm $(DIR)/CVS/* ; \
rmdir $(DIR)/CVS ; \
rmdir $(DIR) ; exit 1 "
makedoc:
@if [ "$(MAKEDOC)" != "" ]; then \
echo "$(MAKEDOC)" ;\
eval "$(MAKEDOC)" ;\
fi
mktgz:
@if [ "$(CLEANARCH)" != "1" ] ; then \
echo tar cvfz $(DIR).$(TGZ) $(DIR) ;\
tar cvfz $(DIR).$(TGZ) $(DIR) ;\
elif [ "$(CLEANARCH)" = "1" ] ; then \
echo rm -rf $(DIR) ;\
rm -rf $(DIR) ;\
fi
@if [ "$(CURNAME)" != "" ] && [ "$(CLEANARCH)" != "1" ]; then \
echo rm -f $(CURNAME) $(CURNAME).$(TGZ) ;\
rm -f $(CURNAME) $(CURNAME).$(TGZ) ;\
\
echo ln -s $(DIR) $(CURNAME) ;\
ln -s $(DIR) $(CURNAME) ;\
\
echo ln -s $(DIR).$(TGZ) $(CURNAME).$(TGZ) ;\
ln -s $(DIR).$(TGZ) $(CURNAME).$(TGZ) ;\
fi
sigen: sigendir sigentgz
sigendir:
@if [ "$(GATE)" != "" ] && [ "$(CLEANARCH)" != "1" ]; then \
echo -n "Generating $(SIGENDIR) ... " ;\
\
echo "Subject: " $(DIR) "Source code directory" > $(SIGENDIR) ;\
echo "Maintainer: " $(GATEJPNAME) >> $(SIGENDIR) ;\
echo "Description: This file is auto-generated form \"make export -f Makefile.export\"" >> $(SIGENDIR) ;\
echo "Note: " >> $(SIGENDIR) ;\
echo "Update: `date +%Y/%m/%d`" >> $(SIGENDIR) ;\
\
echo "done" ;\
fi
sigentgz:
@if [ "$(GATE)" != "" ] && [ "$(CLEANARCH)" != "1" ]; then \
echo -n "Generating $(SIGENTGZ) ... " ;\
\
echo "Subject: " $(DIR) "tar.gz Package" > $(SIGENTGZ) ;\
echo "Maintainer: " $(GATEJPNAME) >> $(SIGENTGZ) ;\
echo "Description: This file is auto-generated form \"make export -f Makefile.export\"" >> $(SIGENTGZ) ;\
echo "Note: " >> $(SIGENTGZ) ;\
echo "Update: `date +%Y/%m/%d`" >> $(SIGENTGZ) ;\
\
echo "done" ;\
fi
tgzlist:
@if [ "$(TGZLIST)" != "" ] && [ "$(RUBY)" != "" ]; then \
echo $(TGZLIST_CMD) ;\
$(TGZLIST_CMD) ;\
fi
######################################################################
#== Mode setting for Emacs
#Local Variables:
#mode: makefile
#End:
#