some check for the compilation on windows

This commit is contained in:
Edouard Dupin 2012-08-16 18:18:40 +02:00
parent 75490acdee
commit 29ab385f1a
4 changed files with 72 additions and 73 deletions

View File

@ -337,9 +337,9 @@ define transform-h-to-gch
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo "Precompile: $(PRIVATE_MODULE) <== $(call path-from-top,$<)" @echo "Precompile: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
$(call check-pwd-is-top-dir) $(call check-pwd-is-top-dir)
$(Q)$(CCACHE) $(GXX) \ $(Q)$(CCACHE) $(CXX) \
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \ $(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
$(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(GXX_FLAGS_WARNINGS) \ $(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(CXX_FLAGS_WARNINGS) \
$(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \ $(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \
$(TARGET_PCH_FLAGS) -MMD -MP -o $@ \ $(TARGET_PCH_FLAGS) -MMD -MP -o $@ \
$(call path-from-top,$<) $(call path-from-top,$<)
@ -353,10 +353,10 @@ define transform-cpp-to-o
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo "$(DISPLAY_ARM_MODE)C++: $(PRIVATE_MODULE) <== $(call path-from-top,$<)" @echo "$(DISPLAY_ARM_MODE)C++: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
$(call check-pwd-is-top-dir) $(call check-pwd-is-top-dir)
$(Q)$(CCACHE) $(GXX) \ $(Q)$(CCACHE) $(CXX) \
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \ $(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ $(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \
$(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(GXX_FLAGS_WARNINGS) \ $(TARGET_GLOBAL_CFLAGS) $(TARGET_GLOBAL_CPPFLAGS) $(CXX_FLAGS_WARNINGS) \
$(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \ $(PRIVATE_CFLAGS) $(PRIVATE_CPPFLAGS) \
-c -MMD -MP -g -o $@ \ -c -MMD -MP -g -o $@ \
$(call path-from-top,$<) $(call path-from-top,$<)
@ -370,10 +370,10 @@ define transform-c-to-o
@echo "$(DISPLAY_ARM_MODE)C: $(PRIVATE_MODULE) <== $(call path-from-top,$<)" @echo "$(DISPLAY_ARM_MODE)C: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
$(call check-pwd-is-top-dir) $(call check-pwd-is-top-dir)
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(Q)$(CCACHE) $(GCC) \ $(Q)$(CCACHE) $(CC) \
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \ $(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ $(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \
$(TARGET_GLOBAL_CFLAGS) $(GCC_FLAGS_WARNINGS) \ $(TARGET_GLOBAL_CFLAGS) $(CC_FLAGS_WARNINGS) \
$(PRIVATE_CFLAGS) \ $(PRIVATE_CFLAGS) \
-c -MMD -MP -g -o $@ \ -c -MMD -MP -g -o $@ \
$(call path-from-top,$<) $(call path-from-top,$<)
@ -387,10 +387,10 @@ define transform-s-to-o
@ echo "ASM: $(PRIVATE_MODULE) <== $(call path-from-top,$<)" @ echo "ASM: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
$(call check-pwd-is-top-dir) $(call check-pwd-is-top-dir)
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(Q)$(CCACHE) $(GCC) \ $(Q)$(CCACHE) $(CC) \
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \ $(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \ $(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \
$(TARGET_GLOBAL_CFLAGS) $(GCC_FLAGS_WARNINGS) \ $(TARGET_GLOBAL_CFLAGS) $(CC_FLAGS_WARNINGS) \
$(PRIVATE_CFLAGS) \ $(PRIVATE_CFLAGS) \
-c -MMD -MP -g -o $@ \ -c -MMD -MP -g -o $@ \
$(call path-from-top,$<) $(call path-from-top,$<)
@ -419,7 +419,7 @@ define transform-o-to-shared-lib
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo "SharedLib: $(PRIVATE_MODULE) ==> $(call path-from-top,$@)" @echo "SharedLib: $(PRIVATE_MODULE) ==> $(call path-from-top,$@)"
$(call check-pwd-is-top-dir) $(call check-pwd-is-top-dir)
$(Q)$(GXX) \ $(Q)$(CXX) \
$(TARGET_GLOBAL_LDFLAGS_SHARED) \ $(TARGET_GLOBAL_LDFLAGS_SHARED) \
-Wl,-Map -Wl,$(basename $@).map \ -Wl,-Map -Wl,$(basename $@).map \
-shared \ -shared \
@ -446,7 +446,7 @@ define transform-o-to-executable
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo "Executable: $(PRIVATE_MODULE) ==> $(call path-from-top,$@)" @echo "Executable: $(PRIVATE_MODULE) ==> $(call path-from-top,$@)"
$(call check-pwd-is-top-dir) $(call check-pwd-is-top-dir)
$(Q)$(GXX) \ $(Q)$(CXX) \
$(TARGET_GLOBAL_LDFLAGS) \ $(TARGET_GLOBAL_LDFLAGS) \
-Wl,-Map -Wl,$(basename $@).map \ -Wl,-Map -Wl,$(basename $@).map \
-Wl,-rpath-link=$(TARGET_OUT_STAGING)/lib \ -Wl,-rpath-link=$(TARGET_OUT_STAGING)/lib \

View File

@ -13,6 +13,9 @@
# Make sure SHELL is correctly set # Make sure SHELL is correctly set
SHELL := /bin/bash SHELL := /bin/bash
# This is the default target. It must be the first declared target.
all:
# Turns off suffix rules built into make # Turns off suffix rules built into make
.SUFFIXES: .SUFFIXES:
@ -28,31 +31,28 @@ ifeq ("$(V)","0")
endif endif
# Tools for host # Tools for host
HOST_GCC ?= gcc HOST_CC ?= gcc
HOST_GXX ?= g++ HOST_CXX ?= g++
HOST_AR ?= ar HOST_AR ?= ar
HOST_LD ?= ld HOST_LD ?= ld
HOST_STRIP ?= strip HOST_STRIP ?= strip
# Tools for target # Tools for target
ifneq ("$(CLANG)","1") ifneq ("$(CLANG)","1")
GCC ?= $(CROSS)gcc CC := $(CROSS)gcc
GXX ?= $(CROSS)g++ CXX := $(CROSS)g++
else else
GCC ?= $(CROSS)clang CC := $(CROSS)clang
GXX ?= $(CROSS)clang++ CXX := $(CROSS)clang++
endif endif
AR ?= $(CROSS)ar AR := $(CROSS)ar
LD ?= $(CROSS)ld LD := $(CROSS)ld
AS ?= $(CROSS)as AS := $(CROSS)as
NM ?= $(CROSS)nm NM := $(CROSS)nm
STRIP ?= $(CROSS)strip STRIP := $(CROSS)strip
RANLIB ?= $(CROSS)ranlib RANLIB := $(CROSS)ranlib
DLLTOOL ?= $(CROSS)dlltool DLLTOOL := $(CROSS)dlltool
OBJDUMP ?= $(CROSS)objdump
# This is the default target. It must be the first declared target.
all:
# Target global variables # Target global variables
TARGET_GLOBAL_C_INCLUDES ?= TARGET_GLOBAL_C_INCLUDES ?=
@ -119,21 +119,12 @@ else
endif endif
TARGET_OUT_BUILD ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/obj TARGET_OUT_BUILD ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/obj
TARGET_OUT_STAGING ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/obj TARGET_OUT_STAGING ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/staging
TARGET_OUT_FINAL ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/bin TARGET_OUT_FINAL ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/final
# Makefile with the list of all makefiles available and include them # Makefile with the list of all makefiles available and include them
SCAN_TARGET := scan SCAN_TARGET := scan
#display the properties of the currend building folder ...
ifeq ("$(V)","1")
$(info mydir="$(my-dir)")
$(info pwd="$(shell pwd)")
$(info TOP_DIR="$(TOP_DIR)")
$(info USER_PACKAGES="$(USER_PACKAGES)")
$(info list packet=$(shell find $(USER_PACKAGES) -name $(TARGET_OS).mk))
endif
# Get the list of all makefiles available and include them this find the TARGET_OS.mk and the Generic.mk # Get the list of all makefiles available and include them this find the TARGET_OS.mk and the Generic.mk
_moduleFolder = $(shell find $(USER_PACKAGES) -name $(TARGET_OS).mk) _moduleFolder = $(shell find $(USER_PACKAGES) -name $(TARGET_OS).mk)
_moduleFolder += $(shell find $(USER_PACKAGES) -name Generic.mk) _moduleFolder += $(shell find $(USER_PACKAGES) -name Generic.mk)
@ -213,6 +204,6 @@ $(info TARGET_ARCH: $(TARGET_ARCH))
$(info TARGET_OUT_BUILD: $(TARGET_OUT_BUILD)) $(info TARGET_OUT_BUILD: $(TARGET_OUT_BUILD))
$(info TARGET_OUT_STAGING: $(TARGET_OUT_STAGING)) $(info TARGET_OUT_STAGING: $(TARGET_OUT_STAGING))
$(info TARGET_OUT_FINAL: $(TARGET_OUT_FINAL)) $(info TARGET_OUT_FINAL: $(TARGET_OUT_FINAL))
$(info GCC_PATH: $(GCC_PATH)) $(info CC_PATH: $(CC_PATH))
$(info GCC_VERSION: $(GCC_VERSION)) $(info CC_VERSION: $(CC_VERSION))
$(info ----------------------------------------------------------------------) $(info ----------------------------------------------------------------------)

View File

@ -53,7 +53,10 @@ ifeq ("$(TARGET_OS)","Windows")
ifeq ("$(STATIC)","1") ifeq ("$(STATIC)","1")
TARGET_GLOBAL_LDFLAGS += -Wl,-Bstatic TARGET_GLOBAL_LDFLAGS += -Wl,-Bstatic
endif endif
# remove CLANG if defined
ifeq ("$(CLANG)","1")
$(error CLANG is not supported on $(TARGET_OS) platform ==> disable it)
endif
else ifeq ("$(TARGET_OS)","Android") else ifeq ("$(TARGET_OS)","Android")
TARGET_GLOBAL_CFLAGS += -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \ TARGET_GLOBAL_CFLAGS += -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
-fpic -ffunction-sections -funwind-tables -fstack-protector \ -fpic -ffunction-sections -funwind-tables -fstack-protector \
@ -61,6 +64,10 @@ else ifeq ("$(TARGET_OS)","Android")
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
TARGET_GLOBAL_CPPFLAGS += -fno-rtti -Wa,--noexecstack TARGET_GLOBAL_CPPFLAGS += -fno-rtti -Wa,--noexecstack
TARGET_GLOBAL_LDFLAGS += TARGET_GLOBAL_LDFLAGS +=
# remove CLANG if defined ==> TODO : Support it later ...
ifeq ("$(CLANG)","1")
$(error CLANG is not supported on $(TARGET_OS) platform ==> disable it)
endif
endif endif
# define the target OS type for the compilation system ... # define the target OS type for the compilation system ...
@ -98,7 +105,7 @@ endif
# Architecture # Architecture
#ifndef TARGET_ARCH #ifndef TARGET_ARCH
# ifneq ("$(shell $(GCC) -dumpmachine | grep 64)","") # ifneq ("$(shell $(CC) -dumpmachine | grep 64)","")
# TARGET_ARCH := AMD64 # TARGET_ARCH := AMD64
# else # else
# TARGET_ARCH := X86 # TARGET_ARCH := X86
@ -113,28 +120,29 @@ endif
# TARGET_GLOBAL_CFLAGS += -m32 # TARGET_GLOBAL_CFLAGS += -m32
#endif #endif
###############################################################################
## Variables based on DEBUG/STATIC.
###############################################################################
#ifeq ("$(DEBUG)","0")
# TARGET_GLOBAL_CFLAGS += -O2 -g -DNDEBUG
# TARGET_OUT_INTERMEDIATES := $(TOP_DIR)/build_gcc$(DIR_SUFFIX)/release
# TARGET_OUT := $(TOP_DIR)/out_gcc$(DIR_SUFFIX)/release
#else
# TARGET_GLOBAL_CFLAGS += -O0 -g -DDEBUG -D_DEBUG
# TARGET_OUT_INTERMEDIATES := $(TOP_DIR)/build_gcc$(DIR_SUFFIX)/debug
# TARGET_OUT := $(TOP_DIR)/out_gcc$(DIR_SUFFIX)/debug
#endif
############################################################################### ###############################################################################
## Determine gcc path and version. ## Determine CC path and version. and check if installed ...
############################################################################### ###############################################################################
GCC_PATH := $(shell which $(GCC)) CC_PATH := $(shell which $(CC))
ifeq ("$(CC_PATH)","")
ifeq ("$(TARGET_OS)","Windows")
$(error Compilator does not exist : $(CC) ==> if not installed ... "apt-get install mingw32")
else ifeq ("$(TARGET_OS)","Android")
$(error Compilator does not exist : $(CC) ==> add and define the android NDK "http://developer.android.com/tools/sdk/ndk/index.html")
else
ifneq ("$(CLANG)","1")
$(error Compilator does not exist : $(CC) ==> if not installed ... "apt-get install gcc g++")
else
$(error Compilator does not exist : $(CC) ==> if not installed ... "apt-get install clang")
endif
endif
endif
ifneq ("$(CLANG)","1") ifneq ("$(CLANG)","1")
GCC_VERSION := $(shell $(GCC) --version | head -1 | sed "s/.*\([0-9]\.[0-9]\.[0-9]\).*/\1/") CC_VERSION := $(shell $(CC) --version | head -1 | sed "s/.*\([0-9]\.[0-9]\.[0-9]\).*/\1/")
else else
GCC_VERSION := $(shell $(GCC) --version | head -1 | sed "s/.*\([0-9]\.[0-9]-[0-9]\).*/\1/") CC_VERSION := $(shell $(CC) --version | head -1 | sed "s/.*\([0-9]\.[0-9]-[0-9]\).*/\1/")
endif endif

View File

@ -7,11 +7,11 @@
############################################################################### ###############################################################################
COMMON_FLAGS_WARNINGS := COMMON_FLAGS_WARNINGS :=
GCC_FLAGS_WARNINGS := CC_FLAGS_WARNINGS :=
GXX_FLAGS_WARNINGS := CXX_FLAGS_WARNINGS :=
# show option associated with warning (gcc >= 4.0.0) # show option associated with warning (gcc >= 4.0.0)
ifneq (0,$(shell expr $(GCC_VERSION) \>= 4.0.0)) ifneq (0,$(shell expr $(CC_VERSION) \>= 4.0.0))
COMMON_FLAGS_WARNINGS += -fdiagnostics-show-option COMMON_FLAGS_WARNINGS += -fdiagnostics-show-option
endif endif
@ -28,24 +28,24 @@ endif
#COMMON_FLAGS_WARNINGS += -Winit-self #COMMON_FLAGS_WARNINGS += -Winit-self
# C specific # C specific
#GCC_FLAGS_WARNINGS += -Wmissing-declarations #CC_FLAGS_WARNINGS += -Wmissing-declarations
#GCC_FLAGS_WARNINGS += -Wmissing-prototypes #CC_FLAGS_WARNINGS += -Wmissing-prototypes
#GCC_FLAGS_WARNINGS += -Wjump-misses-init #CC_FLAGS_WARNINGS += -Wjump-misses-init
# c++ specific # c++ specific
#GXX_FLAGS_WARNINGS += -Wctor-dtor-privacy #CXX_FLAGS_WARNINGS += -Wctor-dtor-privacy
#GXX_FLAGS_WARNINGS += -Wnon-virtual-dtor #CXX_FLAGS_WARNINGS += -Wnon-virtual-dtor
#GXX_FLAGS_WARNINGS += -Wreorder #CXX_FLAGS_WARNINGS += -Wreorder
#GXX_FLAGS_WARNINGS += -Woverloaded-virtual #CXX_FLAGS_WARNINGS += -Woverloaded-virtual
ifneq ("$(CLANG)","1") ifneq ("$(CLANG)","1")
# gcc >= 4.5.0 (too many false positives with previous versions) # gcc >= 4.5.0 (too many false positives with previous versions)
ifneq (0,$(shell expr $(GCC_VERSION) \>= 4.5.0)) ifneq (0,$(shell expr $(CC_VERSION) \>= 4.5.0))
COMMON_FLAGS_WARNINGS += -Wunreachable-code COMMON_FLAGS_WARNINGS += -Wunreachable-code
endif endif
# gcc >= 4.5.2 # gcc >= 4.5.2
ifneq (0,$(shell expr $(GCC_VERSION) \>= 4.5.2)) ifneq (0,$(shell expr $(CC_VERSION) \>= 4.5.2))
COMMON_FLAGS_WARNINGS += -Wlogical-op COMMON_FLAGS_WARNINGS += -Wlogical-op
endif endif
endif endif
@ -56,12 +56,12 @@ ifeq ("$(W)","1")
COMMON_FLAGS_WARNINGS += -Wswitch-enum COMMON_FLAGS_WARNINGS += -Wswitch-enum
COMMON_FLAGS_WARNINGS += -Wcast-qual COMMON_FLAGS_WARNINGS += -Wcast-qual
# gcc >= 4.4.0 # gcc >= 4.4.0
ifneq (0,$(shell expr $(GCC_VERSION) \>= 4.4.0)) ifneq (0,$(shell expr $(CC_VERSION) \>= 4.4.0))
COMMON_FLAGS_WARNINGS += -Wframe-larger-than=1024 COMMON_FLAGS_WARNINGS += -Wframe-larger-than=1024
endif endif
endif endif
# Add common flags to specific flags # Add common flags to specific flags
GCC_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS) CC_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS)
GXX_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS) CXX_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS)