- separate object directories for different compiler versions. This prevent from link errors after compiler was switched between gcc2 and gcc4 versions;
- correspondently use "-iquote" instead of "-I-" that is treated as obsolete by GCC 4. This fixes warning messages mentioned in #6177; - use $(TARGET) instead of $(OBJ_DIR)/$(NAME) in driverinstall: rules too. Patch by Evgeny Abdraimov. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,9 +12,6 @@ else
|
|||||||
CPU = $(MACHINE)
|
CPU = $(MACHINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# set the directory where object files and binaries will be created
|
|
||||||
OBJ_DIR := obj.$(CPU)
|
|
||||||
|
|
||||||
# create some default settings
|
# create some default settings
|
||||||
ifeq ($(NAME), )
|
ifeq ($(NAME), )
|
||||||
NAME = NameThisApp
|
NAME = NameThisApp
|
||||||
@@ -28,15 +25,6 @@ ifeq ($(DRIVER_PATH), )
|
|||||||
DRIVER_PATH = misc
|
DRIVER_PATH = misc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# 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
|
|
||||||
TARGET := $(TARGET_DIR)/$(NAME)
|
|
||||||
|
|
||||||
# specify the mimeset tool
|
# specify the mimeset tool
|
||||||
MIMESET := mimeset
|
MIMESET := mimeset
|
||||||
|
|
||||||
@@ -108,6 +96,24 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# guess compiler version
|
||||||
|
CC_VER_DMP = $(subst -, , $(subst ., , $(shell $(CC) -dumpversion)))
|
||||||
|
CC_VER_MAJ = $(word 1, $(CC_VER_DMP))
|
||||||
|
CC_VER_MIN = $(word 2, $(CC_VER_DMP))
|
||||||
|
CC_VER_MIC = $(word 3, $(CC_VER_DMP))
|
||||||
|
CC_VER = $(CC_VER_MAJ).$(CC_VER_MIN).$(CC_VER_MIC)
|
||||||
|
|
||||||
|
# set the directory where object files and binaries will be created
|
||||||
|
OBJ_DIR := obj.$(CPU).$(CC)-$(CC_VER)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
TARGET := $(TARGET_DIR)/$(NAME)
|
||||||
|
|
||||||
# psuedo-function for converting a list of source files in SRCS variable
|
# psuedo-function for converting a list of source files in SRCS variable
|
||||||
# to a corresponding list of object files in $(OBJ_DIR)/xxx.o
|
# to a corresponding list of object files in $(OBJ_DIR)/xxx.o
|
||||||
@@ -137,17 +143,24 @@ VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(S
|
|||||||
# SETTING: build the local and system include paths
|
# SETTING: build the local and system include paths
|
||||||
ifeq ($(CPU), x86)
|
ifeq ($(CPU), x86)
|
||||||
LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
||||||
SYS_INCLUDES += -I-
|
ifeq ($(CC_VER_MAJ), 2)
|
||||||
SYS_INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
INCLUDES = $(LOC_INCLUDES)
|
||||||
|
INCLUDES += -I-
|
||||||
|
else
|
||||||
|
INCLUDES = -iquote./
|
||||||
|
INCLUDES += $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -iquote, $(path)))
|
||||||
|
endif
|
||||||
|
INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
||||||
else
|
else
|
||||||
ifeq ($(CPU), ppc)
|
ifeq ($(CPU), ppc)
|
||||||
LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
LOC_INCLUDES = $(foreach path, $(SRC_PATHS) $(LOCAL_INCLUDE_PATHS), $(addprefix -I, $(path)))
|
||||||
SYS_INCLUDES += -i-
|
SYS_INCLUDES += -i-
|
||||||
SYS_INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -i , $(path)))
|
SYS_INCLUDES += $(foreach path, $(SYSTEM_INCLUDE_PATHS), $(addprefix -i , $(path)))
|
||||||
|
|
||||||
|
INCLUDES = $(LOC_INCLUDES) $(SYS_INCLUDES)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDES = $(LOC_INCLUDES) $(SYS_INCLUDES)
|
|
||||||
|
|
||||||
# SETTING: add the -L prefix to all library paths to search
|
# SETTING: add the -L prefix to all library paths to search
|
||||||
LINK_PATHS = $(foreach path, $(SRC_PATHS) $(LIBPATHS), \
|
LINK_PATHS = $(foreach path, $(SRC_PATHS) $(LIBPATHS), \
|
||||||
@@ -292,7 +305,7 @@ USER_DEV_PATH = /boot/home/config/add-ons/kernel/drivers/dev
|
|||||||
|
|
||||||
driverinstall :: default
|
driverinstall :: default
|
||||||
ifeq ($(TYPE), DRIVER)
|
ifeq ($(TYPE), DRIVER)
|
||||||
copyattr --data $(OBJ_DIR)/$(NAME) $(USER_BIN_PATH)/$(NAME)
|
copyattr --data $(TARGET) $(USER_BIN_PATH)/$(NAME)
|
||||||
mkdir -p $(USER_DEV_PATH)/$(DRIVER_PATH)
|
mkdir -p $(USER_DEV_PATH)/$(DRIVER_PATH)
|
||||||
ln -sf $(USER_BIN_PATH)/$(NAME) $(USER_DEV_PATH)/$(DRIVER_PATH)/$(NAME)
|
ln -sf $(USER_BIN_PATH)/$(NAME) $(USER_DEV_PATH)/$(DRIVER_PATH)/$(NAME)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user