#
# makefile for gs Resource Embedder into PostScript
#
# Copyright (C) 2001 Taiji Yamada <taiji@aihara.co.jp> and gs-cjk project
#
PREFIX=/opt/local
INSTALL_BIN_DIR=$(PREFIX)/bin

all: embresps

embresps: embresps.sh
	cp $< $@
	chmod +x $@

#
# install embresps
#
install:
	cp embresps $(INSTALL_BIN_DIR)

clean::
	rm -f embresps

#
# test
#
PS= \
gs_ac.ps \
gs_ag.ps \
gs_aj.ps \
gs_ak.ps

test: $(PS:.ps=.PS)
flags=
#flags=-v

gs_ac.PS: gs_ac.ps
	./embresps.sh $(flags) -F MOEKai-Regular -C B5-H -C B5-V $< > $@
#	sed 's/MOEKai-Regular/MOESung-Regular/g' $< | ./embresps.sh $(flags) -F MOESung-Regular -C B5-H -C B5-V > $@

gs_ag.PS: gs_ag.ps
#	./embresps.sh $(flags) -F STSong-Light -C GB-EUC-H -C GB-EUC-V $< > $@
	sed 's/STSong-Light/zycjksun/g' $< | ./embresps.sh $(flags) -F zycjksun -C GB-EUC-H -C GB-EUC-V > $@

gs_aj.PS: gs_aj.ps
#	use fonts in Phaser750n PostScript 3 Japanese Printer
#	./embresps.sh $(flags) $< > $@
#	use fonts in Phaser750n PostScript 3 Japanese Printer
#	sed 's/HeiseiMin-W3/HeiseiKakuGo-W5/g' $< | ./embresps.sh $(flags) > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
	sed 's/HeiseiMin-W3/Kochi-Mincho/g' $< | ./embresps.sh $(flags) -F Kochi-Mincho -C RKSJ-H -C RKSJ-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/HeiseiMin-W3/Kochi-Gothic/g' $< | ./embresps.sh $(flags) -F Kochi-Gothic -C RKSJ-H -C RKSJ-V > $@

gs_ak.PS: gs_ak.ps
#	OK for Phaser750n PostScript 3 Japanese Printer
	./embresps.sh $(flags) -F Munhwa-Regular -C KSC-EUC-H -C KSC-EUC-V $< > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/Munhwa-Bold/g' $< | ./embresps.sh $(flags) -F Munhwa-Bold -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaGothic-Regular/g' $< | ./embresps.sh $(flags) -F MunhwaGothic-Regular -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaGothic-Bold/g' $< | ./embresps.sh $(flags) -F MunhwaGothic-Bold -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaGungSeo-Light/g' $< | ./embresps.sh $(flags) -F MunhwaGungSeo-Light -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaGungSeo-Bold/g' $< | ./embresps.sh $(flags) -F MunhwaGungSeo-Bold -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaGungSeoHeulim-Light/g' $< | ./embresps.sh $(flags) -F MunhwaGungSeoHeulim-Light -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaGungSeoHeulim-Light/g' $< | ./embresps.sh $(flags) -F MunhwaGungSeoHeulim-Light -C KSC-EUC-H -C KSC-EUC-V > $@
#	OK for Phaser750n PostScript 3 Japanese Printer
#	sed 's/Munhwa-Regular/MunhwaHoonMin-Regular/g' $< | ./embresps.sh $(flags) -F MunhwaHoonMin-Regular -C KSC-EUC-H -C KSC-EUC-V > $@

clean::
	rm -f $(PS:.ps=.PS)
	rm -f *~
