2014-01-24 04:05:30 -05:00
|
|
|
ifneq ($(lastword a b),b)
|
|
|
|
$(error These Makefiles require make 3.81 or newer)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Set TOP to be the path to get from the current directory (where make was
|
|
|
|
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
|
|
|
|
# the name of this makefile relative to where make was invoked.
|
|
|
|
#
|
|
|
|
# We assume that this file is in the py directory so we use $(dir ) twice
|
|
|
|
# to get to the top of the tree.
|
|
|
|
|
|
|
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
TOP := $(patsubst %/py/mkenv.mk,%,$(THIS_MAKEFILE))
|
|
|
|
|
|
|
|
# Turn on increased build verbosity by defining BUILD_VERBOSE in your main
|
|
|
|
# Makefile or in your environment. You can also use V=1 on the make command
|
|
|
|
# line.
|
|
|
|
|
|
|
|
ifeq ("$(origin V)", "command line")
|
|
|
|
BUILD_VERBOSE=$(V)
|
|
|
|
endif
|
|
|
|
ifndef BUILD_VERBOSE
|
|
|
|
BUILD_VERBOSE = 0
|
|
|
|
endif
|
|
|
|
ifeq ($(BUILD_VERBOSE),0)
|
|
|
|
Q = @
|
2017-02-24 09:59:59 -05:00
|
|
|
STEPECHO = @:
|
|
|
|
else ifeq ($(BUILD_VERBOSE),1)
|
|
|
|
Q = @
|
|
|
|
STEPECHO = @echo
|
2014-01-24 04:05:30 -05:00
|
|
|
else
|
|
|
|
Q =
|
2017-02-24 09:59:59 -05:00
|
|
|
STEPECHO = @echo
|
2014-01-24 04:05:30 -05:00
|
|
|
endif
|
|
|
|
# Since this is a new feature, advertise it
|
|
|
|
ifeq ($(BUILD_VERBOSE),0)
|
2017-02-24 09:59:59 -05:00
|
|
|
$(info Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.)
|
2014-01-24 04:05:30 -05:00
|
|
|
endif
|
|
|
|
|
2017-05-29 03:08:14 -04:00
|
|
|
# default settings; can be overridden in main Makefile
|
2014-01-24 04:05:30 -05:00
|
|
|
|
|
|
|
PY_SRC ?= $(TOP)/py
|
|
|
|
BUILD ?= build
|
|
|
|
|
|
|
|
ECHO = @echo
|
2017-08-23 14:05:59 -04:00
|
|
|
|
2021-04-22 20:55:39 -04:00
|
|
|
CAT = cat
|
2017-08-23 14:05:59 -04:00
|
|
|
CD = cd
|
2014-04-06 20:35:45 -04:00
|
|
|
CP = cp
|
2017-08-23 14:05:59 -04:00
|
|
|
FIND = find
|
2014-04-06 20:35:45 -04:00
|
|
|
MKDIR = mkdir
|
2016-04-21 17:25:35 -04:00
|
|
|
PYTHON = python
|
2018-08-09 18:58:45 -04:00
|
|
|
# Set default python interpreters
|
|
|
|
PYTHON2 ?= $(which python2 || which python2.7)
|
|
|
|
PYTHON3 ?= python3
|
2017-08-23 14:05:59 -04:00
|
|
|
RM = rm
|
|
|
|
RSYNC = rsync
|
|
|
|
SED = sed
|
2021-04-22 20:55:39 -04:00
|
|
|
TOUCH = touch
|
2020-10-20 10:37:24 -04:00
|
|
|
# Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform
|
2020-12-10 14:28:22 -05:00
|
|
|
NPROC = $(PYTHON3) -c 'import multiprocessing as mp; print(mp.cpu_count())'
|
2014-06-07 08:14:45 -04:00
|
|
|
|
|
|
|
AS = $(CROSS_COMPILE)as
|
|
|
|
CC = $(CROSS_COMPILE)gcc
|
2015-08-29 14:13:07 -04:00
|
|
|
CXX = $(CROSS_COMPILE)g++
|
2021-04-23 15:26:42 -04:00
|
|
|
GDB = $(CROSS_COMPILE)gdb
|
2014-06-07 08:14:45 -04:00
|
|
|
LD = $(CROSS_COMPILE)ld
|
|
|
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
|
|
|
SIZE = $(CROSS_COMPILE)size
|
|
|
|
STRIP = $(CROSS_COMPILE)strip
|
2015-10-12 07:42:05 -04:00
|
|
|
AR = $(CROSS_COMPILE)ar
|
2015-08-29 14:13:07 -04:00
|
|
|
ifeq ($(MICROPY_FORCE_32BIT),1)
|
|
|
|
CC += -m32
|
|
|
|
CXX += -m32
|
|
|
|
LD += -m32
|
|
|
|
endif
|
2014-01-24 04:05:30 -05:00
|
|
|
|
2020-12-10 14:28:22 -05:00
|
|
|
MAKE_FROZEN = $(PYTHON3) $(TOP)/tools/make-frozen.py
|
2017-05-19 01:53:55 -04:00
|
|
|
MPY_CROSS = $(TOP)/mpy-cross/mpy-cross
|
2018-10-18 13:37:42 -04:00
|
|
|
MPY_TOOL = $(PYTHON3) $(TOP)/tools/mpy-tool.py
|
2018-01-02 21:25:41 -05:00
|
|
|
PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py
|
2016-09-17 13:57:43 -04:00
|
|
|
|
2021-04-23 15:26:42 -04:00
|
|
|
MPY_LIB_DIR = $(TOP)/../micropython-lib
|
|
|
|
|
2014-01-24 04:05:30 -05:00
|
|
|
all:
|
|
|
|
.PHONY: all
|
|
|
|
|
2014-04-16 11:09:59 -04:00
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
|
2014-01-24 04:05:30 -05:00
|
|
|
MKENV_INCLUDED = 1
|