2014-02-01 13:06:55 -05:00
|
|
|
-include mpconfigport.mk
|
2017-09-06 00:09:13 -04:00
|
|
|
include ../../py/mkenv.mk
|
2014-01-24 04:05:30 -05:00
|
|
|
|
2016-11-07 10:13:56 -05:00
|
|
|
FROZEN_DIR = scripts
|
2017-05-12 11:31:22 -04:00
|
|
|
FROZEN_MPY_DIR = modules
|
2016-11-07 10:13:56 -05:00
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# define main target
|
2014-01-19 19:02:39 -05:00
|
|
|
PROG = micropython
|
2014-01-07 09:54:15 -05:00
|
|
|
|
2014-01-21 16:40:13 -05:00
|
|
|
# qstr definitions (must come before including py.mk)
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
2014-06-20 12:25:54 -04:00
|
|
|
# OS name, for simple autoconfig
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# include py core make definitions
|
2017-08-10 22:22:19 -04:00
|
|
|
include $(TOP)/py/py.mk
|
2013-10-12 09:30:21 -04:00
|
|
|
|
2015-10-19 11:22:16 -04:00
|
|
|
INC += -I.
|
2017-08-10 22:22:19 -04:00
|
|
|
INC += -I$(TOP)
|
2014-04-17 13:03:27 -04:00
|
|
|
INC += -I$(BUILD)
|
2014-04-16 17:10:33 -04:00
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# compiler settings
|
2015-01-22 09:10:11 -05:00
|
|
|
CWARN = -Wall -Werror
|
2015-03-22 18:41:45 -04:00
|
|
|
CWARN += -Wpointer-arith -Wuninitialized
|
2017-03-05 07:28:27 -05:00
|
|
|
CFLAGS = $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
2014-02-14 17:37:37 -05:00
|
|
|
|
2014-06-20 12:19:06 -04:00
|
|
|
# Debugging/Optimization
|
|
|
|
ifdef DEBUG
|
|
|
|
CFLAGS += -g
|
|
|
|
COPT = -O0
|
|
|
|
else
|
2017-07-11 21:56:32 -04:00
|
|
|
COPT = -Os -fdata-sections -ffunction-sections -DNDEBUG
|
2016-01-26 12:46:40 -05:00
|
|
|
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
|
|
|
|
# security for detecting buffer overflows. Some distros (Ubuntu at the very least)
|
|
|
|
# have it enabled by default.
|
|
|
|
#
|
|
|
|
# gcc already optimizes some printf calls to call puts and/or putchar. When
|
|
|
|
# _FORTIFY_SOURCE is enabled and compiling with -O1 or greater, then some
|
|
|
|
# printf calls will also be optimized to call __printf_chk (in glibc). Any
|
|
|
|
# printfs which get redirected to __printf_chk are then no longer synchronized
|
|
|
|
# with printfs that go through mp_printf.
|
|
|
|
#
|
|
|
|
# In MicroPython, we don't want to use the runtime library's printf but rather
|
|
|
|
# go through mp_printf, so that stdout is properly tied into streams, etc.
|
|
|
|
# This means that we either need to turn off _FORTIFY_SOURCE or provide our
|
|
|
|
# own implementation of __printf_chk. We've chosen to turn off _FORTIFY_SOURCE.
|
|
|
|
# It should also be noted that the use of printf in MicroPython is typically
|
|
|
|
# quite limited anyways (primarily for debug and some error reporting, etc
|
|
|
|
# in the unix version).
|
|
|
|
#
|
|
|
|
# Information about _FORTIFY_SOURCE seems to be rather scarce. The best I could
|
|
|
|
# find was this: https://securityblog.redhat.com/2014/03/26/fortify-and-you/
|
|
|
|
# Original patchset was introduced by
|
|
|
|
# https://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html .
|
|
|
|
#
|
|
|
|
# Turning off _FORTIFY_SOURCE is only required when compiling with -O1 or greater
|
|
|
|
CFLAGS += -U _FORTIFY_SOURCE
|
2014-06-20 12:19:06 -04:00
|
|
|
endif
|
|
|
|
|
2014-09-23 09:42:18 -04:00
|
|
|
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
|
2017-06-30 03:22:17 -04:00
|
|
|
# The unix port of MicroPython on OSX must be compiled with clang,
|
2016-06-02 13:10:39 -04:00
|
|
|
# while cross-compile ports require gcc, so we test here for OSX and
|
2014-09-23 09:42:18 -04:00
|
|
|
# if necessary override the value of 'CC' set in py/mkenv.mk
|
2014-09-22 15:16:14 -04:00
|
|
|
ifeq ($(UNAME_S),Darwin)
|
2016-06-02 13:10:39 -04:00
|
|
|
ifeq ($(MICROPY_FORCE_32BIT),1)
|
|
|
|
CC = clang -m32
|
|
|
|
else
|
2014-09-22 15:16:14 -04:00
|
|
|
CC = clang
|
2016-06-02 13:10:39 -04:00
|
|
|
endif
|
2015-01-08 04:32:45 -05:00
|
|
|
# Use clang syntax for map file
|
2016-06-25 11:59:49 -04:00
|
|
|
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
|
2014-09-22 23:00:42 -04:00
|
|
|
else
|
2014-09-23 09:42:18 -04:00
|
|
|
# Use gcc syntax for map file
|
2016-06-25 11:59:49 -04:00
|
|
|
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
2014-09-22 15:16:14 -04:00
|
|
|
endif
|
2016-06-25 11:59:49 -04:00
|
|
|
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
2014-02-01 13:06:55 -05:00
|
|
|
|
2014-04-15 20:46:01 -04:00
|
|
|
ifeq ($(MICROPY_FORCE_32BIT),1)
|
2014-10-11 13:29:51 -04:00
|
|
|
# Note: you may need to install i386 versions of dependency packages,
|
|
|
|
# starting with linux-libc-dev:i386
|
2014-05-24 18:03:12 -04:00
|
|
|
ifeq ($(MICROPY_PY_FFI),1)
|
2014-04-15 20:46:01 -04:00
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
CFLAGS_MOD += -I/usr/include/i686-linux-gnu
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-02-27 11:10:40 -05:00
|
|
|
ifeq ($(MICROPY_USE_READLINE),1)
|
2017-08-10 22:22:19 -04:00
|
|
|
INC += -I$(TOP)/lib/mp-readline
|
2014-02-27 11:10:40 -05:00
|
|
|
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
|
2015-05-24 17:36:31 -04:00
|
|
|
LIB_SRC_C_EXTRA += mp-readline/readline.c
|
|
|
|
endif
|
2014-08-19 03:23:14 -04:00
|
|
|
ifeq ($(MICROPY_PY_TERMIOS),1)
|
|
|
|
CFLAGS_MOD += -DMICROPY_PY_TERMIOS=1
|
|
|
|
SRC_MOD += modtermios.c
|
|
|
|
endif
|
2015-01-11 12:28:27 -05:00
|
|
|
ifeq ($(MICROPY_PY_SOCKET),1)
|
|
|
|
CFLAGS_MOD += -DMICROPY_PY_SOCKET=1
|
|
|
|
SRC_MOD += modsocket.c
|
|
|
|
endif
|
2016-04-22 18:53:51 -04:00
|
|
|
ifeq ($(MICROPY_PY_THREAD),1)
|
2016-07-09 11:48:06 -04:00
|
|
|
CFLAGS_MOD += -DMICROPY_PY_THREAD=1 -DMICROPY_PY_THREAD_GIL=0
|
2016-04-22 18:53:51 -04:00
|
|
|
LDFLAGS_MOD += -lpthread
|
|
|
|
endif
|
2015-08-30 03:57:38 -04:00
|
|
|
|
2014-05-24 18:03:12 -04:00
|
|
|
ifeq ($(MICROPY_PY_FFI),1)
|
2015-08-30 03:57:38 -04:00
|
|
|
|
|
|
|
ifeq ($(MICROPY_STANDALONE),1)
|
2017-08-10 22:22:19 -04:00
|
|
|
LIBFFI_CFLAGS_MOD := -I$(shell ls -1d $(TOP)/lib/libffi/build_dir/out/lib/libffi-*/include)
|
2015-08-30 03:57:38 -04:00
|
|
|
ifeq ($(MICROPY_FORCE_32BIT),1)
|
2017-08-10 22:22:19 -04:00
|
|
|
LIBFFI_LDFLAGS_MOD = $(TOP)/lib/libffi/build_dir/out/lib32/libffi.a
|
2015-08-30 03:57:38 -04:00
|
|
|
else
|
2017-08-10 22:22:19 -04:00
|
|
|
LIBFFI_LDFLAGS_MOD = $(TOP)/lib/libffi/build_dir/out/lib/libffi.a
|
2015-08-30 03:57:38 -04:00
|
|
|
endif
|
|
|
|
else
|
2014-04-20 04:30:46 -04:00
|
|
|
LIBFFI_CFLAGS_MOD := $(shell pkg-config --cflags libffi)
|
2015-08-30 03:57:38 -04:00
|
|
|
LIBFFI_LDFLAGS_MOD := $(shell pkg-config --libs libffi)
|
|
|
|
endif
|
|
|
|
|
2014-06-07 03:16:42 -04:00
|
|
|
ifeq ($(UNAME_S),Linux)
|
2015-08-30 03:57:38 -04:00
|
|
|
LIBFFI_LDFLAGS_MOD += -ldl
|
2014-06-07 03:16:42 -04:00
|
|
|
endif
|
2015-08-30 03:57:38 -04:00
|
|
|
|
|
|
|
CFLAGS_MOD += $(LIBFFI_CFLAGS_MOD) -DMICROPY_PY_FFI=1
|
2014-06-07 03:16:42 -04:00
|
|
|
LDFLAGS_MOD += $(LIBFFI_LDFLAGS_MOD)
|
2014-04-04 13:32:26 -04:00
|
|
|
SRC_MOD += modffi.c
|
2014-02-01 13:06:55 -05:00
|
|
|
endif
|
|
|
|
|
2015-09-11 10:57:47 -04:00
|
|
|
ifeq ($(MICROPY_PY_JNI),1)
|
|
|
|
# Path for 64-bit OpenJDK, should be adjusted for other JDKs
|
|
|
|
CFLAGS_MOD += -I/usr/lib/jvm/java-7-openjdk-amd64/include -DMICROPY_PY_JNI=1
|
|
|
|
SRC_MOD += modjni.c
|
|
|
|
endif
|
2013-10-12 09:30:21 -04:00
|
|
|
|
2014-01-07 09:54:15 -05:00
|
|
|
# source files
|
2013-10-12 09:30:21 -04:00
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
2014-02-10 17:44:37 -05:00
|
|
|
gccollect.c \
|
2015-05-24 15:00:50 -04:00
|
|
|
unix_mphal.c \
|
2016-04-22 18:53:51 -04:00
|
|
|
mpthreadport.c \
|
2014-05-07 10:15:00 -04:00
|
|
|
input.c \
|
2014-01-07 19:52:20 -05:00
|
|
|
file.c \
|
2015-12-12 17:15:33 -05:00
|
|
|
modmachine.c \
|
2014-05-14 15:08:45 -04:00
|
|
|
modos.c \
|
2017-01-26 23:14:49 -05:00
|
|
|
moduos_vfs.c \
|
2016-06-17 16:35:00 -04:00
|
|
|
modtime.c \
|
2015-11-16 17:35:29 -05:00
|
|
|
moduselect.c \
|
2014-09-03 17:47:23 -04:00
|
|
|
alloc.c \
|
2015-05-07 19:19:56 -04:00
|
|
|
coverage.c \
|
2016-02-13 16:03:23 -05:00
|
|
|
fatfs_port.c \
|
2014-02-01 13:06:55 -05:00
|
|
|
$(SRC_MOD)
|
2013-10-12 09:30:21 -04:00
|
|
|
|
2015-05-24 17:36:31 -04:00
|
|
|
LIB_SRC_C = $(addprefix lib/,\
|
|
|
|
$(LIB_SRC_C_EXTRA) \
|
2016-06-15 17:03:24 -04:00
|
|
|
timeutils/timeutils.c \
|
|
|
|
)
|
|
|
|
|
2016-06-17 17:58:57 -04:00
|
|
|
# FatFS VFS support
|
2016-06-15 17:03:24 -04:00
|
|
|
LIB_SRC_C += $(addprefix lib/,\
|
2016-06-01 12:03:36 -04:00
|
|
|
oofatfs/ff.c \
|
|
|
|
oofatfs/option/unicode.c \
|
2015-05-24 17:36:31 -04:00
|
|
|
)
|
2014-09-22 15:16:14 -04:00
|
|
|
|
2015-05-24 17:36:31 -04:00
|
|
|
OBJ = $(PY_O)
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
2016-02-13 16:03:23 -05:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(STMHAL_SRC_C:.c=.o))
|
2013-10-12 09:30:21 -04:00
|
|
|
|
py: Add rules for automated extraction of qstrs from sources.
- add template rule that converts a specified source file into a qstring file
- add special rule for generating a central header that contains all
extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED
variable. Each platform appends a list of sources that may contain
qstrings into a new build variable: SRC_QSTR. Any autogenerated
prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable.
- remove most qstrings from py/qstrdefs, keep only qstrings that
contain special characters - these cannot be easily detected in the
sources without additional annotations
- remove most manual qstrdefs, use qstrdef autogen for: py, cc3200,
stmhal, teensy, unix, windows, pic16bit:
- remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.)
- remove all port specific qstrdefs except for special strings
- append sources for qstr generation in platform makefiles (SRC_QSTR)
2016-03-10 04:22:41 -05:00
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C) $(LIB_SRC_C)
|
|
|
|
# Append any auto-generated sources that are needed by sources listed in
|
|
|
|
# SRC_QSTR
|
|
|
|
SRC_QSTR_AUTO_DEPS +=
|
|
|
|
|
2016-05-16 18:17:11 -04:00
|
|
|
ifneq ($(FROZEN_MPY_DIR),)
|
|
|
|
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
|
|
|
|
# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).
|
|
|
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
|
|
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
|
|
|
CFLAGS += -DMPZ_DIG_SIZE=16 # force 16 bits to work on both 32 and 64 bit archs
|
2017-01-04 23:55:06 -05:00
|
|
|
MPY_CROSS_FLAGS += -mcache-lookup-bc
|
2016-05-16 18:17:11 -04:00
|
|
|
endif
|
|
|
|
|
py: Add rules for automated extraction of qstrs from sources.
- add template rule that converts a specified source file into a qstring file
- add special rule for generating a central header that contains all
extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED
variable. Each platform appends a list of sources that may contain
qstrings into a new build variable: SRC_QSTR. Any autogenerated
prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable.
- remove most qstrings from py/qstrdefs, keep only qstrings that
contain special characters - these cannot be easily detected in the
sources without additional annotations
- remove most manual qstrdefs, use qstrdef autogen for: py, cc3200,
stmhal, teensy, unix, windows, pic16bit:
- remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.)
- remove all port specific qstrdefs except for special strings
- append sources for qstr generation in platform makefiles (SRC_QSTR)
2016-03-10 04:22:41 -05:00
|
|
|
|
2017-08-10 22:22:19 -04:00
|
|
|
include $(TOP)/py/mkrules.mk
|
2013-12-29 13:01:01 -05:00
|
|
|
|
2014-04-16 15:38:16 -04:00
|
|
|
.PHONY: test
|
|
|
|
|
2017-08-10 22:22:19 -04:00
|
|
|
test: $(PROG) $(TOP)/tests/run-tests
|
2017-09-06 00:09:13 -04:00
|
|
|
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
|
2017-08-10 22:22:19 -04:00
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
|
2014-08-11 13:47:00 -04:00
|
|
|
|
|
|
|
# install micropython in /usr/local/bin
|
|
|
|
TARGET = micropython
|
|
|
|
PREFIX = $(DESTDIR)/usr/local
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
|
|
|
|
install: micropython
|
2016-04-15 19:04:21 -04:00
|
|
|
install -d $(BINDIR)
|
|
|
|
install $(TARGET) $(BINDIR)/$(TARGET)
|
2014-08-11 13:47:00 -04:00
|
|
|
|
|
|
|
# uninstall micropython
|
|
|
|
uninstall:
|
|
|
|
-rm $(BINDIR)/$(TARGET)
|
2014-11-01 10:01:21 -04:00
|
|
|
|
|
|
|
# build synthetically fast interpreter for benchmarking
|
|
|
|
fast:
|
2015-01-11 12:28:27 -05:00
|
|
|
$(MAKE) COPT="-O2 -DNDEBUG -fno-crossjumping" CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_fast.h>"' BUILD=build-fast PROG=micropython_fast
|
|
|
|
|
|
|
|
# build a minimal interpreter
|
|
|
|
minimal:
|
2016-07-02 17:10:58 -04:00
|
|
|
$(MAKE) COPT="-Os -DNDEBUG" CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' \
|
2017-05-26 04:12:30 -04:00
|
|
|
BUILD=build-minimal PROG=micropython_minimal FROZEN_DIR= FROZEN_MPY_DIR= \
|
2016-07-02 17:10:58 -04:00
|
|
|
MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_SOCKET=0 MICROPY_PY_THREAD=0 \
|
|
|
|
MICROPY_PY_TERMIOS=0 MICROPY_PY_USSL=0 \
|
2017-04-25 21:16:52 -04:00
|
|
|
MICROPY_USE_READLINE=0
|
2015-01-29 09:54:38 -05:00
|
|
|
|
2016-01-15 06:12:08 -05:00
|
|
|
# build interpreter with nan-boxing as object model
|
|
|
|
nanbox:
|
|
|
|
$(MAKE) \
|
|
|
|
CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_nanbox.h>"' \
|
|
|
|
BUILD=build-nanbox \
|
|
|
|
PROG=micropython_nanbox \
|
|
|
|
MICROPY_FORCE_32BIT=1 \
|
2016-05-25 18:42:46 -04:00
|
|
|
MICROPY_PY_USSL=0
|
2016-01-15 06:12:08 -05:00
|
|
|
|
2015-12-15 05:25:00 -05:00
|
|
|
freedos:
|
|
|
|
$(MAKE) \
|
|
|
|
CC=i586-pc-msdosdjgpp-gcc \
|
2016-04-02 18:52:09 -04:00
|
|
|
STRIP=i586-pc-msdosdjgpp-strip \
|
|
|
|
SIZE=i586-pc-msdosdjgpp-size \
|
2016-11-20 23:49:46 -05:00
|
|
|
CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_freedos.h>" -DMICROPY_NLR_SETJMP -Dtgamma=gamma -DMICROPY_EMIT_X86=0 -DMICROPY_NO_ALLOCA=1 -DMICROPY_PY_USELECT_POSIX=0' \
|
2015-12-15 05:25:00 -05:00
|
|
|
BUILD=build-freedos \
|
|
|
|
PROG=micropython_freedos \
|
|
|
|
MICROPY_PY_SOCKET=0 \
|
|
|
|
MICROPY_PY_FFI=0 \
|
2017-02-02 06:32:19 -05:00
|
|
|
MICROPY_PY_JNI=0 \
|
|
|
|
MICROPY_PY_BTREE=0 \
|
|
|
|
MICROPY_PY_THREAD=0 \
|
|
|
|
MICROPY_PY_USSL=0
|
2015-12-15 05:25:00 -05:00
|
|
|
|
2015-01-29 09:54:38 -05:00
|
|
|
# build an interpreter for coverage testing and do the testing
|
|
|
|
coverage:
|
2017-01-04 22:48:48 -05:00
|
|
|
$(MAKE) \
|
|
|
|
COPT="-O0" CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_coverage.h>" \
|
|
|
|
-fprofile-arcs -ftest-coverage \
|
|
|
|
-Wdouble-promotion -Wformat -Wmissing-declarations -Wmissing-prototypes -Wsign-compare \
|
|
|
|
-Wold-style-definition -Wpointer-arith -Wshadow -Wuninitialized -Wunused-parameter \
|
|
|
|
-DMICROPY_UNIX_COVERAGE' \
|
|
|
|
LDFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' \
|
2017-01-04 22:55:57 -05:00
|
|
|
FROZEN_DIR=coverage-frzstr FROZEN_MPY_DIR=coverage-frzmpy \
|
2017-01-04 22:48:48 -05:00
|
|
|
BUILD=build-coverage PROG=micropython_coverage
|
2015-03-01 08:37:27 -05:00
|
|
|
|
|
|
|
coverage_test: coverage
|
2017-09-06 00:09:13 -04:00
|
|
|
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
|
2017-08-10 22:22:19 -04:00
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests
|
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests -d thread
|
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --emit native
|
|
|
|
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --via-mpy -d basics float
|
|
|
|
gcov -o build-coverage/py $(TOP)/py/*.c
|
|
|
|
gcov -o build-coverage/extmod $(TOP)/extmod/*.c
|
2015-06-01 18:32:07 -04:00
|
|
|
|
2015-08-30 03:57:38 -04:00
|
|
|
# Value of configure's --host= option (required for cross-compilation).
|
2017-05-29 03:08:14 -04:00
|
|
|
# Deduce it from CROSS_COMPILE by default, but can be overridden.
|
2015-08-30 03:57:38 -04:00
|
|
|
ifneq ($(CROSS_COMPILE),)
|
|
|
|
CROSS_COMPILE_HOST = --host=$(patsubst %-,%,$(CROSS_COMPILE))
|
|
|
|
else
|
|
|
|
CROSS_COMPILE_HOST =
|
|
|
|
endif
|
|
|
|
|
2015-09-19 10:12:02 -04:00
|
|
|
deplibs: libffi axtls
|
2015-08-30 03:57:38 -04:00
|
|
|
|
2015-10-19 13:28:06 -04:00
|
|
|
# install-exec-recursive & install-data-am targets are used to avoid building
|
|
|
|
# docs and depending on makeinfo
|
2015-08-30 03:57:38 -04:00
|
|
|
libffi:
|
2017-08-10 22:22:19 -04:00
|
|
|
cd $(TOP)/lib/libffi; git clean -d -x -f
|
|
|
|
cd $(TOP)/lib/libffi; ./autogen.sh
|
|
|
|
mkdir -p $(TOP)/lib/libffi/build_dir; cd $(TOP)/lib/libffi/build_dir; \
|
2016-06-17 17:17:47 -04:00
|
|
|
../configure $(CROSS_COMPILE_HOST) --prefix=$$PWD/out --disable-structs CC="$(CC)" CXX="$(CXX)" LD="$(LD)" CFLAGS="-Os -fomit-frame-pointer -fstrict-aliasing -ffast-math -fno-exceptions"; \
|
2017-06-07 11:51:01 -04:00
|
|
|
$(MAKE) install-exec-recursive; $(MAKE) -C include install-data-am
|
2015-09-19 10:12:02 -04:00
|
|
|
|
2016-07-15 21:55:30 -04:00
|
|
|
axtls: $(BUILD)/libaxtls.a
|
|
|
|
|
2017-08-10 22:22:19 -04:00
|
|
|
$(BUILD)/libaxtls.a: $(TOP)/lib/axtls/README | $(OBJ_DIRS)
|
|
|
|
cd $(TOP)/lib/axtls; cp config/upyconfig config/.config
|
|
|
|
cd $(TOP)/lib/axtls; $(MAKE) oldconfig -B
|
|
|
|
cd $(TOP)/lib/axtls; $(MAKE) clean
|
|
|
|
cd $(TOP)/lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)"
|
|
|
|
cp $(TOP)/lib/axtls/_stage/libaxtls.a $@
|
2016-05-28 13:59:34 -04:00
|
|
|
|
2017-08-10 22:22:19 -04:00
|
|
|
$(TOP)/lib/axtls/README:
|
2016-05-28 13:59:34 -04:00
|
|
|
@echo "You cloned without --recursive, fetching submodules for you."
|
2017-08-10 22:22:19 -04:00
|
|
|
(cd $(TOP); git submodule update --init --recursive)
|