summaryrefslogtreecommitdiffhomepage
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/config.mk27
-rw-r--r--build/module.mk3
2 files changed, 28 insertions, 2 deletions
diff --git a/build/config.mk b/build/config.mk
index 66585289b..9db99cd6b 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -1,3 +1,28 @@
+OS ?= $(shell uname)
+
LUAC = luac
LUAC_OPTIONS = -s
-LUCI_INSTALLDIR = /usr/lib/lua/luci \ No newline at end of file
+LUCI_INSTALLDIR = /usr/lib/lua/luci
+LUA_SHLIBS = $(shell pkg-config --silence-errors --libs lua5.1)
+LUA_LIBS = $(if $(LUA_SHLIBS),$(LUA_SHLIBS),$(firstword $(wildcard /usr/lib/liblua.a /usr/local/lib/liblua.a /opt/local/lib/liblua.a)))
+LUA_CFLAGS = $(shell pkg-config --silence-errors --cflags lua5.1)
+ifeq ($(LUA_LIBS),)
+ $(error LUA installation not found)
+endif
+
+CC = gcc
+AR = ar
+RANLIB = ranlib
+CFLAGS = -O2
+FPIC = -fPIC
+EXTRA_CFLAGS = --std=gnu99
+WFLAGS = -Wall -Werror -pedantic
+CPPFLAGS =
+COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(WFLAGS)
+ifeq ($(OS),Darwin)
+ SHLIB_FLAGS = -bundle -undefined dynamic_lookup
+else
+ SHLIB_FLAGS = -shared
+endif
+LINK = $(CC)
+
diff --git a/build/module.mk b/build/module.mk
index 287314696..923caad70 100644
--- a/build/module.mk
+++ b/build/module.mk
@@ -1,7 +1,8 @@
.PHONY: all compile compile-module source source-module clean clean-module
all: compile
-compile: compile-module
+compile: source-module
+compile-all: compile-module
clean: clean-module
source: source-module