Commit from LuCI Translation Portal by user jow.: 38 of 47 messages translated (0...
[oweals/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 libs/web 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 libs/web 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 runhttpd: hostenv
64         build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "lua build/lucid.lua"
65
66 runuhttpd: hostenv
67         cp $(realpath build)/luci.cgi $(realpath host)/www/cgi-bin/luci
68         build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/usr/sbin/uhttpd -p 8080 -h $(realpath host)/www -f"
69
70 runlua: hostenv
71         build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "lua -i build/setup.lua"
72
73 runshell: hostenv
74         build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) $$SHELL
75
76 hostclean: clean
77         rm -rf host
78
79 apidocs: hostenv
80         build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "build/makedocs.sh host/luci/ docs"
81
82 nixiodocs: hostenv
83         build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "build/makedocs.sh libs/nixio/ nixiodocs"
84
85 po: host
86         for L in $${LANGUAGE:-$$(find i18n/ -path 'i18n/*/luasrc/i18n/*' -name 'default.*.lua' | \
87           sed -e 's!.*/default\.\(.*\)\.lua!\1!')}; do \
88             build/i18n-lua2po.pl . $(realpath host)/po $$L; \
89         done
90
91 run:
92         #       make run is deprecated                          #
93         #       Please use:                                     #
94         #                                                       #
95         #       To run LuCI WebUI using LuCIttpd                #
96         #       make runhttpd                                   #
97         #                                                       #
98         #       To run LuCI WebUI using Boa/Webuci              #
99         #       make runboa                                     #
100         #                                                       #
101         #       To start a shell in the LuCI environment        #
102         #       make runshell                                   #
103         #                                                       #
104         #       To run Lua CLI in the LuCI environment          #
105         #       make runlua                                     #