summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-18 00:44:52 +0800
committerruki <[email protected]>2021-09-18 00:44:52 +0800
commitb58700f83ee4e40582b03f5fdfe337788b9f2c6f (patch)
tree2c0fd405e959913d53436299f509e8c05cda57b5
parent4d8c00eecd99b0f65f40befd36bb2945df9996a7 (diff)
update makefile
-rw-r--r--core/makefile5
-rw-r--r--core/project.mak2
-rw-r--r--core/src/lcurses/makefile7
-rw-r--r--core/src/lua/makefile58
-rw-r--r--core/src/makefile10
-rw-r--r--core/src/xmake/makefile7
-rw-r--r--makefile7
7 files changed, 90 insertions, 6 deletions
diff --git a/core/makefile b/core/makefile
index 0bba754cd..d7c529489 100644
--- a/core/makefile
+++ b/core/makefile
@@ -368,6 +368,7 @@ config : .null
@$(ECHO) "directories:"
@$(ECHO) " install:\t\t"$(abspath $(INSTALL))
@$(ECHO) " package:\t\t"$(PACKAGE)
+ @$(ECHO) " backend:\t\t"$(BACKEND)
@$(ECHO) ""
@$(ECHO) "toolchains:"
@$(ECHO) " bin:\t\t"$(BIN)
@@ -459,6 +460,10 @@ config : .null
@$(ECHO) "export MIPS" >> .config.mak
@$(ECHO) "export SPARC" >> .config.mak
@$(ECHO) "" >> .config.mak
+ @$(ECHO) "# backend" >> .config.mak
+ @$(ECHO) "BACKEND ="$(BACKEND) >> .config.mak
+ @$(ECHO) "export BACKEND" >> .config.mak
+ @$(ECHO) "" >> .config.mak
@$(ECHO) "# demo" >> .config.mak
@$(ECHO) "DEMO ="$(DEMO) >> .config.mak
@$(ECHO) "export DEMO" >> .config.mak
diff --git a/core/project.mak b/core/project.mak
index 041121fea..adf613ef2 100644
--- a/core/project.mak
+++ b/core/project.mak
@@ -16,5 +16,5 @@ PRO_VERSION_ALTER = 7
PRO_PREFIX = XM_
# the package names
-PKG_NAMES = tbox luajit base
+PKG_NAMES = tbox luajit lua base
diff --git a/core/src/lcurses/makefile b/core/src/lcurses/makefile
index 25752ab47..b981765a7 100644
--- a/core/src/lcurses/makefile
+++ b/core/src/lcurses/makefile
@@ -17,7 +17,12 @@ lcurses_C_FILES += lcurses
lcurses_CXFLAGS += $(if $(findstring curses,$(base_LIBNAMES)),-DXM_CONFIG_API_HAVE_CURSES,)
# includes
-lcurses_INC_DIRS += ../luajit/luajit/src
+ifeq ($(BACKEND),luajit)
+lcurses_INC_DIRS += ../luajit/luajit/src
+endif
+ifeq ($(BACKEND),lua)
+lcurses_INC_DIRS += ../lua/lua
+endif
# suffix
include $(PRO_DIR)/suffix.mak
diff --git a/core/src/lua/makefile b/core/src/lua/makefile
new file mode 100644
index 000000000..d2314c846
--- /dev/null
+++ b/core/src/lua/makefile
@@ -0,0 +1,58 @@
+# prefix
+include $(PRO_DIR)/prefix.mak
+
+# module name
+NAMES = lua
+
+# module type
+lua_TYPE = LIB
+
+# config
+lua_CONFIG = n
+
+# core files
+lua_C_FILES += \
+ lua/lauxlib \
+ lua/liolib \
+ lua/lopcodes \
+ lua/lstate \
+ lua/lobject \
+ lua/lmathlib \
+ lua/loadlib \
+ lua/lvm \
+ lua/lfunc \
+ lua/lstrlib \
+ lua/linit \
+ lua/lstring \
+ lua/lundump \
+ lua/lctype \
+ lua/ltable \
+ lua/ldump \
+ lua/loslib \
+ lua/lgc \
+ lua/lzio \
+ lua/ldblib \
+ lua/lutf8lib \
+ lua/lmem \
+ lua/lcorolib \
+ lua/lcode \
+ lua/ltablib \
+ lua/lbitlib \
+ lua/lapi \
+ lua/lbaselib \
+ lua/ldebug \
+ lua/lparser \
+ lua/llex \
+ lua/ltm \
+ lua/ltests \
+ lua/ldo
+
+# use given system library?
+lua_C_FILES := $(if $(findstring lua,$(base_LIBNAMES)),,$(lua_C_FILES))
+lua_ASM_FILES := $(if $(findstring lua,$(base_LIBNAMES)),,$(lua_ASM_FILES))
+lua_INC_FILES := $(if $(findstring lua,$(base_LIBNAMES)),,$(lua_INC_FILES))
+lua_OBJ_FILES := $(if $(findstring lua,$(base_LIBNAMES)),,$(lua_OBJ_FILES))
+
+# suffix
+include $(PRO_DIR)/suffix.mak
+
diff --git a/core/src/makefile b/core/src/makefile
index 21a06ed5a..47151258e 100644
--- a/core/src/makefile
+++ b/core/src/makefile
@@ -2,8 +2,14 @@
include $(PRO_DIR)/prefix.mak
# projects
-SUB_PROS += demo
-DEP_PROS += lcurses sv luajit lua-cjson tbox xmake
+SUB_PROS += demo
+ifeq ($(BACKEND),luajit)
+DEP_PROS += luajit
+endif
+ifeq ($(BACKEND),lua)
+DEP_PROS += lua
+endif
+DEP_PROS += lcurses sv lua-cjson tbox xmake
# suffix
include $(PRO_DIR)/suffix.mak
diff --git a/core/src/xmake/makefile b/core/src/xmake/makefile
index 2c45588b4..84f3044b2 100644
--- a/core/src/xmake/makefile
+++ b/core/src/xmake/makefile
@@ -149,8 +149,13 @@ xmake_CXFLAGS += $(if $(findstring curses,$(base_LIBNAMES)),-DXM_CONFIG
xmake_INC_DIRS += \
../tbox/tbox/src \
../tbox/inc/$(PLAT) \
- ../luajit/luajit/src \
../sv/sv/include
+ifeq ($(BACKEND),luajit)
+xmake_INC_DIRS += ../luajit/luajit/src
+endif
+ifeq ($(BACKEND),lua)
+xmake_INC_DIRS += ../lua/lua
+endif
# suffix
diff --git a/makefile b/makefile
index cc7c61ba1..c22bc30cb 100644
--- a/makefile
+++ b/makefile
@@ -15,6 +15,11 @@ prefix :=$(PREFIX)
endif
endif
+# use luajit or lua backend
+ifeq ($(BACKEND),)
+BACKEND :=luajit
+endif
+
# the temporary directory
ifeq ($(TMPDIR),)
TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),/tmp)
@@ -94,7 +99,7 @@ xrepo_bin_install :=$(destdir)/bin/xrepo
build:
@echo compiling xmake-core ...
@if [ -f core/.config.mak ]; then rm core/.config.mak; fi
- +@$(MAKE) -C core --no-print-directory f DEBUG=$(debug)
+ +@$(MAKE) -C core --no-print-directory f DEBUG=$(debug) BACKEND=$(BACKEND)
+@$(MAKE) -C core --no-print-directory c
+@$(MAKE) -C core --no-print-directory