diff --git a/Makefile.Android.mk b/Makefile.Android.mk index 705af64..f2656af 100644 --- a/Makefile.Android.mk +++ b/Makefile.Android.mk @@ -1,15 +1,20 @@ +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### +# Define SDK and NDK folder for Android compilation tools and packager tools : +ifeq ("$(PROJECT_NDK)","") + PROJECT_NDK:=$(call fullpath,$(PROJECT_PATH)/../android/ndk/) + $(info Auto define android NDK project to : $(PROJECT_NDK)) +endif +ifeq ("$(PROJECT_NDK)","") + PROJECT_SDK:=$(call fullpath,$(PROJECT_PATH)/../android/sdk/) + $(info Auto define Android SDK project to : $(PROJECT_SDK)) +endif - -# Setup macros definitions -include $(BUILD_SYSTEM)/core/defs.mk - -# include generic makefile : -include $(BUILD_SYSTEM)/core/check-project-variable.mk - -PROJECT_NDK?=.. - -TARGET_OS := Android #TARGET_ARCH := ARM TARGET_ARCH := ARMv7 TARGET_CROSS := $(PROJECT_NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- diff --git a/Makefile.Linux.mk b/Makefile.Linux.mk index e89a692..ddd7465 100644 --- a/Makefile.Linux.mk +++ b/Makefile.Linux.mk @@ -1,11 +1,9 @@ - - -# Setup macros definitions -include $(BUILD_SYSTEM)/core/defs.mk - -# include generic makefile : -include $(BUILD_SYSTEM)/core/check-project-variable.mk - +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### TARGET_OUT_FOLDER_BINARY := $(PROJECT_NAME2)/usr/bin TARGET_OUT_FOLDER_LIBRAIRY := $(PROJECT_NAME2)/usr/lib @@ -15,7 +13,7 @@ TARGET_OUT_PREFIX_LIBRAIRY := # include generic makefile : -include $(BUILD_SYSTEM)/core/main.mk +include $(BUILD_SYSTEM)/main.mk TARGET_OUT_FOLDER_DEBIAN=$(TARGET_OUT_STAGING)/$(PROJECT_NAME2)/DEBIAN diff --git a/Makefile.MacOs.mk b/Makefile.MacOs.mk index dd54d25..b4d67ab 100644 --- a/Makefile.MacOs.mk +++ b/Makefile.MacOs.mk @@ -1,13 +1,9 @@ - - - -# Setup macros definitions -include $(BUILD_SYSTEM)/core/defs.mk - -# include generic makefile : -include $(BUILD_SYSTEM)/core/check-project-variable.mk - - +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### # for MAcOSX we need to FORCE CLANG CLANG:=1 @@ -25,7 +21,7 @@ TARGET_OUT_PREFIX_LIBRAIRY := # include generic makefile : -include $(BUILD_SYSTEM)/core/main.mk +include $(BUILD_SYSTEM)/main.mk FINAL_FOLDER= $(TARGET_OUT_FINAL)/$(PROJECT_NAME).app/Contents diff --git a/Makefile.Windows.mk b/Makefile.Windows.mk index c6213d9..aadd7d2 100644 --- a/Makefile.Windows.mk +++ b/Makefile.Windows.mk @@ -1,14 +1,10 @@ +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### - -# Setup macros definitions -include $(BUILD_SYSTEM)/core/defs.mk - -# include generic makefile : -include $(BUILD_SYSTEM)/core/check-project-variable.mk - - -# defien the target OS of this system -TARGET_OS=Windows # define the cross compilateur TARGET_CROSS=i586-mingw32msvc- @@ -18,7 +14,7 @@ TARGET_OUT_FOLDER_DATA := data TARGET_OUT_FOLDER_DOC := doc TARGET_OUT_PREFIX_LIBRAIRY := -include $(BUILD_SYSTEM)/core/main.mk +include $(BUILD_SYSTEM)/main.mk final: all diff --git a/Makefile.mk b/Makefile.mk index 03e0156..f15d2e8 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -1,35 +1,83 @@ +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### -# get the local dir in a good form : +############################################################################### +## General setup. +############################################################################### + +# 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: + +# Quiet command if V is 0 +ifneq ("$(V)","1") + Q := @ +endif + +############################################################################### +## Basic PATHS. +############################################################################### + +# Directories (full path) +TOP_DIR := $(shell pwd) #BUILD_SYSTEM := $(shell readlink -m -n $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))) -BUILD_SYSTEM := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) +BUILD_SYSTEM_BASE := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) +BUILD_SYSTEM := $(BUILD_SYSTEM_BASE)/core + +############################################################################### +## Basic configurations. +############################################################################### + +# Determine the Host-Os type : +include $(BUILD_SYSTEM)/setup-host-define-type.mk + +# Setup macros definitions : +include $(BUILD_SYSTEM)/defs.mk + +# include generic makefile : +include $(BUILD_SYSTEM)/check-project-variable.mk ############################################################################### ### Platform specificity : ### ############################################################################### SUPPORTED_PLATFORM=Linux Windows MacOs IOs Android -DEFAULT_PLATFORM=Linux +# By default we build for the current platform +DEFAULT_PLATFORM=$(HOST_OS) # default platform can be overridden PLATFORM?=$(DEFAULT_PLATFORM) PROJECT_PATH=$(shell pwd) -PROJECT_MODULE=$(shell readlink -n $(PROJECT_PATH)/../) +PROJECT_MODULE=$(call fullpath,$(PROJECT_PATH)/../) -ifeq ($(PLATFORM), Linux) - PROJECT_NDK?=$(shell readlink -n $$(PROJECT_MODULE)/ewol/) -else ifeq ($(PLATFORM), MacOs) - TARGET_OS=MacOs - PROJECT_NDK?=$$(PROJECT_MODULE)/ewol/ -else ifeq ($(PLATFORM), IOs) - -else ifeq ($(PLATFORM), Windows) - -else ifeq ($(PLATFORM), Android) - PROJECT_NDK:=$(shell readlink -n $(PROJECT_PATH)/../android/ndk/) - PROJECT_SDK:=$(shell readlink -n $(PROJECT_PATH)/../android/sdk/) -else +ifeq ($(filter $(PLATFORM), $(SUPPORTED_PLATFORM)), ) $(error you must specify a corect platform : make PLATFORM=[$(SUPPORTED_PLATFORM)]) endif -include $(BUILD_SYSTEM)/Makefile.$(PLATFORM).mk +# define the target OS of this system +TARGET_OS:=$(PLATFORM) + + + +############################################################################### +## Build system setup. +############################################################################### + +ifeq ("$(DEBUG)","1") + BUILD_DIRECTORY_MODE := debug +else + BUILD_DIRECTORY_MODE := release +endif + + +include $(BUILD_SYSTEM_BASE)/Makefile.$(PLATFORM).mk diff --git a/core/build-executable.mk b/core/build-executable.mk index 85f4aeb..e196664 100644 --- a/core/build-executable.mk +++ b/core/build-executable.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file executable.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Register an executable (can be build). +## @project standard Build system +## @copyright BSDv3 ############################################################################### LOCAL_MODULE_CLASS := EXECUTABLE diff --git a/core/build-prebuilt.mk b/core/build-prebuilt.mk index 1f9b9bd..d3d8be9 100644 --- a/core/build-prebuilt.mk +++ b/core/build-prebuilt.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file prebuilt.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Register a prebuilt module. +## @project standard Build system +## @copyright BSDv3 ############################################################################### LOCAL_MODULE_CLASS := PREBUILT diff --git a/core/build-shared.mk b/core/build-shared.mk index f382760..d2f29a1 100644 --- a/core/build-shared.mk +++ b/core/build-shared.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file shared.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Register a shared library (can be build). +## @project standard Build system +## @copyright BSDv3 ############################################################################### LOCAL_MODULE_CLASS := SHARED_LIBRARY diff --git a/core/build-static.mk b/core/build-static.mk index d912c6d..189fe98 100644 --- a/core/build-static.mk +++ b/core/build-static.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file static.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Register a static library (can be build). +## @project standard Build system +## @copyright BSDv3 ############################################################################### LOCAL_MODULE_CLASS := STATIC_LIBRARY diff --git a/core/check-project-variable.mk b/core/check-project-variable.mk index 73e417b..4febfd7 100644 --- a/core/check-project-variable.mk +++ b/core/check-project-variable.mk @@ -1,3 +1,9 @@ +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### ####################################################################################### # Global project variables diff --git a/core/clearvars.mk b/core/clearvars.mk index ea795b0..06335e0 100644 --- a/core/clearvars.mk +++ b/core/clearvars.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file clearvars.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Clear out values of all variables used by rule templates. +## @project standard Build system +## @copyright BSDv3 ############################################################################### # Do NOT clear LOCAL_PATH, it is set BEFORE including this makefile diff --git a/core/config.mk b/core/config.mk index c0d76c5..8cc0adf 100644 --- a/core/config.mk +++ b/core/config.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file config.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Configuration management. +## @project standard Build system +## @copyright BSDv3 ############################################################################### # Tools (absolute path) diff --git a/core/defs.mk b/core/defs.mk index 33002ef..4cf855d 100644 --- a/core/defs.mk +++ b/core/defs.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file defs.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## This file contains macros used by other makefiles. +## @project standard Build system +## @copyright BSDv3 ############################################################################### ############################################################################### @@ -38,10 +36,10 @@ false := # Get full path. # $1 : path to extend. -ifneq ("HOST_HAS_READLINK","true") +ifneq ("$(HOST_HAS_READLINK)","true") fullpath = $1 else -fullpath = $(shell readlink -n $1) +fullpath = $(shell readlink -m -n $1) endif # Figure out where we are diff --git a/core/main.mk b/core/main.mk index 295848e..45d28f1 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1,51 +1,11 @@ ############################################################################### -## @file main.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Main Makefile. +## @project standard Build system +## @copyright BSDv3 ############################################################################### -############################################################################### -## General setup. -############################################################################### -# 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: - -# Overridable settings -V := 0 -W := 0 -# debug mode of the software -DEBUG := 0 -# compilation done with Clang system instead of gcc -CLANG := 0 - -# Quiet command if V is 0 -ifeq ("$(V)","0") - Q := @ -endif - -############################################################################### -## Build system setup. -############################################################################### - -# Directories (full path) -TOP_DIR := $(shell pwd) -BUILD_SYSTEM := $(BUILD_SYSTEM)/core - -ifeq ("$(DEBUG)","1") - BUILD_DIRECTORY_MODE := debug -else - BUILD_DIRECTORY_MODE := release -endif # Setup configuration include $(BUILD_SYSTEM)/setup-host.mk diff --git a/core/module.mk b/core/module.mk index 71ffdd5..997bd0b 100644 --- a/core/module.mk +++ b/core/module.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file module.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Build a module. +## @project standard Build system +## @copyright BSDv3 ############################################################################### # Bring back all LOCAL_XXX variables defined by LOCAL_MODULE diff --git a/core/rules.mk b/core/rules.mk index 50bc73e..ccb6993 100644 --- a/core/rules.mk +++ b/core/rules.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file rules.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Generate rules for building an executable or library. +## @project standard Build system +## @copyright BSDv3 ############################################################################### # Intermediate/Build directory diff --git a/core/setup-host-define-type.mk b/core/setup-host-define-type.mk new file mode 100644 index 0000000..c8bf49d --- /dev/null +++ b/core/setup-host-define-type.mk @@ -0,0 +1,27 @@ +############################################################################### +## @author Edouard DUPIN +## @date 17-08-2012 +## @project standard Build system +## @copyright BSDv3 +############################################################################### + +# check if the user does not decide to force an other HOST_OS +ifneq ("$(HOST_OS)","") + $(error User must not define $(HOST_OS)) +endif + +# Host OS +ifneq ("$(shell echo $$OSTYPE | grep msys)","") + # Windows Host + HOST_OS := Windows + HOST_HAS_READLINK := true +else ifneq ("$(shell echo $$OSTYPE | grep darwin)","") + # MAC OS host + HOST_OS := MacOs + HOST_HAS_READLINK := false +else + # Linux Host + HOST_OS := Linux + HOST_HAS_READLINK := true +endif + diff --git a/core/setup-host.mk b/core/setup-host.mk index 1f1d51d..7e9a36d 100644 --- a/core/setup-host.mk +++ b/core/setup-host.mk @@ -1,16 +1,11 @@ ############################################################################### -## @file setup-host.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL +## @project standard Build system +## @copyright BSDv3 ############################################################################### -# check if the user does not decide to force an other HOST_OS -ifneq ("$(HOST_OS)","") - $(error User must not define $(HOST_OS)) -endif - -############################################################################### +############################################################################## ## Tools for host. ############################################################################### @@ -41,21 +36,20 @@ HOST_GLOBAL_LDLIBS ?= HOST_GLOBAL_LDLIBS_SHARED ?= # Host OS -ifneq ("$(shell echo $$OSTYPE | grep msys)","") - HOST_OS := Windows +ifeq ("$(HOST_OS)","Windows") HOST_EXE_SUFFIX := .exe HOST_SHARED_LIB_SUFFIX := .dll - HOST_HAS_READLINK := true -else - ifneq ("$(shell echo $$OSTYPE | grep darwin)","") - HOST_OS := MacOs - HOST_SHARED_LIB_SUFFIX := .dylib - HOST_HAS_READLINK := false - else - HOST_OS := Linux - HOST_SHARED_LIB_SUFFIX := .so - HOST_HAS_READLINK := true - endif +else ifeq ("$(HOST_OS)","MacOs") HOST_EXE_SUFFIX := + HOST_SHARED_LIB_SUFFIX := .dylib +else ifeq ("$(HOST_OS)","IOs") + $(error HOST_OS=$(HOST_OS) ==> not supported for compilation ... ) +else ifeq ("$(HOST_OS)","Linux") + HOST_EXE_SUFFIX := + HOST_SHARED_LIB_SUFFIX := .so +else ifeq ("$(HOST_OS)","Android") + $(error HOST_OS=$(HOST_OS) ==> not supported for compilation ... ) +else + $(error HOST_OS=$(HOST_OS) ==> Unknow OS for compilation ... ) endif diff --git a/core/setup-target.mk b/core/setup-target.mk index 79735a2..7aa2e7e 100644 --- a/core/setup-target.mk +++ b/core/setup-target.mk @@ -1,13 +1,10 @@ ############################################################################### -## @file setup-target.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL +## @project standard Build system +## @copyright BSDv3 ############################################################################### - - - ############################################################################### ## Tools for target. ############################################################################### diff --git a/core/setup.mk b/core/setup.mk index 50bc3b4..b9171f7 100644 --- a/core/setup.mk +++ b/core/setup.mk @@ -1,10 +1,9 @@ ############################################################################### -## @file setup.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL +## @project standard Build system +## @copyright BSDv3 ############################################################################### - ############################################################################### ## Make sure that there are no spaces in the absolute path; the build system ## can't deal with them. diff --git a/core/warnings.mk b/core/warnings.mk index 144af38..f5d6988 100644 --- a/core/warnings.mk +++ b/core/warnings.mk @@ -1,10 +1,8 @@ ############################################################################### -## @file warnings.mk ## @author Edouard DUPIN ## @date 17-08-2012 -## @project EWOL -## -## Setup warning flags. +## @project standard Build system +## @copyright BSDv3 ############################################################################### COMMON_FLAGS_WARNINGS :=