diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-07-11 10:54:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-11 10:54:52 -0700 |
| commit | 1c92c3317b725bf1ee4a5057c3c4e94f5e0944cb (patch) | |
| tree | 8b9d622634e582fc95f84515c2de975583e807fd | |
| parent | 4962468ffffac9ec4e36b2b1fc3f132516df3127 (diff) | |
| parent | d305e7d6cfea2e336784d756997e4da725041f83 (diff) | |
Merge pull request #1013 from dhalbert/static-mpy-cross-build
Add STATIC_BUILD make flag for mpy-cross to build a static executable
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | mpy-cross/Makefile | 17 | ||||
| -rw-r--r-- | mpy-cross/mpconfigport.h | 44 |
3 files changed, 65 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index aa4ff6dab..4f4c91d82 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,8 @@ TAGS ################# *.orig +# Emacs backup files +#################### +*~ + *.DS_Store diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index 53ce50c7f..c9b6cca0f 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -14,7 +14,13 @@ endif include ../py/mkenv.mk # define main target + +ifeq ($(OS),Windows_NT) +# Detect a MINGW32 build, and change the name of the final executable. +PROG = mpy-cross.exe +else PROG = mpy-cross +endif # qstr definitions (must come before including py.mk) QSTR_DEFS = qstrdefsport.h @@ -35,6 +41,13 @@ CWARN += -Wpointer-arith -Wuninitialized CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA) CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables +# Build a static executable. +# Useful for Windows builds, etc., that must run on multiple operating system versions. +ifdef STATIC_BUILD +CFLAGS += -static -static-libgcc -static-libstdc++ +endif + + # Debugging/Optimization ifdef DEBUG CFLAGS += -g @@ -57,6 +70,10 @@ LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections endif LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) +ifdef STATIC_BUILD +LDFLAGS += -static -static-libgcc -static-libstdc++ +endif + # source files SRC_C = \ main.c \ diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index e227d1be5..04f9a24d5 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -85,6 +85,50 @@ #define MICROPY_PY_IO (0) #define MICROPY_PY_SYS (0) +// MINGW only handles these errno names. +#ifdef __MINGW32__ +#define MICROPY_PY_UERRNO_LIST \ + X(EPERM) \ + X(ENOENT) \ + X(ESRCH) \ + X(EINTR) \ + X(EIO) \ + X(ENXIO) \ + X(E2BIG) \ + X(ENOEXEC) \ + X(EBADF) \ + X(ECHILD) \ + X(EAGAIN) \ + X(ENOMEM) \ + X(EACCES) \ + X(EFAULT) \ + X(EBUSY) \ + X(EEXIST) \ + X(EXDEV) \ + X(ENODEV) \ + X(ENOTDIR) \ + X(EISDIR) \ + X(EINVAL) \ + X(ENFILE) \ + X(EMFILE) \ + X(ENOTTY) \ + X(EFBIG) \ + X(ENOSPC) \ + X(ESPIPE) \ + X(EROFS) \ + X(EMLINK) \ + X(EPIPE) \ + X(EDOM) \ + X(ERANGE) \ + X(EDEADLOCK) \ + X(EDEADLK) \ + X(ENAMETOOLONG) \ + X(ENOLCK) \ + X(ENOSYS) \ + X(ENOTEMPTY) \ + X(EILSEQ) +#endif + // type definitions for the specific machine #ifdef __LP64__ |
