#--------------------------------------------------------------------- # Copyright (C) GFD Dennou Club, 2005. All rights reserved. #--------------------------------------------------------------------- #= Replace strings in documentations # # * Yasuhiro Morikawa, Masaki Ishiwatari # * 2005/06/12 (Yasuhiro Morikawa) copy from gtool4/html/gt4f90io/Makefile.replace # ###################################################################### # #== Settings INCLUDEFILE = ./Current_CVS_Tag.mk include $(INCLUDEFILE) # Include file RUBY = ruby1.8 # Path to Ruby (necessary) # Documentations that are replaced version number. TARGETS = index.htm index.htm.en # Replaced word described by the regular expression. (necessary) FROM = \(dcpam4-Version: .*?\) TO = (dcpam4-Version: $(DCPAM4TAG)) # End Settings ###################################################################### ###################################################################### #== Ruby liner script for replacing version number REPLACER = $(RUBY) -e 'if ARGV.size < 3 then ;\ $$stdout.print "Replacing: Args: from to file\n";\ exit ;\ end ;\ if !(File.exist?(ARGV[2])) ;\ $$stdout.print "Replacing: \"\#{ARGV[2]}\" is not found\n";\ exit ;\ end ;\ body = open(ARGV[2]){|io| io.read} ;\ if /\#{ARGV[0]}/ =~ body then ;\ $$stdout.print "Replacing: \"\#{ARGV[0]}\" to " + \ " \"\#{ARGV[1]}\" in \"\#{ARGV[2]}\" ... " ;\ body = body.gsub!(/\#{ARGV[0]}/, "\#{ARGV[1]}");\ $$stdout.print "done.\n" ;\ end ;\ out = open(ARGV[2], "w"); out.puts(body) ;\ out.close' ###################################################################### #== Rules # all: replace help: @echo "" @echo " make [replace] :" @echo " Replace strings in documentations" @echo "" clean: -rm *~ clean.all: clean replace: @for i in $(TARGETS) ; do \ $(REPLACER) "$(FROM)" "$(TO)" "$$i" ;\ done ###################################################################### #== Mode setting for Emacs #Local Variables: #mode: makefile #End: #