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