# Naming convention for catalogue related files:
#
# 1.catalogue name:
# catalogue name is preceded by >> ux <<, e.g. uxsgicore,
# which also corresponds to the directory name under eoe/cmd/messages
#
# 2. *.src_a or *.src_x files:
# *.src_* clearly indicates they are the original files to work on from.
# Note, these files are in special format: each message is prefixed with 
# a unique symbolic identifier. These are the original files to 
# generate *.h and binary catalogue file: 
#    For catalog type of ATT (MNLS), the file will be named as 
#    the catalogue name suffixed with .src_a, e.g. uxdfm.src_a. 
#    For catalog type of XPG4, the file will be named as 
#    the catalogue name suffixed with .src_x, e.g. uxeoe.src_x. 
# 
# 3. *.msg_a *.msg_x files:
# the intermediate files generated by command mkinclmsg will be
# named catalogue name suffixed by .msg_a and .msg_x
#
# 4. *.h file:
# header file, *.h will be named as catalogue name suffixed with .h
# e.g. uxsgicore.h
# *.h files will need to be installed to the $ROOT/usr/include/msgs
# through 'make headers' rule
# 
# 5. binary catalogue file:
# the $(TOOLROOT)/usr/bin/mkmsgs generated binary catalogue file is 
# named as catalogue name,
# e.g. uxsgicore
# When needed, this binary catalogue file will be installed to 
# /usr/lib/locale/C/LC_MESSAGES for C locale;
# For other locale, e.g. ja_JP.EUC locale, the binary catalogue file will be
# installed to /usr/lib/locale/ja_JP.EUC/LC_MESSAGES

GENCAT	  = $(TOOLROOTSAFE) $(TOOLROOT)/usr/bin/gencat
MKMSGS	  = $(TOOLROOTSAFE) $(TOOLROOT)/usr/bin/mkmsgs
# Override the commondefs MKINCLMSG. It is the same one anyway
MKINCLMSG = $(DEPTH)/mkinclmsg

.SUFFIXES:
.SUFFIXES: .src_x .src_a .msg_x .msg_a .m

.src_a:
	$(MKINCLMSG) -a  $*.src_a $*.h $*.msg_a $*
	$(MKMSGS) -o $*.msg_a $*

.src_x:
	$(MKINCLMSG) -x  $*.src_x $*.h $*.msg_x $*
	$(GENCAT) $* $*.msg_x

.src_x.msg_x:
	$(MKINCLMSG) -x  $*.src_x $*.h $*.msg_x $*

.src_a.msg_a:
	$(MKINCLMSG) -a  $*.src_a $*.h $*.msg_a $*

.msg_a:
	$(MKMSGS) -o $*.msg_a $*

.msg_x:
	$(GENCAT) $* $*.msg_x

# General rules for catalog subdirectories
default: $(TARGETS)

headers: default
	$(INSTALL) -m 444 -F /usr/include/msgs $(CATNAME).h 

install: headers
	$(INSTALL) -m 444 -F /usr/lib/locale/C/LC_MESSAGES $(TARGETS)
