Prevent 0 in 'vbat_display_lpf_period' to avoid division by zero.
[betaflight.git] / make / linux.mk
blobba1744fcbd9421b9344635d806b43e0cb5ac82d1
1 # linux.mk
3 # Goals:
4 # Configure an environment that will allow Taulabs GCS and firmware to be built
5 # on a Linux system. The environment will support the current versions of Qt SDK
6 # and the ARM toolchain installed to either the Taulabs/tools directory, their
7 # respective default installation locations, or made available on the system path.
9 # Check for and find Python 2
11 # Get Python version, separate major/minor/patch, then put into wordlist
12 PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
13 # Get major version from aforementioned list
14 PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
15 # Just in case Make has some weird scope stuff
16 PYTHON=0
17 # If the major Python version is the one we want..
18 ifeq ($(PYTHON_MAJOR_VERSION_),2)
19 # Then we can just use the normal Python executable
20 PYTHON:=python
21 else
22 # However, this isn't always the case..
23 # Let's look for `python2`. If `which` doesn't return a null value, then
24 # it exists!
25 ifneq ($(shell which python2), "")
26 PYTHON:=python2
27 else
28 # And if it doesn't exist, let's use the default Python, and warn the user.
29 # PYTHON NOT FOUND.
30 PYTHON:=python
31 echo "Python not found."
32 endif
33 endif
35 export PYTHON