get_screens() to return nil when there are no screens
[wmiirc-lua.git] / Makefile
blob64ea18dde56871aba1c03e4339c882e73f15a076
1 include config.mk
3 MAN = wmii.3lua
6 # ------------------------------------------------------------------------
7 # main target
9 .PHONY: all help deb debi libs luaixp luaeventloop docs man clean distclean tags install install-user install-variable-check install-user-variable-check
10 all: libs man
12 help:
13 @echo "make [target]"
14 @echo
15 @echo " general targets"
16 @echo " all - build everything"
17 @echo " libs - build libraries"
18 @echo " docs - build documentation"
19 @echo " clean - clean up build"
20 @echo " distclean - clean even more"
21 @echo " install - install in system dir"
22 @echo " install-user - install in user home dir"
23 @echo
24 @echo " development targets"
25 @echo " tags - build ctags index"
26 @echo " cscope - build cscope index"
27 @echo
28 @echo " Debian targets"
29 @echo " deb - build the .deb"
30 @echo " debi - install the deb"
32 deb:
33 debuild
35 debi: deb
36 sudo debi
38 config.mk: config.mk.dist
39 if test -f $@ ; then \
40 touch $@ ; \
41 else \
42 cp $< $@ ; \
45 # ------------------------------------------------------------------------
46 # building
48 libs: luaeventloop luaixp
49 luaeventloop luaixp:
50 ${MAKE} -C $@
52 docs: man
53 man: ${MAN}
54 ${MAN}: core/wmii.lua
55 ${POD2MAN} \
56 --name=wmii \
57 --center="WMII Lua Integration" \
58 --section=3lua \
59 --release="wmii 3.6" \
60 $< $@
62 # ------------------------------------------------------------------------
63 # cleaning
65 clean:
66 -rm -f *~ */*~
67 -rm -f wmii.3lua
68 -rm -f cscope.files cscope.out tags
69 -${MAKE} -C luaixp clean
70 -${MAKE} -C luaeventloop clean
72 distclean: clean
73 -rm -f config.mk
75 # ------------------------------------------------------------------------
76 # installing
79 # install system wide
81 install: ${MAN} install-variable-check
82 # create directories
83 ${INSTALL} -d ${ALL_INSTALL_DIRS}
85 # install libraries
86 ${MAKE} -C luaixp install
87 ${MAKE} -C luaeventloop install
89 # install core and plugin lua scripts
90 ${INSTALL} -m 0644 -t ${CORE_LUA_DIR} core/*.lua
91 ${INSTALL} -m 0644 -t ${PLUGIN_LUA_DIR} plugins/*.lua
93 # install new config file
94 ${INSTALL} -m 0755 -t ${RC_DIR} wmiirc.lua
95 ${INSTALL} -m 0644 -t ${XS_DIR} wmii-lua.desktop
97 # install man page
98 ${INSTALL} -m 0644 -t ${MAN_DIR} ${MAN}
100 # install scripts
101 ${INSTALL} -m 0755 -t ${BIN_DIR} install-wmiirc-lua
102 ${INSTALL} -m 0755 -t ${BIN_DIR} wmii-lua
104 install-variable-check:
105 $(if ${ALL_INSTALL_DIRS},,$(error ALL_INSTALL_DIRS variable is empty; check config.mk))
106 $(if ${CORE_LUA_DIR},, $(error CORE_LUA_DIR variable is empty; check config.mk))
107 $(if ${PLUGIN_LUA_DIR},, $(error PLUGIN_LUA_DIR variable is empty; check config.mk))
108 $(if ${RC_DIR},, $(error RC_DIR variable is empty; check config.mk))
109 $(if ${XS_DIR},, $(error XS_DIR variable is empty; check config.mk))
110 $(if ${MAN_DIR},, $(error MAN_DIR variable is empty; check config.mk))
111 $(if ${BIN_DIR},, $(error BIN_DIR variable is empty; check config.mk))
112 @echo Config vars OK.
115 # install in user directory
117 install-user: install-user-variable-check
118 ifeq ($(shell pwd),$(wildcard ~/.wmii-3.5))
119 @echo "You're already in the ~/.wmii-3.5/ directory"
120 else
121 ${INSTALL} -d ${ALL_HOME_DIRS}
122 @if test -f ${HOME_WMII}/wmiirc ; then \
123 echo "NOTE: you might want to look at ${HOME_WMII}/wmiirc.dist" ; \
124 ${INSTALL} -T -m 0744 -b wmiirc.lua ${HOME_WMII}/wmiirc.dist ; \
125 else \
126 echo "Installing new ${HOME_WMII}/wmiirc" ; \
127 ${INSTALL} -T -m 0744 -b wmiirc.lua ${HOME_WMII}/wmiirc ; \
129 ${INSTALL} -m 0644 -b -t ${HOME_CORE} core/*.lua
130 ${INSTALL} -m 0644 -b -t ${HOME_PLUGINS} plugins/*.lua
131 ${INSTALL} -m 0644 -b -t ${HOME_WMII} ${MAN}
132 ${INSTALL} -m 0744 -t ${HOME_BIN_DIR} wmii-lua
133 ${MAKE} -C luaixp install-user
134 ${MAKE} -C luaeventloop install-user
136 install-user: ${MAN}
137 endif
139 install-user-variable-check:
140 $(if ${ALL_HOME_DIRS},,$(error ALL_HOME_DIRS variable is empty; check config.mk))
141 $(if ${HOME_WMII},, $(error HOME_WMII variable is empty; check config.mk))
142 $(if ${HOME_CORE},, $(error HOME_CORE variable is empty; check config.mk))
143 $(if ${HOME_PLUGINS},, $(error HOME_PLUGINS variable is empty; check config.mk))
144 $(if ${HOME_WMII},, $(error HOME_WMII variable is empty; check config.mk))
145 $(if ${HOME_BIN_DIR},, $(error HOME_BIN_DIR variable is empty; check config.mk))
146 @echo Config vars OK.
148 .PHONY: xxx
149 xxx:
150 ${MAKE} all
151 sudo ${MAKE} install PREFIX=/usr
154 # ------------------------------------------------------------------------
155 # tags and cscope
157 cscope.files::
158 find . -name '*.[ch]' -o -name '*.lua' | grep -v -e CVS -e SCCS > cscope.files
160 cscope.out: cscope.files
161 -cscope -P`pwd` -b
163 tags: cscope.out
164 rm -f tags
165 xargs -n 50 ctags -a < cscope.files