mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
ed4411602c
- Remove file related functions from loader. * All packages must be builtin. - Remove os.tmpname. - Interface with TLSF. - Don't abort() when out of memory.
359 lines
11 KiB
Diff
359 lines
11 KiB
Diff
From 1cfceae0d4d4ead217af7b66ed24b3909eb22dd2 Mon Sep 17 00:00:00 2001
|
|
From: Juan Carrano <j.carrano@fu-berlin.de>
|
|
Date: Mon, 14 May 2018 15:31:09 +0200
|
|
Subject: [PATCH 7/8] Add a proper makefile.
|
|
|
|
The new makefile has automatic dependencies, can buid a debug an
|
|
a non debug version simultaneously and is way cleaner.
|
|
---
|
|
.gitignore | 7 ++
|
|
Makefile | 116 +++++++++++++++++++++++++++++++
|
|
makefile | 198 -----------------------------------------------------
|
|
3 files changed, 123 insertions(+), 198 deletions(-)
|
|
create mode 100644 .gitignore
|
|
create mode 100644 Makefile
|
|
delete mode 100644 makefile
|
|
|
|
diff --git a/.gitignore b/.gitignore
|
|
new file mode 100644
|
|
index 00000000..08e46c95
|
|
--- /dev/null
|
|
+++ b/.gitignore
|
|
@@ -0,0 +1,7 @@
|
|
+*.o
|
|
+*.gch
|
|
+*.d
|
|
+*.a
|
|
+lua
|
|
+lua-dbg
|
|
+*.patch
|
|
diff --git a/Makefile b/Makefile
|
|
new file mode 100644
|
|
index 00000000..2735db8d
|
|
--- /dev/null
|
|
+++ b/Makefile
|
|
@@ -0,0 +1,116 @@
|
|
+
|
|
+RM= rm -f
|
|
+LD=CC
|
|
+ARFLAGS = rcs
|
|
+
|
|
+CWARNS= \
|
|
+ -Wall \
|
|
+ -pedantic \
|
|
+ -Wextra \
|
|
+ -Wshadow \
|
|
+ -Wsign-compare \
|
|
+ -Wundef \
|
|
+ -Wwrite-strings \
|
|
+ -Wredundant-decls \
|
|
+ -Wdisabled-optimization \
|
|
+ -Waggregate-return \
|
|
+ -Wdouble-promotion \
|
|
+ -Wdeclaration-after-statement \
|
|
+ -Wmissing-prototypes \
|
|
+ -Wnested-externs \
|
|
+ -Wstrict-prototypes \
|
|
+ -Wc++-compat \
|
|
+ -Wold-style-definition
|
|
+ #-Wno-aggressive-loop-optimizations # not accepted by clang \
|
|
+ #-Wlogical-op # not accepted by clang \
|
|
+ # the next warnings generate too much noise, so they are disabled
|
|
+ # -Wconversion -Wno-sign-conversion \
|
|
+ # -Wsign-conversion \
|
|
+ # -Wconversion \
|
|
+ # -Wstrict-overflow=2 \
|
|
+ # -Wformat=2 \
|
|
+ # -Wcast-qual \
|
|
+
|
|
+# -DEXTERNMEMCHECK -DHARDSTACKTESTS -DHARDMEMTESTS -DTRACEMEM='"tempmem"'
|
|
+# -g -DLUA_USER_H='"ltests.h"'
|
|
+# -pg -malign-double
|
|
+# -DLUA_USE_CTYPE -DLUA_USE_APICHECK
|
|
+# (in clang, '-ftrapv' for runtime checks of integer overflows)
|
|
+# -fsanitize=undefined -ftrapv
|
|
+TESTFLAGS= -DDEBUG_OVERRIDE_SIZES
|
|
+
|
|
+OFLAGS?=-O2
|
|
+CFLAGS?= -std=c99 $(OFLAGS) $(CWARNS)
|
|
+DEPFLAGS= -MM -MP -MQ $@ -MQ $*.o -MQ $*-dbg.o
|
|
+LIBS?= -lm -ldl -lreadline
|
|
+LDFLAGS?=$(LIBS)
|
|
+
|
|
+ifeq ($(LUA_32BITS),true)
|
|
+CFLAGS+= -DLUA_32BITS
|
|
+endif
|
|
+
|
|
+# rwildcard
|
|
+# Use this function to recursively search for all files with a certain
|
|
+# extension
|
|
+rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
|
|
+
|
|
+ALL_C_FILES=$(call rwildcard,,*.c)
|
|
+C_FILES=$(filter-out lua.c,$(ALL_C_FILES))
|
|
+D_FILES=$(call rwildcard,,*.d)
|
|
+O_FILES=$(call rwildcard,,*.o)
|
|
+GCH_FILES=$(call rwildcard,,*.gch)
|
|
+
|
|
+NEEDED_OBJECTS=$(C_FILES:.c=.o)
|
|
+DBG_OBJECTS=$(C_FILES:.c=-dbg.o)
|
|
+
|
|
+all: lua liblua.a lua-dbg liblua-dbg.a
|
|
+
|
|
+# --------------------------- cleaning -------------------------------------- #
|
|
+
|
|
+.PHONY: clean
|
|
+clean: $(foreach f,$(O_FILES),$(f)-clean) \
|
|
+ $(foreach f,$(GCH_FILES),$(f)-clean) \
|
|
+ liblua.a-clean lua-clean liblua-dbg.a-clean lua-dbg-clean
|
|
+
|
|
+PHONY: depclean
|
|
+depclean: $(foreach dfile,$(D_FILES),$(dfile)-clean)
|
|
+
|
|
+.PHONY: allclean
|
|
+allclean: clean depclean
|
|
+
|
|
+%-clean:
|
|
+ $(RM) $*
|
|
+
|
|
+# ----------------------------- DEPENDENCIES --------------------------------- #
|
|
+
|
|
+# If we are only cleaning then ignore the dependencies
|
|
+ifneq ($(MAKECMDGOALS),depclean)
|
|
+ifneq ($(MAKECMDGOALS),clean)
|
|
+ifneq ($(MAKECMDGOALS),allclean)
|
|
+-include $(C_FILES:.c=.d)
|
|
+endif
|
|
+endif
|
|
+endif
|
|
+
|
|
+%.d: %.c
|
|
+ $(CC) $(CFLAGS) $(DEPFLAGS) $< >$@
|
|
+
|
|
+# --------------------------- Output targets --------------------------------- #
|
|
+
|
|
+liblua.a: $(NEEDED_OBJECTS)
|
|
+
|
|
+liblua-dbg.a: $(DBG_OBJECTS)
|
|
+
|
|
+lua: lua.o liblua.a
|
|
+
|
|
+lua-dbg: lua-dbg.o liblua-dbg.a
|
|
+
|
|
+# --------------------------- Implicit rules --------------------------------- #
|
|
+
|
|
+%.a:
|
|
+ @echo $(MSG_ARCHIVING)
|
|
+ $(AR) $(ARFLAGS) $@ $^
|
|
+
|
|
+%-dbg.o: %.c
|
|
+ # Override optimization options
|
|
+ $(CC) $(CFLAGS) -O0 -g -dA -DLUA_DEBUG -DDEBUG_OVERRIDE_SIZES -c $< -o $@
|
|
diff --git a/makefile b/makefile
|
|
deleted file mode 100644
|
|
index 8160d4fb..00000000
|
|
--- a/makefile
|
|
+++ /dev/null
|
|
@@ -1,198 +0,0 @@
|
|
-# makefile for building Lua
|
|
-# see INSTALL for installation instructions
|
|
-# see ../Makefile and luaconf.h for further customization
|
|
-
|
|
-# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
|
|
-
|
|
-# Warnings valid for both C and C++
|
|
-CWARNSCPP= \
|
|
- -pedantic \
|
|
- -Wextra \
|
|
- -Wshadow \
|
|
- -Wsign-compare \
|
|
- -Wundef \
|
|
- -Wwrite-strings \
|
|
- -Wredundant-decls \
|
|
- -Wdisabled-optimization \
|
|
- -Waggregate-return \
|
|
- -Wdouble-promotion \
|
|
- #-Wno-aggressive-loop-optimizations # not accepted by clang \
|
|
- #-Wlogical-op # not accepted by clang \
|
|
- # the next warnings generate too much noise, so they are disabled
|
|
- # -Wconversion -Wno-sign-conversion \
|
|
- # -Wsign-conversion \
|
|
- # -Wconversion \
|
|
- # -Wstrict-overflow=2 \
|
|
- # -Wformat=2 \
|
|
- # -Wcast-qual \
|
|
-
|
|
-# The next warnings are neither valid nor needed for C++
|
|
-CWARNSC= -Wdeclaration-after-statement \
|
|
- -Wmissing-prototypes \
|
|
- -Wnested-externs \
|
|
- -Wstrict-prototypes \
|
|
- -Wc++-compat \
|
|
- -Wold-style-definition \
|
|
-
|
|
-
|
|
-CWARNS= $(CWARNSCPP) $(CWARNSC)
|
|
-
|
|
-
|
|
-# -DEXTERNMEMCHECK -DHARDSTACKTESTS -DHARDMEMTESTS -DTRACEMEM='"tempmem"'
|
|
-# -g -DLUA_USER_H='"ltests.h"'
|
|
-# -pg -malign-double
|
|
-# -DLUA_USE_CTYPE -DLUA_USE_APICHECK
|
|
-# (in clang, '-ftrapv' for runtime checks of integer overflows)
|
|
-# -fsanitize=undefined -ftrapv
|
|
-TESTS= -DLUA_USER_H='"ltests.h"'
|
|
-
|
|
-# -mtune=native -fomit-frame-pointer
|
|
-# -fno-stack-protector
|
|
-LOCAL = $(TESTS) $(CWARNS) -g
|
|
-
|
|
-
|
|
-
|
|
-# enable Linux goodies
|
|
-MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX -DLUA_COMPAT_5_2
|
|
-MYLDFLAGS= $(LOCAL) -Wl,-E
|
|
-MYLIBS= -ldl -lreadline
|
|
-
|
|
-
|
|
-CC= clang-3.8
|
|
-CFLAGS= -Wall -O2 $(MYCFLAGS)
|
|
-AR= ar rcu
|
|
-RANLIB= ranlib
|
|
-RM= rm -f
|
|
-
|
|
-
|
|
-
|
|
-# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
|
|
-
|
|
-
|
|
-LIBS = -lm
|
|
-
|
|
-CORE_T= liblua.a
|
|
-CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
|
|
- lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
|
|
- ltm.o lundump.o lvm.o lzio.o ltests.o
|
|
-AUX_O= lauxlib.o
|
|
-LIB_O= lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o \
|
|
- lutf8lib.o lbitlib.o loadlib.o lcorolib.o linit.o
|
|
-
|
|
-LUA_T= lua
|
|
-LUA_O= lua.o
|
|
-
|
|
-# LUAC_T= luac
|
|
-# LUAC_O= luac.o print.o
|
|
-
|
|
-ALL_T= $(CORE_T) $(LUA_T) $(LUAC_T)
|
|
-ALL_O= $(CORE_O) $(LUA_O) $(LUAC_O) $(AUX_O) $(LIB_O)
|
|
-ALL_A= $(CORE_T)
|
|
-
|
|
-all: $(ALL_T)
|
|
-
|
|
-o: $(ALL_O)
|
|
-
|
|
-a: $(ALL_A)
|
|
-
|
|
-$(CORE_T): $(CORE_O) $(AUX_O) $(LIB_O)
|
|
- $(AR) $@ $?
|
|
- $(RANLIB) $@
|
|
-
|
|
-$(LUA_T): $(LUA_O) $(CORE_T)
|
|
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(CORE_T) $(LIBS) $(MYLIBS) $(DL)
|
|
-
|
|
-$(LUAC_T): $(LUAC_O) $(CORE_T)
|
|
- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(CORE_T) $(LIBS) $(MYLIBS)
|
|
-
|
|
-clean:
|
|
- rcsclean -u
|
|
- $(RM) $(ALL_T) $(ALL_O)
|
|
-
|
|
-depend:
|
|
- @$(CC) $(CFLAGS) -MM *.c
|
|
-
|
|
-echo:
|
|
- @echo "CC = $(CC)"
|
|
- @echo "CFLAGS = $(CFLAGS)"
|
|
- @echo "AR = $(AR)"
|
|
- @echo "RANLIB = $(RANLIB)"
|
|
- @echo "RM = $(RM)"
|
|
- @echo "MYCFLAGS = $(MYCFLAGS)"
|
|
- @echo "MYLDFLAGS = $(MYLDFLAGS)"
|
|
- @echo "MYLIBS = $(MYLIBS)"
|
|
- @echo "DL = $(DL)"
|
|
-
|
|
-$(ALL_O): makefile
|
|
-
|
|
-# DO NOT EDIT
|
|
-# automatically made with 'gcc -MM l*.c'
|
|
-
|
|
-lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
|
|
- lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \
|
|
- ltable.h lundump.h lvm.h
|
|
-lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h
|
|
-lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
|
|
- llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
|
|
- ldo.h lgc.h lstring.h ltable.h lvm.h
|
|
-lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h
|
|
-ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
|
|
- lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \
|
|
- ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h
|
|
-ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
|
|
- lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
|
|
- lparser.h lstring.h ltable.h lundump.h lvm.h
|
|
-ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \
|
|
- ltm.h lzio.h lmem.h lundump.h
|
|
-lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \
|
|
- lgc.h lstate.h ltm.h lzio.h lmem.h
|
|
-lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
|
- llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
|
|
-linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h
|
|
-liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
|
|
- lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
|
|
- lstring.h ltable.h
|
|
-lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
|
- llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h
|
|
-loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \
|
|
- ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \
|
|
- lvm.h
|
|
-lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h
|
|
-loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
|
|
- llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
|
|
- ldo.h lfunc.h lstring.h lgc.h ltable.h
|
|
-lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
|
|
- lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \
|
|
- lstring.h ltable.h
|
|
-lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
|
|
- lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h
|
|
-lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
|
- llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
|
|
-ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-ltests.o: ltests.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
|
|
- lobject.h ltm.h lzio.h lmem.h lauxlib.h lcode.h llex.h lopcodes.h \
|
|
- lparser.h lctype.h ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h \
|
|
- lualib.h
|
|
-ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
|
- llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h
|
|
-lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
|
|
- lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \
|
|
- lundump.h
|
|
-lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
|
|
-lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
|
- llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \
|
|
- ltable.h lvm.h
|
|
-lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \
|
|
- lobject.h ltm.h lzio.h
|
|
-
|
|
-# (end of Makefile)
|
|
--
|
|
2.17.1
|
|
|