[haiku-commits] r37174 - haiku/trunk/data/develop

  • From: zharik@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 19 Jun 2010 11:39:04 +0200 (CEST)

Author: siarzhuk
Date: 2010-06-19 11:39:04 +0200 (Sat, 19 Jun 2010)
New Revision: 37174
Changeset: http://dev.haiku-os.org/changeset/37174/haiku
Ticket: http://dev.haiku-os.org/ticket/6177

Modified:
   haiku/trunk/data/develop/makefile-engine
Log:
- 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.


Modified: haiku/trunk/data/develop/makefile-engine
===================================================================
--- haiku/trunk/data/develop/makefile-engine    2010-06-19 01:14:04 UTC (rev 
37173)
+++ haiku/trunk/data/develop/makefile-engine    2010-06-19 09:39:04 UTC (rev 
37174)
@@ -12,9 +12,6 @@
        CPU = $(MACHINE)
 endif
 
-#      set the directory where object files and binaries will be created
-       OBJ_DIR         := obj.$(CPU)
-
 #      create some default settings
 ifeq ($(NAME), )
        NAME = NameThisApp
@@ -28,15 +25,6 @@
        DRIVER_PATH = misc
 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
        MIMESET         := mimeset
 
@@ -108,7 +96,25 @@
        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
 # 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)
@@ -137,17 +143,24 @@
 #      SETTING: build the local and system include paths
 ifeq ($(CPU), x86)
        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)))
+ ifeq ($(CC_VER_MAJ), 2)
+       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
 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)))
+       
+       INCLUDES = $(LOC_INCLUDES) $(SYS_INCLUDES)
 endif
 endif
 
-INCLUDES = $(LOC_INCLUDES) $(SYS_INCLUDES)
 
 # SETTING: add the -L prefix to all library paths to search
 LINK_PATHS = $(foreach path, $(SRC_PATHS) $(LIBPATHS), \
@@ -292,7 +305,7 @@
 
 driverinstall :: default
 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)
        ln -sf $(USER_BIN_PATH)/$(NAME) $(USER_DEV_PATH)/$(DRIVER_PATH)/$(NAME)
 endif


Other related posts: