Commit 4905381c authored by Terry Ellison's avatar Terry Ellison
Browse files

Resolve merge conflict on docs/index.md

parents 11592951 3f5ae99e
#
# This Make file is called from the core Makefile hierarchy with is a hierarchical
# make wwhich uses parent callbacks to implement inheritance. However is luac_cross
# build stands outside this and uses the host toolchain to implement a separate
# This Makefile is called from the core Makefile hierarchy which is a hierarchical
# make which uses parent callbacks to implement inheritance. However if luac_cross
# build stands outside this, it uses the host toolchain to implement a separate
# host build of the luac.cross image.
#
.NOTPARALLEL:
summary ?= @true
CCFLAGS:= -I.. -I../../include -I../../libc -I../../uzlib
LDFLAGS:= -L$(SDK_DIR)/lib -L$(SDK_DIR)/ld -lm -ldl -Wl,-Map=mapfile
......@@ -52,13 +54,19 @@ CC := $(WRAPCC) gcc
ECHO := echo
BUILD_TYPE := $(shell $(CC) $(EXTRA_CCFLAGS) -E -dM - <../../../app/include/user_config.h | grep LUA_NUMBER_INTEGRAL | wc -l)
ifeq ($(BUILD_TYPE),0)
IMAGE := ../../../luac.cross
else
IMAGE := ../../../luac.cross.int
endif
.PHONY: test clean all
all: $(DEPS) $(IMAGE)
$(IMAGE) : $(OBJS)
$(summary) HOSTLD $@
$(CC) $(OBJS) -o $@ $(LDFLAGS)
test :
......@@ -66,6 +74,7 @@ test :
@echo SRC: $(SRC)
@echo OBJS: $(OBJS)
@echo DEPS: $(DEPS)
@echo IMAGE: $(IMAGE)
clean :
$(RM) -r $(ODIR)
......@@ -76,11 +85,12 @@ endif
$(ODIR)/%.o: %.c
@mkdir -p $(ODIR);
$(summary) HOSTCC $(CURDIR)/$<
$(CC) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<
$(ODIR)/%.d: %.c
@mkdir -p $(ODIR);
@echo DEPEND: $(CC) -M $(CFLAGS) $<
$(summary) DEPEND: HOSTCC $(CURDIR)/$<
@set -e; rm -f $@; \
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\.o\)[ :]*,$(ODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
......
......@@ -112,7 +112,11 @@ static uint *flashAddrTag = flashImage + LUA_MAX_FLASH_SIZE;
#define getFlashAddrTag(v) ((flashAddrTag[_TW(v)]&_TB(v)) != 0)
#define fatal luac_fatal
#ifdef _MSC_VER
extern void __declspec( noreturn ) luac_fatal( const char* message );
#else
extern void __attribute__((noreturn)) luac_fatal(const char* message);
#endif
#ifdef LOCAL_DEBUG
#define DBG_PRINT(...) printf(__VA_ARGS__)
......
......@@ -168,6 +168,7 @@ static TString *corename(lua_State *L, const TString *filename)
{
const char *fn = getstr(filename)+1;
const char *s = strrchr(fn, '/');
if (!s) s = strrchr(fn, '\\');
s = s ? s + 1 : fn;
while (*s == '.') s++;
const char *e = strchr(s, '.');
......@@ -272,6 +273,9 @@ struct Smain {
char** argv;
};
#if defined(_MSC_VER) || defined(__MINGW32__)
typedef unsigned int uint;
#endif
extern uint dumpToFlashImage (lua_State* L,const Proto *main, lua_Writer w,
void* data, int strip,
lu_int32 address, lu_int32 maxSize);
......
#
# This is a minimal Make file designed to be called from within a MinGW Cmd prompt.
# So if the distro ZIP file has been unpacked into C:\nodemcu-firmware then
#
# C:\nodemcu-firmware\app\lua\luac_cross> mingw32-make -f mingw32-makefile.mak
#
# will create the WinX EXE luac.cross.exe within the root C:\nodemcu-firmware folder.
# This make has been stripped down to use the basic non-graphics MinGW32 install and
# standard Windows commands available at the Cmd> prompt. This make is quite separate
# from the normal toolchain build.
.NOTPARALLEL:
CCFLAGS:= -I.. -I../../include -I../../libc -I../../uzlib -Wall
LDFLAGS:= -lm -Wl,-Map=mapfile
DEFINES += -DLUA_CROSS_COMPILER -DLUA_OPTIMIZE_MEMORY=2
CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
TARGET = host
CC := gcc
ifeq ($(FLAVOR),debug)
CCFLAGS += -O0 -g
TARGET_LDFLAGS += -O0 -g
DEFINES += -DLUA_DEBUG_BUILD
else
FLAVOR = release
CCFLAGS += -O2
TARGET_LDFLAGS += -O2
endif
#
# C files needed to compile luac.cross
#
LUACSRC := luac.c lflashimg.c liolib.c loslib.c print.c
LUASRC := lapi.c lauxlib.c lbaselib.c lcode.c ldblib.c ldebug.c \
ldo.c ldump.c lfunc.c lgc.c linit.c llex.c \
lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c lparser.c \
lrotable.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c \
ltm.c lundump.c lvm.c lzio.c
LIBCSRC := c_stdlib.c
UZSRC := uzlib_deflate.c crc32.c
#
# This relies on the files being unique on the vpath
#
SRC := $(LUACSRC) $(LUASRC) $(LIBCSRC) $(UZSRC)
vpath %.c .:..:../../libc:../../uzlib
INCS := -I.. -I../.. -I../../libc -I../../uzlib
ODIR := .output\obj
OBJS := $(SRC:%.c=$(ODIR)/%.o)
IMAGE := ../../../luac.cross.exe
.PHONY: test clean all
all: $(DEPS) $(IMAGE)
$(IMAGE) : $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
test :
@echo CC: $(CC)
@echo SRC: $(SRC)
@echo OBJS: $(OBJS)
clean :
del /s /q $(ODIR)
$(ODIR)/%.o: %.c
@mkdir $(ODIR) || echo .
$(CC) $(INCS) $(CFLAGS) -o $@ -c $<
......@@ -39,7 +39,7 @@
#endif
#if defined(LUA_CROSS_COMPILER)
#if defined(LUA_CROSS_COMPILER) && !defined(_MSC_VER) && !defined(__MINGW32__)
#define LUA_USE_LINUX
#endif
......@@ -264,7 +264,7 @@
#include <io.h>
#ifdef LUA_CROSS_COMPILER
#include <stdio.h>
else
#else
#include "c_stdio.h"
#endif
......@@ -631,7 +631,11 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
#define lua_str2number(s,p) c_strtoll((s), (p), 10)
#endif // #if !defined LUA_INTEGRAL_LONGLONG
#else
#ifdef _MSC_VER //what's wrong with stdlib strtod?
#define lua_str2number(s,p) strtod((s), (p))
#else
#define lua_str2number(s,p) c_strtod((s), (p))
#endif
#endif // #if defined LUA_NUMBER_INTEGRAL
/*
......@@ -717,8 +721,18 @@ union luai_Cast { double l_d; long l_l; };
/* this option always works, but may be slow */
#else
#define lua_number2int(i,d) ((i)=(int)(d))
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
#ifdef LUA_NUMBER_INTEGRAL
#define lua_number2int(i, d) ((i) = (int)(d))
#define lua_number2integer(i, d) ((i) = (lua_Integer)(d))
#else // for floating-point builds, cast to a larger integer first to avoid undefined behavior on overflows.
#define lua_number2int(i, d) ((i) = (int)(long long)(d))
#define lua_number2integer(i, d) ((i) = (lua_Integer)(long long)(d))
#endif // LUA_NUMBER_INTEGRAL
#endif
......@@ -750,18 +764,18 @@ union luai_Cast { double l_d; long l_l; };
{ if ((c)->status == 0) (c)->status = -1; }
#define luai_jmpbuf int /* dummy variable */
#elif defined(LUA_USE_ULONGJMP)
#else
#if defined(LUA_USE_ULONGJMP)
/* in Unix, try _longjmp/_setjmp (more efficient) */
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf
#define LONGJMP(a,b) _longjmp(a,b)
#define SETJMP(a) _setjmp(a)
#else
/* default handling with long jumps */
#define LUAI_THROW(L,c) longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
#define LONGJMP(a,b) longjmp(a,b)
#define SETJMP(a) setjmp(a)
#endif
#define LUAI_THROW(L,c) LONGJMP((c)->b, 1)
#define LUAI_TRY(L,c,a) if (SETJMP((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment