775820cb1b43022de83299188099dfe3590524c1
[project/luci.git] / Makefile
1 include build/config.mk
2
3 MODULES = contrib/* applications/* libs/* modules/* themes/* i18n/*
4
5 OS:=$(shell uname)
6 export OS
7
8 .PHONY: all build gccbuild luabuild clean host gcchost luahost hostcopy hostclean
9
10 all: build
11
12 build: gccbuild luabuild
13
14 gccbuild:
15 make -C libs/lmo CC="cc" CFLAGS="" LDFLAGS="" host-install
16 for i in $(MODULES); do \
17 make -C$$i compile || { \
18 echo "*** Compilation of $$i failed!"; \
19 exit 1; \
20 }; \
21 done
22
23 luabuild: i18nbuild
24 for i in $(MODULES); do HOST=$(realpath host) make -C$$i luabuild; done
25
26 i18nbuild:
27 mkdir -p host/lua-po
28 ./build/i18n-po2lua.pl ./po host/lua-po
29
30 clean:
31 make -C libs/lmo host-clean
32 for i in $(MODULES); do make -C$$i clean; done
33
34
35 host: build hostcopy
36
37 gcchost: gccbuild hostcopy
38
39 luahost: luabuild hostcopy
40
41 hostcopy:
42 mkdir -p host/tmp
43 for i in $(MODULES); do cp -pR $$i/dist/* host/ 2>/dev/null || true; done
44 for i in $(MODULES); do cp -pR $$i/hostfiles/* host/ 2>/dev/null || true; done
45 rm -f host/luci
46 ln -s .$(LUCI_MODULEDIR) host/luci
47 rm -rf /tmp/luci-* || true
48
49 hostenv: host ucidefaults
50
51 ucidefaults:
52 build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-freifunk-*"
53
54 runhttpd: hostenv
55 build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "lua build/lucid.lua"
56
57 runlua: hostenv
58 build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "lua -i build/setup.lua"
59
60 runshell: hostenv
61 build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) $$SHELL
62
63 hostclean: clean
64 rm -rf host
65
66 apidocs: hostenv
67 build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "build/makedocs.sh host/luci/ docs"
68
69 uvldocs: hostenv
70 build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) \
71 "build/uvldoc $(realpath host) $(UVL_SCHEMEDIR) uvldocs $(DOCS)"
72
73 po: host
74 for L in $${LANGUAGE:-$$(find i18n/ -path 'i18n/*/luasrc/i18n/*' -name 'default.*.lua' | \
75 sed -e 's!.*/default\.\(.*\)\.lua!\1!')}; do \
76 build/i18n-lua2po.pl . $(realpath host)/po $$L; \
77 done
78
79 run:
80 # make run is deprecated #
81 # Please use: #
82 # #
83 # To run LuCI WebUI using LuCIttpd #
84 # make runhttpd #
85 # #
86 # To run LuCI WebUI using Boa/Webuci #
87 # make runboa #
88 # #
89 # To start a shell in the LuCI environment #
90 # make runshell #
91 # #
92 # To run Lua CLI in the LuCI environment #
93 # make runlua #