Added support for localization features into makefile-engine
and makefile template. Have fun! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40742 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+16
-1
@@ -1,4 +1,4 @@
|
|||||||
## BeOS Generic Makefile v2.3 ##
|
## BeOS Generic Makefile v2.4 ##
|
||||||
|
|
||||||
## Fill in this file to specify the project being created, and the referenced
|
## Fill in this file to specify the project being created, and the referenced
|
||||||
## makefile-engine will do all of the hard work for you. This handles both
|
## makefile-engine will do all of the hard work for you. This handles both
|
||||||
@@ -16,6 +16,10 @@ NAME=
|
|||||||
# DRIVER: Kernel Driver
|
# DRIVER: Kernel Driver
|
||||||
TYPE=
|
TYPE=
|
||||||
|
|
||||||
|
# if you plan to use localization features
|
||||||
|
# specify the application MIME siganture
|
||||||
|
APP_MIME_SIG=
|
||||||
|
|
||||||
# add support for new Pe and Eddie features
|
# add support for new Pe and Eddie features
|
||||||
# to fill in generic makefile
|
# to fill in generic makefile
|
||||||
|
|
||||||
@@ -52,6 +56,9 @@ RSRCS=
|
|||||||
# libXXX.so or libXXX.a you can simply specify XXX
|
# libXXX.so or libXXX.a you can simply specify XXX
|
||||||
# library: libbe.so entry: be
|
# library: libbe.so entry: be
|
||||||
#
|
#
|
||||||
|
# - for localization support add following libs:
|
||||||
|
# locale localestub
|
||||||
|
#
|
||||||
# - if your library does not follow the standard library
|
# - if your library does not follow the standard library
|
||||||
# naming scheme you need to specify the path to the library
|
# naming scheme you need to specify the path to the library
|
||||||
# and it's name
|
# and it's name
|
||||||
@@ -80,6 +87,14 @@ LOCAL_INCLUDE_PATHS =
|
|||||||
# NONE, SOME, FULL
|
# NONE, SOME, FULL
|
||||||
OPTIMIZE=
|
OPTIMIZE=
|
||||||
|
|
||||||
|
# specify here the codes for languages you are going
|
||||||
|
# to support in this application. The default "en"
|
||||||
|
# one must be provided too. "make catkeys" will recreate only
|
||||||
|
# locales/en.catkeys file. Use it as template for creating other
|
||||||
|
# languages catkeys. All localization files must be placed
|
||||||
|
# in "locales" sub-directory.
|
||||||
|
LOCALES=
|
||||||
|
|
||||||
# specify any preprocessor symbols to be defined. The symbols will not
|
# specify any preprocessor symbols to be defined. The symbols will not
|
||||||
# have their values set automatically; you must supply the value (if any)
|
# have their values set automatically; you must supply the value (if any)
|
||||||
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
## BeOS and Haiku Generic Makefile Engine v2.2.0
|
## BeOS and Haiku Generic Makefile Engine v2.4.0
|
||||||
## Does all the hard work for the Generic Makefile
|
## Does all the hard work for the Generic Makefile
|
||||||
## which simply defines the project parameters
|
## which simply defines the project parameters
|
||||||
|
|
||||||
## Supports Generic Makefile v2.0, 2.01, 2.1, 2.2, 2.3
|
## Supports Generic Makefile v2.0, 2.01, 2.1, 2.2, 2.3, 2.4
|
||||||
|
|
||||||
# determine wheather running on x86 or ppc
|
# determine wheather running on x86 or ppc
|
||||||
MACHINE=$(shell uname -m)
|
MACHINE=$(shell uname -m)
|
||||||
@@ -21,6 +21,10 @@ ifeq ($(TYPE), )
|
|||||||
TYPE = APP
|
TYPE = APP
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(APP_MIME_SIG), )
|
||||||
|
APP_MIME = x.vnd-Haiku-$(NAME)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(DRIVER_PATH), )
|
ifeq ($(DRIVER_PATH), )
|
||||||
DRIVER_PATH = misc
|
DRIVER_PATH = misc
|
||||||
endif
|
endif
|
||||||
@@ -217,6 +221,20 @@ endef
|
|||||||
DO_RSRCS := $(XRES) -o $(TARGET) $(RSRCS)
|
DO_RSRCS := $(XRES) -o $(TARGET) $(RSRCS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# the directory for internationalization sources (catkeys)
|
||||||
|
CATKEYS_DIR := locales
|
||||||
|
|
||||||
|
# the directory for internationalization resource data (catalogs)
|
||||||
|
CATALOGS_DIR := $(OBJ_DIR)/$(APP_MIME_SIG)
|
||||||
|
|
||||||
|
# pseudo-function for converting a list of language codes in CATALOGS variable
|
||||||
|
# to a corresponding list of catkeys files in $(CATALOGS_DIR)/xx.catalog
|
||||||
|
# The "function" appends the .catalog suffix and prepends the $(CATALOGS_DIR)/ path
|
||||||
|
define LOCALES_LIST_TO_CATALOGS
|
||||||
|
$(addprefix $(CATALOGS_DIR)/, $(addsuffix .catalog, $(foreach lang, $(LOCALES), $(lang))))
|
||||||
|
endef
|
||||||
|
|
||||||
|
CATALOGS = $(LOCALES_LIST_TO_CATALOGS)
|
||||||
|
|
||||||
# define the actual work to be done
|
# define the actual work to be done
|
||||||
default: $(TARGET)
|
default: $(TARGET)
|
||||||
@@ -231,6 +249,14 @@ $(TARGET): $(OBJ_DIR) $(OBJS) $(RSRCS)
|
|||||||
$(OBJ_DIR)::
|
$(OBJ_DIR)::
|
||||||
@[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1
|
@[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1
|
||||||
|
|
||||||
|
# rule to create the localization sources directory if needed
|
||||||
|
$(CATKEYS_DIR)::
|
||||||
|
@[ -d $(CATKEYS_DIR) ] || mkdir $(CATKEYS_DIR) > /dev/null 2>&1
|
||||||
|
|
||||||
|
# rule to create the localization data directory if needed
|
||||||
|
$(CATALOGS_DIR):: $(OBJ_DIR)
|
||||||
|
@[ -d $(CATALOGS_DIR) ] || mkdir $(CATALOGS_DIR) > /dev/null 2>&1
|
||||||
|
|
||||||
# rules to make the dependency files
|
# rules to make the dependency files
|
||||||
$(OBJ_DIR)/%.d : %.c
|
$(OBJ_DIR)/%.d : %.c
|
||||||
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
||||||
@@ -278,6 +304,23 @@ $(OBJ_DIR)/%.rsrc : %.rdef
|
|||||||
$(OBJ_DIR)/%.rsrc : %.RDEF
|
$(OBJ_DIR)/%.rsrc : %.RDEF
|
||||||
cat $< | $(CC) -E $(INCLUDES) $(CFLAGS) - | grep -v '^#' | $(RESCOMP) -I $(dir $<) -o "$@" -
|
cat $< | $(CC) -E $(INCLUDES) $(CFLAGS) - | grep -v '^#' | $(RESCOMP) -I $(dir $<) -o "$@" -
|
||||||
|
|
||||||
|
# rule to compile localization data catalogs
|
||||||
|
$(CATALOGS_DIR)/%.catalog : $(CATKEYS_DIR)/%.catkeys
|
||||||
|
linkcatkeys -o "$@" -s $(APP_MIME_SIG) -l $(notdir $(basename $@)) $<
|
||||||
|
|
||||||
|
# rule to preprocess program sources into file ready for collecting catkeys
|
||||||
|
$(OBJ_DIR)/$(NAME).pre : $(SRCS)
|
||||||
|
-cat $(SRCS) | $(CC) -E $(INCLUDES) $(CFLAGS) -DB_COLLECTING_CATKEYS - > $(OBJ_DIR)/$(NAME).pre
|
||||||
|
|
||||||
|
# rules to collect localization catkeys
|
||||||
|
catkeys : $(CATKEYS_DIR)/en.catkeys
|
||||||
|
|
||||||
|
$(CATKEYS_DIR)/en.catkeys : $(CATKEYS_DIR) $(OBJ_DIR)/$(NAME).pre
|
||||||
|
collectcatkeys -s $(APP_MIME_SIG) $(OBJ_DIR)/$(NAME).pre -o $(CATKEYS_DIR)/en.catkeys
|
||||||
|
|
||||||
|
# rule to create localization catalogs
|
||||||
|
catalogs : $(CATALOGS_DIR) $(CATALOGS)
|
||||||
|
|
||||||
# rules to handle lex/flex and yacc/bison files
|
# rules to handle lex/flex and yacc/bison files
|
||||||
|
|
||||||
$(OBJ_DIR)/%.o: %.l
|
$(OBJ_DIR)/%.o: %.l
|
||||||
@@ -316,3 +359,9 @@ else
|
|||||||
mkdir -p "$(INSTALL_DIR)"
|
mkdir -p "$(INSTALL_DIR)"
|
||||||
cp $(TARGET) $(INSTALL_DIR)/$(NAME)
|
cp $(TARGET) $(INSTALL_DIR)/$(NAME)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# rule to install localization resources catalogs
|
||||||
|
catalogsinstall :: catalogs
|
||||||
|
mkdir -p "/boot/home/config/data/locale/catalogs/$(APP_MIME_SIG)"
|
||||||
|
-cp $(CATALOGS_DIR)/*.catalog /boot/home/config/data/locale/catalogs/$(APP_MIME_SIG)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user