use V=1 to make Makefile verbose
[wmiirc-lua.git] / Makefile
blob87fb60863b13e09d90ccd0013f43d6dbfc392bed
1 # ------------------------------------------------------------------------
2 # default target
4 .PHONY: default
5 default: all
7 # ------------------------------------------------------------------------
8 # includes and defines
10 ifneq ($(MAKECMDGOALS),gitclean)
11 include config.mk
12 endif
13 include Makefile.ext
14 include Makefile.check
15 include Makefile.rules
17 # ------------------------------------------------------------------------
18 # main targets
20 .PHONY: all help docs clean distclean gitclean tags
22 all clean distclean docs install install-user:
23 @echo Running '$@' in src...
24 ${Q} ${MAKE} -C src $@
26 gitclean:
27 @echo GITCLEAN
28 $(if $(wildcard .git/config),,$(error this is not a git repository))
29 ${Q} git clean -d -x -f
31 # ------------------------------------------------------------------------
32 # help
34 help:
35 @echo "make [target]"
36 @echo
37 @echo " general targets"
38 @echo " all - build everything"
39 @echo " docs - build documentation"
40 @echo " clean - clean up build"
41 @echo " distclean - clean even more"
42 @echo " gitclean - clean everything not tracked by git"
43 @echo " install - install in system dir"
44 @echo " install-user - install in user home dir"
45 @echo
46 @echo " development targets"
47 @echo " tags - build ctags/cscope index"
48 @echo
49 @${MAKE} -s ext-help
51 # ------------------------------------------------------------------------
52 # config
54 config.mk: config.mk.dist
55 @echo Updating $@
56 ${Q} if test -f $@ ; then \
57 touch $@ ; \
58 else \
59 cp $< $@ ; \
62 # ------------------------------------------------------------------------
63 # local dependencies for main rules
65 .PHONY: lcl-clean lcl-distclean
67 clean: lcl-clean
68 lcl-clean:
69 -${Q} rm -f *~
70 -${Q} rm -f cscope.files cscope.out tags
72 distclean: lcl-distclean
73 lcl-distclean: clean
74 -${Q} rm -f config.mk
76 .PHONY:
78 install: install-variable-check
80 install-user: install-user-variable-check
82 # ------------------------------------------------------------------------
83 # tags and cscope
85 .PHONY: cscope tags
87 cscope.files::
88 ${Q} find . -name '*.[ch]' -o -name '*.lua' | grep -v -e CVS -e SCCS > cscope.files
90 cscope: cscope.out
91 cscope.out: cscope.files
92 -${Q} cscope -P`pwd` -b
94 tags: cscope.out
95 ${Q} rm -f tags
96 ${Q} xargs -n 50 ctags -a < cscope.files