From c39f11e50e2a41a7458ed35c2275f321ad2e8cb2 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Tue, 6 Sep 2016 10:17:56 +0200 Subject: [PATCH] build: Add install feature for downstream Bug: https://jira.iotivity.org/browse/IOT-524 Change-Id: Ice8f4de89ffdaad5a83aa80ca266edc836fbf6a0 Signed-off-by: Philippe Coval --- Makefile | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b58a07f --- /dev/null +++ b/Makefile @@ -0,0 +1,186 @@ +#!/usr/bin/make -f +name?=iotivity + +default/%: + @echo "# $@ ignored" + + +default: all + +# Overide variables +host_arch?=$(shell uname -m || echo "default") +OSTYPE?=$(shell echo "$${OSTYPE}") +uname?=$(shell echo `uname -s` || echo "") + +TARGET_OS?=${uname} +ifeq ("",${TARGET_OS}) +TARGET_OS=${OSTYPE} +endif + +ifeq ("linux-gnu","${TARGET_OS}") +TARGET_OS=linux +endif +ifeq ("Linux","${TARGET_OS}") +TARGET_OS=linux +endif +ifeq ("",${TARGET_OS}) +TARGET_OS=default +endif + +ifeq ("i386","${host_arch}") +TARGET_ARCH?=x86 +else +ifeq ("i486","${host_arch}") +TARGET_ARCH?=x86 +else +ifeq ("i586","${host_arch}") +TARGET_ARCH?=x86 +else +ifeq ("i686","${host_arch}") +TARGET_ARCH?=x86 +else +ifeq ("armel","${host_arch}") +TARGET_ARCH?=arm +else +ifeq ("armhf","${host_arch}") +TARGET_ARCH?=arm +endif +ifeq ("aarch64","${host_arch}") +TARGET_ARCH?=arm64 +endif +ifeq ("armv7l","${host_arch}") +TARGET_ARCH?=arm +endif +endif +endif +endif +endif +endif + + + +# Default variables to override: +#release_mode?=0 +#secure_mode?=0 +#logging_mode?=True + +TARGET_ARCH?=${host_arch} +TARGET_OS?=${uname} +TARGET_TRANSPORT?=IP +_includedir?=/usr/include +_libdir?=/usr/lib +_sbindir?=/usr/sbin +buildroot?=${DESTDIR} + +ifeq (0,${release_mode}) +build_dir?=debug +debug_mode?=1 +else +build_dir?=release +release_mode?=1 +debug_mode?=0 +endif + + +config_build?=VERBOSE=1 V=1 +config_build+=DEBUG=${debug_mode} RELEASE=${release_mode} +config_build+=TARGET_ARCH=${TARGET_ARCH} +config_build+=TARGET_OS=${TARGET_OS} + +# Overide default config if defined +ifneq ("","${logging_mode}") +config_build+=LOGGING=${logging_mode} +endif + +ifneq ("","${secure_mode}") +config_build+=SECURED=${secure_mode} +endif + +# Default variables to override: +#config_build+=TARGET_TRANSPORT=IP +#config_build+=WITH_TCP=1 + + +all: build + +build: SConstruct + scons ${config_build} + + +check: auto_build.sh + ${