mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Makefile: export important make variables from the top Makefile
This commit is contained in:
parent
23c605ffba
commit
60a7d7e454
84
Makefile
84
Makefile
@ -17,14 +17,21 @@
|
|||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# This top level Makefile passes down some variables to sub-makes through
|
||||||
|
# the environment. They are explicitly exported using the export keyword.
|
||||||
|
# Lower level makefiles assume that these variables are defined. To ensure
|
||||||
|
# that a special magic variable is exported here. It must be checked for
|
||||||
|
# existance by each sub-make.
|
||||||
|
export OPENPILOT_IS_COOL := Fuck Yeah!
|
||||||
|
|
||||||
# Set up a default goal
|
# Set up a default goal
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
# Set up some macros for common directories within the tree
|
# Set up some macros for common directories within the tree
|
||||||
ROOT_DIR := $(CURDIR)
|
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||||
TOOLS_DIR := $(ROOT_DIR)/tools
|
export TOOLS_DIR := $(ROOT_DIR)/tools
|
||||||
BUILD_DIR := $(ROOT_DIR)/build
|
export BUILD_DIR := $(ROOT_DIR)/build
|
||||||
DL_DIR := $(ROOT_DIR)/downloads
|
export DL_DIR := $(ROOT_DIR)/downloads
|
||||||
|
|
||||||
# Set up default build configurations (debug | release)
|
# Set up default build configurations (debug | release)
|
||||||
UAVOGEN_BUILD_CONF ?= debug
|
UAVOGEN_BUILD_CONF ?= debug
|
||||||
@ -56,7 +63,7 @@ $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowe
|
|||||||
SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER
|
SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER
|
||||||
$(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
|
$(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
|
||||||
|
|
||||||
# Make sure this isn't being run as root
|
# Make sure this isn't being run as root (no whoami on Windows, but that is ok here)
|
||||||
ifeq ($(shell whoami 2>/dev/null),root)
|
ifeq ($(shell whoami 2>/dev/null),root)
|
||||||
$(error You should not be running this as root)
|
$(error You should not be running this as root)
|
||||||
endif
|
endif
|
||||||
@ -72,20 +79,6 @@ else ifeq ($(V), 0)
|
|||||||
else ifeq ($(V), 1)
|
else ifeq ($(V), 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Set up misc host tools, maybe useful on Windows
|
|
||||||
ECHO := echo
|
|
||||||
MKDIR := mkdir
|
|
||||||
RM := rm
|
|
||||||
LN := ln
|
|
||||||
SED := sed
|
|
||||||
TAR := tar
|
|
||||||
ANT := ant
|
|
||||||
JAVAC := javac
|
|
||||||
JAR := jar
|
|
||||||
GIT := git
|
|
||||||
PYTHON := python
|
|
||||||
INSTALL := install
|
|
||||||
|
|
||||||
# Make sure we know few things about the architecture before including
|
# Make sure we know few things about the architecture before including
|
||||||
# the tools.mk to ensure that we download/install the right tools.
|
# the tools.mk to ensure that we download/install the right tools.
|
||||||
UNAME := $(shell uname)
|
UNAME := $(shell uname)
|
||||||
@ -95,6 +88,32 @@ ifeq ($(filter Linux Darwin, $(UNAME)), )
|
|||||||
UNAME := Windows
|
UNAME := Windows
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Set up misc host tools
|
||||||
|
export ECHO := echo
|
||||||
|
export MKDIR := mkdir
|
||||||
|
export RM := rm
|
||||||
|
export LN := ln
|
||||||
|
export CAT := cat
|
||||||
|
export SED := sed
|
||||||
|
export TAR := tar
|
||||||
|
export ANT := ant
|
||||||
|
export JAVAC := javac
|
||||||
|
export JAR := jar
|
||||||
|
export GIT := git
|
||||||
|
export PYTHON := python
|
||||||
|
export INSTALL := install
|
||||||
|
|
||||||
|
# version-info cmd to extract some repository data
|
||||||
|
export VERSION_INFO := $(PYTHON) "$(ROOT_DIR)/make/scripts/version-info.py" --path="$(ROOT_DIR)"
|
||||||
|
|
||||||
|
# Test if quotes are needed for the echo-command
|
||||||
|
ifeq (${shell $(ECHO) "test"}, test)
|
||||||
|
export QUOTE := '
|
||||||
|
# This line is just to clear out the single quote above '
|
||||||
|
else
|
||||||
|
export QUOTE :=
|
||||||
|
endif
|
||||||
|
|
||||||
# The tools.mk uses wget to fetch tarballs or packages
|
# The tools.mk uses wget to fetch tarballs or packages
|
||||||
ifeq ($(shell [ -x "$(TOOLS_DIR)/bin/wget" ] && $(ECHO) "exists"), exists)
|
ifeq ($(shell [ -x "$(TOOLS_DIR)/bin/wget" ] && $(ECHO) "exists"), exists)
|
||||||
WGET := $(TOOLS_DIR)/bin/wget
|
WGET := $(TOOLS_DIR)/bin/wget
|
||||||
@ -115,17 +134,17 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
||||||
ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi-
|
export ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi-
|
||||||
else
|
else
|
||||||
# not installed, hope it's in the path...
|
# not installed, hope it's in the path...
|
||||||
ARM_SDK_PREFIX ?= arm-none-eabi-
|
export ARM_SDK_PREFIX ?= arm-none-eabi-
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists)
|
ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists)
|
||||||
OPENOCD := $(OPENOCD_DIR)/bin/openocd
|
export OPENOCD := $(OPENOCD_DIR)/bin/openocd
|
||||||
else
|
else
|
||||||
# not installed, hope it's in the path...
|
# not installed, hope it's in the path...
|
||||||
OPENOCD ?= openocd
|
export OPENOCD ?= openocd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
||||||
@ -149,9 +168,6 @@ else
|
|||||||
UAVOBJGENERATOR = "$(BUILD_DIR)/ground/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe"
|
UAVOBJGENERATOR = "$(BUILD_DIR)/ground/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# version-info cmd to extract some repository data
|
|
||||||
VERSION_INFO := $(PYTHON) $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)"
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
# All targets
|
# All targets
|
||||||
@ -411,14 +427,14 @@ uavo-collections_clean:
|
|||||||
|
|
||||||
# Define some pointers to the various important pieces of the flight code
|
# Define some pointers to the various important pieces of the flight code
|
||||||
# to prevent these being repeated in every sub makefile
|
# to prevent these being repeated in every sub makefile
|
||||||
PIOS := $(ROOT_DIR)/flight/PiOS
|
export PIOS := $(ROOT_DIR)/flight/PiOS
|
||||||
FLIGHTLIB := $(ROOT_DIR)/flight/Libraries
|
export FLIGHTLIB := $(ROOT_DIR)/flight/Libraries
|
||||||
OPMODULEDIR := $(ROOT_DIR)/flight/Modules
|
export OPMODULEDIR := $(ROOT_DIR)/flight/Modules
|
||||||
OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects
|
export OPUAVOBJ := $(ROOT_DIR)/flight/targets/UAVObjects
|
||||||
OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk
|
export OPUAVTALK := $(ROOT_DIR)/flight/targets/UAVTalk
|
||||||
HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs
|
export HWDEFS := $(ROOT_DIR)/flight/targets/board_hw_defs
|
||||||
DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen
|
export DOXYGENDIR := $(ROOT_DIR)/flight/Doc/Doxygen
|
||||||
OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
||||||
|
|
||||||
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
||||||
# $(2) = Name of board used in source tree (e.g. CopterControl)
|
# $(2) = Name of board used in source tree (e.g. CopterControl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user