Makefile 2.7 KB

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