some check for the compilation on windows
This commit is contained in:
parent
75490acdee
commit
29ab385f1a
20
core/defs.mk
20
core/defs.mk
@ -337,9 +337,9 @@ define transform-h-to-gch
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "Precompile: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
|
||||
$(call check-pwd-is-top-dir)
|
||||
$(Q)$(CCACHE) $(GXX) \
|
||||
$(Q)$(CCACHE) $(CXX) \
|
||||
$(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) \
|
||||
$(TARGET_PCH_FLAGS) -MMD -MP -o $@ \
|
||||
$(call path-from-top,$<)
|
||||
@ -353,10 +353,10 @@ define transform-cpp-to-o
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "$(DISPLAY_ARM_MODE)C++: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
|
||||
$(call check-pwd-is-top-dir)
|
||||
$(Q)$(CCACHE) $(GXX) \
|
||||
$(Q)$(CCACHE) $(CXX) \
|
||||
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
|
||||
$(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) \
|
||||
-c -MMD -MP -g -o $@ \
|
||||
$(call path-from-top,$<)
|
||||
@ -370,10 +370,10 @@ define transform-c-to-o
|
||||
@echo "$(DISPLAY_ARM_MODE)C: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
|
||||
$(call check-pwd-is-top-dir)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CCACHE) $(GCC) \
|
||||
$(Q)$(CCACHE) $(CC) \
|
||||
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
|
||||
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \
|
||||
$(TARGET_GLOBAL_CFLAGS) $(GCC_FLAGS_WARNINGS) \
|
||||
$(TARGET_GLOBAL_CFLAGS) $(CC_FLAGS_WARNINGS) \
|
||||
$(PRIVATE_CFLAGS) \
|
||||
-c -MMD -MP -g -o $@ \
|
||||
$(call path-from-top,$<)
|
||||
@ -387,10 +387,10 @@ define transform-s-to-o
|
||||
@ echo "ASM: $(PRIVATE_MODULE) <== $(call path-from-top,$<)"
|
||||
$(call check-pwd-is-top-dir)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CCACHE) $(GCC) \
|
||||
$(Q)$(CCACHE) $(CC) \
|
||||
$(TARGET_GLOBAL_C_INCLUDES) $(PRIVATE_C_INCLUDES) \
|
||||
$(TARGET_GLOBAL_CFLAGS_$(PRIVATE_ARM_MODE)) \
|
||||
$(TARGET_GLOBAL_CFLAGS) $(GCC_FLAGS_WARNINGS) \
|
||||
$(TARGET_GLOBAL_CFLAGS) $(CC_FLAGS_WARNINGS) \
|
||||
$(PRIVATE_CFLAGS) \
|
||||
-c -MMD -MP -g -o $@ \
|
||||
$(call path-from-top,$<)
|
||||
@ -419,7 +419,7 @@ define transform-o-to-shared-lib
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "SharedLib: $(PRIVATE_MODULE) ==> $(call path-from-top,$@)"
|
||||
$(call check-pwd-is-top-dir)
|
||||
$(Q)$(GXX) \
|
||||
$(Q)$(CXX) \
|
||||
$(TARGET_GLOBAL_LDFLAGS_SHARED) \
|
||||
-Wl,-Map -Wl,$(basename $@).map \
|
||||
-shared \
|
||||
@ -446,7 +446,7 @@ define transform-o-to-executable
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "Executable: $(PRIVATE_MODULE) ==> $(call path-from-top,$@)"
|
||||
$(call check-pwd-is-top-dir)
|
||||
$(Q)$(GXX) \
|
||||
$(Q)$(CXX) \
|
||||
$(TARGET_GLOBAL_LDFLAGS) \
|
||||
-Wl,-Map -Wl,$(basename $@).map \
|
||||
-Wl,-rpath-link=$(TARGET_OUT_STAGING)/lib \
|
||||
|
49
core/main.mk
49
core/main.mk
@ -13,6 +13,9 @@
|
||||
# Make sure SHELL is correctly set
|
||||
SHELL := /bin/bash
|
||||
|
||||
# This is the default target. It must be the first declared target.
|
||||
all:
|
||||
|
||||
# Turns off suffix rules built into make
|
||||
.SUFFIXES:
|
||||
|
||||
@ -28,31 +31,28 @@ ifeq ("$(V)","0")
|
||||
endif
|
||||
|
||||
# Tools for host
|
||||
HOST_GCC ?= gcc
|
||||
HOST_GXX ?= g++
|
||||
HOST_CC ?= gcc
|
||||
HOST_CXX ?= g++
|
||||
HOST_AR ?= ar
|
||||
HOST_LD ?= ld
|
||||
HOST_STRIP ?= strip
|
||||
|
||||
# Tools for target
|
||||
ifneq ("$(CLANG)","1")
|
||||
GCC ?= $(CROSS)gcc
|
||||
GXX ?= $(CROSS)g++
|
||||
CC := $(CROSS)gcc
|
||||
CXX := $(CROSS)g++
|
||||
else
|
||||
GCC ?= $(CROSS)clang
|
||||
GXX ?= $(CROSS)clang++
|
||||
CC := $(CROSS)clang
|
||||
CXX := $(CROSS)clang++
|
||||
endif
|
||||
AR ?= $(CROSS)ar
|
||||
LD ?= $(CROSS)ld
|
||||
AS ?= $(CROSS)as
|
||||
NM ?= $(CROSS)nm
|
||||
STRIP ?= $(CROSS)strip
|
||||
RANLIB ?= $(CROSS)ranlib
|
||||
DLLTOOL ?= $(CROSS)dlltool
|
||||
OBJDUMP ?= $(CROSS)objdump
|
||||
AR := $(CROSS)ar
|
||||
LD := $(CROSS)ld
|
||||
AS := $(CROSS)as
|
||||
NM := $(CROSS)nm
|
||||
STRIP := $(CROSS)strip
|
||||
RANLIB := $(CROSS)ranlib
|
||||
DLLTOOL := $(CROSS)dlltool
|
||||
|
||||
# This is the default target. It must be the first declared target.
|
||||
all:
|
||||
|
||||
# Target global variables
|
||||
TARGET_GLOBAL_C_INCLUDES ?=
|
||||
@ -119,21 +119,12 @@ else
|
||||
endif
|
||||
|
||||
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_FINAL ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/bin
|
||||
TARGET_OUT_STAGING ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/staging
|
||||
TARGET_OUT_FINAL ?= $(shell pwd)/out/$(TARGET_OS)/$(BUILD_DIRECTORY_MODE)/final
|
||||
|
||||
# Makefile with the list of all makefiles available and include them
|
||||
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
|
||||
_moduleFolder = $(shell find $(USER_PACKAGES) -name $(TARGET_OS).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_STAGING: $(TARGET_OUT_STAGING))
|
||||
$(info TARGET_OUT_FINAL: $(TARGET_OUT_FINAL))
|
||||
$(info GCC_PATH: $(GCC_PATH))
|
||||
$(info GCC_VERSION: $(GCC_VERSION))
|
||||
$(info CC_PATH: $(CC_PATH))
|
||||
$(info CC_VERSION: $(CC_VERSION))
|
||||
$(info ----------------------------------------------------------------------)
|
||||
|
@ -53,7 +53,10 @@ ifeq ("$(TARGET_OS)","Windows")
|
||||
ifeq ("$(STATIC)","1")
|
||||
TARGET_GLOBAL_LDFLAGS += -Wl,-Bstatic
|
||||
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")
|
||||
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 \
|
||||
@ -61,6 +64,10 @@ else ifeq ("$(TARGET_OS)","Android")
|
||||
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
|
||||
TARGET_GLOBAL_CPPFLAGS += -fno-rtti -Wa,--noexecstack
|
||||
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
|
||||
|
||||
# define the target OS type for the compilation system ...
|
||||
@ -98,7 +105,7 @@ endif
|
||||
|
||||
# Architecture
|
||||
#ifndef TARGET_ARCH
|
||||
# ifneq ("$(shell $(GCC) -dumpmachine | grep 64)","")
|
||||
# ifneq ("$(shell $(CC) -dumpmachine | grep 64)","")
|
||||
# TARGET_ARCH := AMD64
|
||||
# else
|
||||
# TARGET_ARCH := X86
|
||||
@ -113,28 +120,29 @@ endif
|
||||
# TARGET_GLOBAL_CFLAGS += -m32
|
||||
#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")
|
||||
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
|
||||
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
|
||||
|
@ -7,11 +7,11 @@
|
||||
###############################################################################
|
||||
|
||||
COMMON_FLAGS_WARNINGS :=
|
||||
GCC_FLAGS_WARNINGS :=
|
||||
GXX_FLAGS_WARNINGS :=
|
||||
CC_FLAGS_WARNINGS :=
|
||||
CXX_FLAGS_WARNINGS :=
|
||||
|
||||
# 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
|
||||
endif
|
||||
|
||||
@ -28,24 +28,24 @@ endif
|
||||
#COMMON_FLAGS_WARNINGS += -Winit-self
|
||||
|
||||
# C specific
|
||||
#GCC_FLAGS_WARNINGS += -Wmissing-declarations
|
||||
#GCC_FLAGS_WARNINGS += -Wmissing-prototypes
|
||||
#GCC_FLAGS_WARNINGS += -Wjump-misses-init
|
||||
#CC_FLAGS_WARNINGS += -Wmissing-declarations
|
||||
#CC_FLAGS_WARNINGS += -Wmissing-prototypes
|
||||
#CC_FLAGS_WARNINGS += -Wjump-misses-init
|
||||
|
||||
# c++ specific
|
||||
#GXX_FLAGS_WARNINGS += -Wctor-dtor-privacy
|
||||
#GXX_FLAGS_WARNINGS += -Wnon-virtual-dtor
|
||||
#GXX_FLAGS_WARNINGS += -Wreorder
|
||||
#GXX_FLAGS_WARNINGS += -Woverloaded-virtual
|
||||
#CXX_FLAGS_WARNINGS += -Wctor-dtor-privacy
|
||||
#CXX_FLAGS_WARNINGS += -Wnon-virtual-dtor
|
||||
#CXX_FLAGS_WARNINGS += -Wreorder
|
||||
#CXX_FLAGS_WARNINGS += -Woverloaded-virtual
|
||||
|
||||
|
||||
ifneq ("$(CLANG)","1")
|
||||
# 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
|
||||
endif
|
||||
# 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
|
||||
endif
|
||||
endif
|
||||
@ -56,12 +56,12 @@ ifeq ("$(W)","1")
|
||||
COMMON_FLAGS_WARNINGS += -Wswitch-enum
|
||||
COMMON_FLAGS_WARNINGS += -Wcast-qual
|
||||
# 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
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add common flags to specific flags
|
||||
GCC_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS)
|
||||
GXX_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS)
|
||||
CC_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS)
|
||||
CXX_FLAGS_WARNINGS += $(COMMON_FLAGS_WARNINGS)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user