complain when a config.mk variable is not defined on make install
[wmiirc-lua.git] / Makefile
blobf14ef280f1472fc2d9dc27cd59cbb1fc2c863823
1 include config.mk
3 MAN = wmii.3lua
6 # ------------------------------------------------------------------------
7 # main target
9 .PHONY: all help deb debi libs luaixp luaeventloop docs man clean 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 " install - install in system dir"
21 @echo " install-user - install in user home dir"
22 @echo
23 @echo " development targets"
24 @echo " tags - build ctags index"
25 @echo " cscope - build cscope index"
26 @echo
27 @echo " Debian targets"
28 @echo " deb - build the .deb"
29 @echo " debi - install the deb"
31 deb:
32 debuild
34 debi: deb
35 sudo debi
37 config.mk: config.mk.dist
38 if test -f $@ ; then \
39 touch $@ ; \
40 else \
41 cp $< $@ ; \
44 # ------------------------------------------------------------------------
45 # building
47 libs: luaeventloop luaixp
48 luaeventloop luaixp:
49 ${MAKE} -C $@
51 docs: man
52 man: ${MAN}
53 ${MAN}: core/wmii.lua
54 ${POD2MAN} \
55 --name=wmii \
56 --center="WMII Lua Integration" \
57 --section=3lua \
58 --release="wmii 3.6" \
59 $< $@
61 # ------------------------------------------------------------------------
62 # cleaning
64 clean:
65 -rm -f *~ */*~
66 -rm -f wmii.3lua
67 -rm -f cscope.files cscope.out tags
68 -${MAKE} -C luaixp clean
69 -${MAKE} -C luaeventloop clean
71 # ------------------------------------------------------------------------
72 # installing
75 # install system wide
77 install: ${MAN} install-variable-check
78 # create directories
79 ${INSTALL} -d ${ALL_INSTALL_DIRS}
81 # install libraries
82 ${MAKE} -C luaixp install
83 ${MAKE} -C luaeventloop install
85 # install core and plugin lua scripts
86 ${INSTALL} -m 0644 -t ${CORE_LUA_DIR} core/*.lua
87 ${INSTALL} -m 0644 -t ${PLUGIN_LUA_DIR} plugins/*.lua
89 # install new config file
90 ${INSTALL} -m 0755 -t ${RC_DIR} wmiirc.lua
91 ${INSTALL} -m 0644 -t ${XS_DIR} wmii-lua.desktop
93 # install man page
94 ${INSTALL} -m 0644 -t ${MAN_DIR} ${MAN}
96 # install scripts
97 ${INSTALL} -m 0755 -t ${BIN_DIR} install-wmiirc-lua
98 ${INSTALL} -m 0755 -t ${BIN_DIR} wmii-lua
100 install-variable-check:
101 $(if ${ALL_INSTALL_DIRS},,$(error ALL_INSTALL_DIRS variable is empty; check config.mk))
102 $(if ${CORE_LUA_DIR},, $(error CORE_LUA_DIR variable is empty; check config.mk))
103 $(if ${PLUGIN_LUA_DIR},, $(error PLUGIN_LUA_DIR variable is empty; check config.mk))
104 $(if ${RC_DIR},, $(error RC_DIR variable is empty; check config.mk))
105 $(if ${XS_DIR},, $(error XS_DIR variable is empty; check config.mk))
106 $(if ${MAN_DIR},, $(error MAN_DIR variable is empty; check config.mk))
107 $(if ${BIN_DIR},, $(error BIN_DIR variable is empty; check config.mk))
108 @echo Config vars OK.
111 # install in user directory
113 install-user: install-user-variable-check
114 ifeq ($(shell pwd),$(wildcard ~/.wmii-3.5))
115 @echo "You're already in the ~/.wmii-3.5/ directory"
116 else
117 ${INSTALL} -d ${ALL_HOME_DIRS}
118 @if test -f ${HOME_WMII}/wmiirc ; then \
119 echo "NOTE: you might want to look at ${HOME_WMII}/wmiirc.dist" ; \
120 ${INSTALL} -T -m 0744 -b wmiirc.lua ${HOME_WMII}/wmiirc.dist ; \
121 else \
122 echo "Installing new ${HOME_WMII}/wmiirc" ; \
123 ${INSTALL} -T -m 0744 -b wmiirc.lua ${HOME_WMII}/wmiirc ; \
125 ${INSTALL} -m 0644 -b -t ${HOME_CORE} core/*.lua
126 ${INSTALL} -m 0644 -b -t ${HOME_PLUGINS} plugins/*.lua
127 ${INSTALL} -m 0644 -b -t ${HOME_WMII} ${MAN}
128 ${INSTALL} -m 0744 -t ${HOME_BIN_DIR} wmii-lua
129 ${MAKE} -C luaixp install-user
130 ${MAKE} -C luaeventloop install-user
132 install-user: ${MAN}
133 endif
135 install-user-variable-check:
136 $(if ${ALL_HOME_DIRS},,$(error ALL_HOME_DIRS variable is empty; check config.mk))
137 $(if ${HOME_WMII},, $(error HOME_WMII variable is empty; check config.mk))
138 $(if ${HOME_CORE},, $(error HOME_CORE variable is empty; check config.mk))
139 $(if ${HOME_PLUGINS},, $(error HOME_PLUGINS variable is empty; check config.mk))
140 $(if ${HOME_WMII},, $(error HOME_WMII variable is empty; check config.mk))
141 $(if ${HOME_BIN_DIR},, $(error HOME_BIN_DIR variable is empty; check config.mk))
142 @echo Config vars OK.
144 .PHONY: xxx
145 xxx:
146 ${MAKE} all
147 sudo ${MAKE} install PREFIX=/usr
150 # ------------------------------------------------------------------------
151 # tags and cscope
153 cscope.files::
154 find . -name '*.[ch]' -o -name '*.lua' | grep -v -e CVS -e SCCS > cscope.files
156 cscope.out: cscope.files
157 -cscope -P`pwd` -b
159 tags: cscope.out
160 rm -f tags
161 xargs -n 50 ctags -a < cscope.files