2011-11-06 17:15:57 +04:00
|
|
|
## BeOS and Haiku Generic Makefile Engine v2.5.1
|
2009-03-19 15:19:41 +03:00
|
|
|
## Does all the hard work for the Generic Makefile
|
|
|
|
## which simply defines the project parameters
|
|
|
|
|
2011-10-27 00:12:09 +04:00
|
|
|
## Supports Generic Makefile v2.0, 2.01, 2.1, 2.2, 2.3, 2.4, 2.5
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
# determine wheather running on x86 or ppc
|
|
|
|
MACHINE=$(shell uname -m)
|
|
|
|
ifeq ($(MACHINE), BePC)
|
|
|
|
CPU = x86
|
|
|
|
else
|
2009-08-04 20:34:30 +04:00
|
|
|
CPU = $(MACHINE)
|
2009-03-19 15:19:41 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
# create some default settings
|
|
|
|
ifeq ($(NAME), )
|
|
|
|
NAME = NameThisApp
|
|
|
|
endif
|
2009-05-21 19:04:37 +04:00
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
ifeq ($(TYPE), )
|
|
|
|
TYPE = APP
|
|
|
|
endif
|
|
|
|
|
2011-02-28 23:38:05 +03:00
|
|
|
ifeq ($(APP_MIME_SIG), )
|
|
|
|
APP_MIME = x.vnd-Haiku-$(NAME)
|
|
|
|
endif
|
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
ifeq ($(DRIVER_PATH), )
|
|
|
|
DRIVER_PATH = misc
|
|
|
|
endif
|
|
|
|
|
|
|
|
# specify the mimeset tool
|
|
|
|
MIMESET := mimeset
|
|
|
|
|
|
|
|
# specify the tools for adding and removing resources
|
2009-08-04 20:34:30 +04:00
|
|
|
XRES := xres
|
2009-03-19 15:19:41 +03:00
|
|
|
|
2009-05-17 00:10:01 +04:00
|
|
|
# specify the tools for compiling resource definition files
|
2009-08-04 20:34:30 +04:00
|
|
|
RESCOMP := rc
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
# set the compiler and compiler flags
|
2009-08-04 20:34:30 +04:00
|
|
|
CC := gcc
|
|
|
|
C++ := g++
|
2009-03-19 15:19:41 +03:00
|
|
|
|
2009-05-21 19:04:37 +04:00
|
|
|
# SETTING: set the CFLAGS for each binary type
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(TYPE)), DRIVER)
|
2009-03-19 15:19:41 +03:00
|
|
|
CFLAGS += -D_KERNEL_MODE=1 -no-fpic
|
|
|
|
else
|
|
|
|
CFLAGS +=
|
|
|
|
endif
|
|
|
|
|
|
|
|
# SETTING: set the proper optimization level
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(OPTIMIZE)), FULL)
|
2009-03-19 15:19:41 +03:00
|
|
|
OPTIMIZER = -O3
|
|
|
|
else
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(OPTIMIZE)), SOME)
|
2009-03-19 15:19:41 +03:00
|
|
|
OPTIMIZER = -O1
|
|
|
|
else
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(OPTIMIZE)), NONE)
|
2009-03-19 15:19:41 +03:00
|
|
|
OPTIMIZER = -O0
|
|
|
|
else
|
|
|
|
# OPTIMIZE not set so set to full
|
|
|
|
OPTIMIZER = -O3
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# SETTING: set proper debugger flags
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(DEBUGGER)), TRUE)
|
2009-03-19 15:19:41 +03:00
|
|
|
DEBUG += -g
|
|
|
|
OPTIMIZER = -O0
|
2009-05-21 19:04:37 +04:00
|
|
|
endif
|
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
CFLAGS += $(OPTIMIZER) $(DEBUG)
|
|
|
|
|
|
|
|
# SETTING: set warning level
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(WARNINGS)), ALL)
|
2009-03-19 15:19:41 +03:00
|
|
|
CFLAGS += -Wall -Wno-multichar -Wno-ctor-dtor-privacy
|
|
|
|
else
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(WARNINGS)), NONE)
|
2009-03-19 15:19:41 +03:00
|
|
|
CFLAGS += -w
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# set the linker and linker flags
|
2011-02-28 22:17:55 +03:00
|
|
|
ifeq ($(origin LD), default)
|
|
|
|
LD := gcc
|
|
|
|
endif
|
2009-03-19 15:19:41 +03:00
|
|
|
LDFLAGS += $(DEBUG)
|
|
|
|
|
|
|
|
# SETTING: set linker flags for each binary type
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(TYPE)), APP)
|
2009-03-19 15:19:41 +03:00
|
|
|
LDFLAGS += -Xlinker -soname=_APP_
|
|
|
|
else
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(TYPE)), SHARED)
|
2009-03-19 15:19:41 +03:00
|
|
|
LDFLAGS += -nostart -Xlinker -soname=$(NAME)
|
|
|
|
else
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(TYPE)), DRIVER)
|
2009-05-21 19:04:37 +04:00
|
|
|
LDFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_ \
|
|
|
|
/boot/develop/lib/x86/haiku_version_glue.o
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-06-19 13:39:04 +04:00
|
|
|
# guess compiler version
|
2010-06-20 00:26:04 +04:00
|
|
|
CC_VER = $(word 1, $(subst -, , $(subst ., , $(shell $(CC) -dumpversion))))
|
2010-06-19 13:39:04 +04:00
|
|
|
|
|
|
|
# set the directory where object files and binaries will be created
|
2010-06-20 00:26:04 +04:00
|
|
|
OBJ_DIR := objects.$(CPU)-$(CC)$(CC_VER)-$(if $(DEBUGGER),debug,release)
|
2010-06-19 13:39:04 +04:00
|
|
|
|
|
|
|
# specify the directory the binary should be created in by default
|
|
|
|
ifeq ($(TARGET_DIR), )
|
|
|
|
TARGET_DIR := $(OBJ_DIR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# NOTE: make doesn't find the target if its name is enclosed in
|
|
|
|
# quotation marks
|
2011-11-06 17:15:57 +04:00
|
|
|
ifeq ($(strip $(TYPE)), STATIC)
|
|
|
|
TARGET := $(TARGET_DIR)/$(NAME).a
|
|
|
|
else
|
2010-06-19 13:39:04 +04:00
|
|
|
TARGET := $(TARGET_DIR)/$(NAME)
|
2011-11-06 17:15:57 +04:00
|
|
|
endif
|
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
# psuedo-function for converting a list of source files in SRCS variable
|
|
|
|
# to a corresponding list of object files in $(OBJ_DIR)/xxx.o
|
|
|
|
# The "function" strips off the src file suffix (.ccp or .c or whatever)
|
|
|
|
# and then strips of the directory name, leaving just the root file name.
|
|
|
|
# It then appends the .o suffix and prepends the $(OBJ_DIR)/ path
|
|
|
|
define SRCS_LIST_TO_OBJS
|
|
|
|
$(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SRCS), \
|
|
|
|
$(basename $(notdir $(file))))))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SRCS_LIST_TO_DEPENDS
|
|
|
|
$(addprefix $(OBJ_DIR)/, $(addsuffix .d, $(foreach file, $(SRCS), \
|
|
|
|
$(basename $(notdir $(file))))))
|
|
|
|
endef
|
|
|
|
|
|
|
|
OBJS = $(SRCS_LIST_TO_OBJS)
|
|
|
|
DEPENDS = $(SRCS_LIST_TO_DEPENDS)
|
|
|
|
|
|
|
|
# create a unique list of paths to our sourcefiles
|
|
|
|
SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file))))
|
|
|
|
|
|
|
|
# add source paths to VPATH if not already present
|
|
|
|
VPATH :=
|
|
|
|
VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS))))
|
|
|
|
|
2011-10-27 00:12:09 +04:00
|
|
|
# SETTING: build the local and system include paths, compose C++ libs
|
2009-03-19 15:19:41 +03:00
|
|
|
ifeq ($(CPU), x86)
|
|
|
|
LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
2010-06-20 00:26:04 +04:00
|
|
|
ifeq ($(CC_VER), 2)
|
2010-06-19 13:39:04 +04:00
|
|
|
INCLUDES = $(LOC_INCLUDES)
|
|
|
|
INCLUDES += -I-
|
2010-06-20 00:26:04 +04:00
|
|
|
INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
2011-10-27 00:12:09 +04:00
|
|
|
|
|
|
|
STDCPPLIBS = stdc++.r4
|
2010-06-19 13:39:04 +04:00
|
|
|
else
|
|
|
|
INCLUDES = -iquote./
|
|
|
|
INCLUDES += $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -iquote, $(path)))
|
2010-06-20 00:26:04 +04:00
|
|
|
INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -isystem, $(path)))
|
2011-10-27 00:12:09 +04:00
|
|
|
|
|
|
|
STDCPPLIBS = stdc++ supc++
|
2010-06-19 13:39:04 +04:00
|
|
|
endif
|
2009-03-19 15:19:41 +03:00
|
|
|
else
|
|
|
|
ifeq ($(CPU), ppc)
|
|
|
|
LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
|
|
|
SYS_INCLUDES += -i-
|
|
|
|
SYS_INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -i , $(path)))
|
2010-12-13 14:58:15 +03:00
|
|
|
|
2010-06-19 13:39:04 +04:00
|
|
|
INCLUDES = $(LOC_INCLUDES) $(SYS_INCLUDES)
|
2009-03-19 15:19:41 +03:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# SETTING: add the -L prefix to all library paths to search
|
|
|
|
LINK_PATHS = $(foreach path, $(SRC_PATHS) $(LIBPATHS), \
|
|
|
|
$(addprefix -L, $(path)))
|
|
|
|
|
|
|
|
# SETTING: specify the additional libraries to link against
|
|
|
|
# if the libraries have a .so or .a prefix, or if they are _APP_ or _KERNEL_
|
|
|
|
# simply add them to the list
|
|
|
|
LINK_LIBS += $(filter %.so %.a _APP_ _KERNEL_, $(LIBS))
|
|
|
|
# if the libraries do not have suffixes and are not _APP_ or _KERNEL_
|
|
|
|
# prepend -l to each name: be becomes -lbe
|
|
|
|
LINK_LIBS += $(foreach lib, $(filter-out %.so %.a _APP_ _KERNEL_, $(LIBS)), $(addprefix -l, $(lib)))
|
|
|
|
|
2009-05-21 19:04:37 +04:00
|
|
|
# add to the linker flags
|
2009-03-19 15:19:41 +03:00
|
|
|
LDFLAGS += $(LINK_PATHS) $(LINK_LIBS)
|
|
|
|
|
|
|
|
# SETTING: add the defines to the compiler flags
|
|
|
|
CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define)))
|
|
|
|
|
|
|
|
# SETTING: add the additional compiler flags
|
|
|
|
CFLAGS += $(COMPILER_FLAGS)
|
|
|
|
|
|
|
|
# SETTING: add the additional linker flags
|
|
|
|
LDFLAGS += $(LINKER_FLAGS)
|
|
|
|
|
|
|
|
# SETTING: use the archive tools if building a static library
|
|
|
|
# otherwise use the linker
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(TYPE)), STATIC)
|
2009-03-19 15:19:41 +03:00
|
|
|
BUILD_LINE = ar -cru "$(TARGET)" $(OBJS)
|
|
|
|
else
|
2009-10-29 22:43:57 +03:00
|
|
|
BUILD_LINE = $(LD) -o "$@" $(OBJS) $(LDFLAGS)
|
2009-03-19 15:19:41 +03:00
|
|
|
endif
|
|
|
|
|
2009-05-21 19:04:37 +04:00
|
|
|
# pseudo-function for converting a list of resource definition files in RDEFS
|
2009-05-17 00:10:01 +04:00
|
|
|
# variable to a corresponding list of object files in $(OBJ_DIR)/xxx.rsrc
|
2009-05-21 19:04:37 +04:00
|
|
|
# The "function" strips off the rdef file suffix (.rdef) and then strips
|
2009-05-17 00:10:01 +04:00
|
|
|
# of the directory name, leaving just the root file name.
|
|
|
|
# It then appends the .rsrc suffix and prepends the $(OBJ_DIR)/ path
|
|
|
|
define RDEFS_LIST_TO_RSRCS
|
|
|
|
$(addprefix $(OBJ_DIR)/, $(addsuffix .rsrc, $(foreach file, $(RDEFS), \
|
|
|
|
$(basename $(notdir $(file))))))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# create the resource definitions instruction in case RDEFS is not empty
|
|
|
|
ifeq ($(RDEFS), )
|
|
|
|
RSRCS +=
|
|
|
|
else
|
|
|
|
RSRCS += $(RDEFS_LIST_TO_RSRCS)
|
|
|
|
endif
|
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
# create the resource instruction
|
|
|
|
ifeq ($(RSRCS), )
|
|
|
|
DO_RSRCS :=
|
|
|
|
else
|
2009-10-30 00:30:56 +03:00
|
|
|
DO_RSRCS := $(XRES) -o $(TARGET) $(RSRCS)
|
2009-03-19 15:19:41 +03:00
|
|
|
endif
|
|
|
|
|
2011-02-28 23:38:05 +03:00
|
|
|
# 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)
|
2009-03-19 15:19:41 +03:00
|
|
|
|
2009-05-21 19:04:37 +04:00
|
|
|
# define the actual work to be done
|
2009-03-19 15:19:41 +03:00
|
|
|
default: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJ_DIR) $(OBJS) $(RSRCS)
|
|
|
|
$(BUILD_LINE)
|
|
|
|
$(DO_RSRCS)
|
2009-10-29 22:43:57 +03:00
|
|
|
$(MIMESET) -f "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
# rule to create the object file directory if needed
|
|
|
|
$(OBJ_DIR)::
|
|
|
|
@[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1
|
|
|
|
|
2011-02-28 23:38:05 +03:00
|
|
|
# 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
|
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
# rules to make the dependency files
|
|
|
|
$(OBJ_DIR)/%.d : %.c
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .c:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.d : %.cpp
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .cpp:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.d : %.cp
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .cp:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.d : %.cc
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .cc:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.d : %.C
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .C:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.d : %.CC
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .CC:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.d : %.CPP
|
|
|
|
[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1; \
|
2009-10-29 22:43:57 +03:00
|
|
|
mkdepend $(LOC_INCLUDES) -p .CPP:$(OBJ_DIR)/%n.o -m -f "$@" $<
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
|
|
|
# rules to make the object files
|
|
|
|
$(OBJ_DIR)/%.o : %.c
|
2009-10-29 22:43:57 +03:00
|
|
|
$(CC) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o : %.cpp
|
2009-10-29 22:43:57 +03:00
|
|
|
$(C++) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o : %.cp
|
2009-10-29 22:43:57 +03:00
|
|
|
$(CC) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o : %.cc
|
2009-10-29 22:43:57 +03:00
|
|
|
$(C++) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o : %.C
|
2009-10-29 22:43:57 +03:00
|
|
|
$(CC) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o : %.CC
|
2009-10-29 22:43:57 +03:00
|
|
|
$(C++) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o : %.CPP
|
2009-10-29 22:43:57 +03:00
|
|
|
$(C++) -c $< $(INCLUDES) $(CFLAGS) -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
|
2009-05-17 00:10:01 +04:00
|
|
|
# rules to compile resource definition files
|
|
|
|
$(OBJ_DIR)/%.rsrc : %.rdef
|
2010-12-13 14:58:15 +03:00
|
|
|
cat $< | $(CC) -E $(INCLUDES) $(CFLAGS) - | grep -v '^#' | $(RESCOMP) -I $(dir $<) -o "$@" -
|
2009-05-17 00:10:01 +04:00
|
|
|
$(OBJ_DIR)/%.rsrc : %.RDEF
|
2010-12-13 14:58:15 +03:00
|
|
|
cat $< | $(CC) -E $(INCLUDES) $(CFLAGS) - | grep -v '^#' | $(RESCOMP) -I $(dir $<) -o "$@" -
|
2009-05-17 00:10:01 +04:00
|
|
|
|
2011-02-28 23:38:05 +03:00
|
|
|
# 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)
|
2011-10-27 00:12:09 +04:00
|
|
|
-cat $(SRCS) | $(CC) -E -x c++ $(INCLUDES) $(CFLAGS) -DB_COLLECTING_CATKEYS - > $(OBJ_DIR)/$(NAME).pre
|
2011-02-28 23:38:05 +03:00
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
2009-03-19 15:19:41 +03:00
|
|
|
# rules to handle lex/flex and yacc/bison files
|
|
|
|
|
|
|
|
$(OBJ_DIR)/%.o: %.l
|
|
|
|
flex $<
|
2009-10-29 22:43:57 +03:00
|
|
|
$(CC) -c $(INCLUDES) $(CFLAGS) lex.yy.c -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
$(OBJ_DIR)/%.o: %.y
|
|
|
|
bison -d -y $<
|
2009-10-29 22:43:57 +03:00
|
|
|
$(CC) -c $(INCLUDES) $(CFLAGS) y.tab.c -o "$@"
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
# empty rule. Things that depend on this rule will always get triggered
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
# The generic clean command. Delete everything in the object folder.
|
|
|
|
clean :: FORCE
|
2009-08-04 20:49:06 +04:00
|
|
|
-rm -rf "$(OBJ_DIR)"
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
# remove just the application from the object folder
|
|
|
|
rmapp ::
|
2009-10-30 00:30:56 +03:00
|
|
|
-rm -f $(TARGET)
|
2009-03-19 15:19:41 +03:00
|
|
|
|
|
|
|
# make it easy to install drivers for testing
|
|
|
|
USER_BIN_PATH = /boot/home/config/add-ons/kernel/drivers/bin
|
|
|
|
USER_DEV_PATH = /boot/home/config/add-ons/kernel/drivers/dev
|
|
|
|
|
2009-08-04 20:49:06 +04:00
|
|
|
driverinstall :: default
|
2011-10-16 20:02:34 +04:00
|
|
|
ifeq ($(strip $(TYPE)), DRIVER)
|
2010-06-19 13:39:04 +04:00
|
|
|
copyattr --data $(TARGET) $(USER_BIN_PATH)/$(NAME)
|
2009-03-19 15:19:41 +03:00
|
|
|
mkdir -p $(USER_DEV_PATH)/$(DRIVER_PATH)
|
|
|
|
ln -sf $(USER_BIN_PATH)/$(NAME) $(USER_DEV_PATH)/$(DRIVER_PATH)/$(NAME)
|
|
|
|
endif
|
2009-08-04 20:49:06 +04:00
|
|
|
|
|
|
|
install :: default
|
|
|
|
ifeq ($(INSTALL_DIR), )
|
|
|
|
@echo "No install directory specified for \"$(NAME)\" (INSTALL_DIR is empty)" >&2
|
|
|
|
else
|
|
|
|
mkdir -p "$(INSTALL_DIR)"
|
2009-10-30 00:30:56 +03:00
|
|
|
cp $(TARGET) $(INSTALL_DIR)/$(NAME)
|
2009-08-04 20:49:06 +04:00
|
|
|
endif
|
2011-02-28 23:38:05 +03:00
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
2011-11-06 17:15:57 +04:00
|
|
|
# alternative way of storing localization catalogs - bind into program executable's resources
|
|
|
|
bindcatalogs :
|
|
|
|
for lc in $(LOCALES); do linkcatkeys -o $(TARGET) -s $(APP_MIME_SIG) -tr -l $$lc $(CATKEYS_DIR)/$$lc.catkeys; done
|
|
|
|
|