wmii/mk/hdr.mk

157 lines
3.5 KiB
Makefile
Raw Normal View History

DIR =
DIRS =
DOC =
DOCDIR =
DOCS =
EXECS =
HFILES =
INCLUDES =
LIB =
LIBS =
OBJ =
OFILES =
OFILES_PIC =
PACKAGES =
PROG =
SO =
TAGFILES =
TARG =
TEXT =
FILTER = cat
2009-10-10 00:40:33 +04:00
EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600
2010-05-22 06:52:47 +04:00
COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES))
COMPILE = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS)"
COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS) $(SOCFLAGS)"
2009-10-10 00:40:33 +04:00
LINK = $(SHELL) $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(LDFLAGS) $(LIBS)"
LINKSO = $(SHELL) $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(SOLDFLAGS) $(LIBS) $(SHARED)"
2009-10-10 00:40:33 +04:00
CLEANNAME=$(SHELL) $(ROOT)/util/cleanname
2009-10-10 00:40:33 +04:00
SOEXT=so
TAGFILES=
2009-10-10 00:40:33 +04:00
CTAGS=ctags
2009-05-21 22:22:58 +04:00
PACKAGES = 2>/dev/null
2008-05-30 01:22:56 +04:00
# and this:
# Try to find a sane shell. /bin/sh is a last resort, because it's
2009-09-29 01:24:01 +04:00
# usually bash on Linux, which means it's painfully slow.
2008-05-30 01:22:56 +04:00
BINSH := $(shell \
if [ -x /bin/dash ]; then echo /bin/dash; \
elif [ -x /bin/ksh ]; then echo /bin/ksh; \
else echo /bin/sh; fi)
BINSH != echo /bin/sh
2010-05-20 17:30:13 +04:00
include $(ROOT)/config.mk
2010-05-21 19:12:41 +04:00
# I hate this.
MKCFGSH=if test -f $(ROOT)/config.local.mk; then echo $(ROOT)/config.local.mk; else echo /dev/null; fi
MKCFG:=$(shell $(MKCFGSH))
MKCFG!=$(MKCFGSH)
include $(MKCFG)
.SILENT:
2009-09-29 04:09:38 +04:00
.SUFFIXES: .out .o .o_pic .c .pdf .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean
all:
2009-10-26 00:05:55 +03:00
MAKEFILES=.depend
.c.depend:
echo MKDEP $<
[ -n "$(noisycc)" ] && echo $(MKDEP) $(COMPILE_FLAGS) $< || true
2010-05-22 06:52:47 +04:00
eval "$(MKDEP) $(COMPILE_FLAGS)" $< >>.depend
2007-07-03 18:16:14 +04:00
.sh.depend .rc.depend .1.depend .awk.depend:
:
.c.o:
$(COMPILE) $@ $<
.c.o_pic:
$(COMPILEPIC) $@ $<
2009-09-03 22:20:44 +04:00
.o.out:
$(LINK) $@ $<
2009-09-03 22:20:44 +04:00
.c.out:
$(COMPILE) $(<:.c=.o) $<
$(LINK) $@ $(<:.c=.o)
.rc.out .awk.out .sh.out:
echo FILTER $(BASE)$<
[ -n "$(<:%.sh=)" ] || $(BINSH) -n $<
set -e; \
[ -n "$(noisycc)" ] && set -x; \
$(FILTER) $< >$@; \
chmod 0755 $@
.man1.1:
echo TXT2TAGS $(BASE)$<
[ -n "$(noisycc)" ] && set -x; \
2009-10-10 00:40:33 +04:00
txt2tags -o- $< >$@
INSTALL= _install() { set -e; \
dashb=$$1; [ $$1 = -b ] && shift; \
d=$(DESTDIR)$$3; f=$$d/$$(basename $$4); \
2010-05-24 16:49:12 +04:00
if [ ! -d $$d ]; then echo MKDIR $$3; mkdir -p $$d; fi; \
echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
[ -n "$(noisycc)" ] && set -x; \
if [ "$$dashb" = -b ]; \
2010-05-24 16:49:12 +04:00
then cp -f $$2 $$f; \
else $(FILTER) <$$2 >$$f; \
fi; \
2010-05-24 16:49:12 +04:00
chmod $$1 $$f; \
2009-10-26 00:05:55 +03:00
set +x; \
}; _install
UNINSTALL= _uninstall() { set -e; \
echo UNINSTALL $$($(CLEANNAME) $(BASE)$$2); \
[ -n "$(noisycc)" ] && set -x; \
2010-05-24 16:49:12 +04:00
rm -f $(DESTDIR)$$3/$$(basename $$4); \
}; _uninstall
2009-09-03 22:20:44 +04:00
.out.install:
2010-05-24 16:49:12 +04:00
$(INSTALL) -b 0755 $< $(BIN) $*
2009-09-03 22:20:44 +04:00
.out.uninstall:
2010-05-24 16:49:12 +04:00
$(UNINSTALL) $< $(BIN) $*
.a.install .$(SOEXT).install:
2010-05-24 16:49:12 +04:00
$(INSTALL) -b 0644 $< $(LIBDIR) $<
.a.uninstall .$(SOEXT).uninstall:
2010-05-24 16:49:12 +04:00
$(UNINSTALL) $< $(LIBDIR) $<
.h.install:
2010-05-24 16:49:12 +04:00
$(INSTALL) 0644 $< $(INCLUDE) $<
.h.uninstall:
2010-05-24 16:49:12 +04:00
$(UNINSTALL) $< $(INCLUDE) $<
2009-09-29 04:09:38 +04:00
.pdf.install:
2010-05-24 16:49:12 +04:00
$(INSTALL) -b 0644 $< $(DOC) $<
2009-09-29 04:09:38 +04:00
.pdf.uninstall:
2010-05-24 16:49:12 +04:00
$(UNINSTALL) $< $(DOC) $<
2010-05-24 16:49:12 +04:00
INSTALMAN= _installman() { man=$${1\#\#*.}; $(INSTALL) 0644 $$1 $(MAN)/man$$man $$1; }; _installman
UNINSTALLMAN=_uninstallman() { man=$${1\#\#*.}; $(UNINSTALL) $$1 $(MAN)/man$$man $$1; }; _uninstallman
MANSECTIONS=1 2 3 4 5 6 7 8 9
$(MANSECTIONS:%=.%.install):
$(INSTALMAN) $<
$(MANSECTIONS:%=.%.uninstall):
$(UNINSTALL) $<
2009-09-03 22:20:44 +04:00
.out.clean:
echo CLEAN $$($(CLEANNAME) $(BASE)$<)
2007-04-19 22:53:07 +04:00
rm -f $< || true 2>/dev/null
rm -f $*.o || true 2>/dev/null
.o.clean .o_pic.clean:
echo CLEAN $$($(CLEANNAME) $(BASE)$<)
2007-04-19 22:53:07 +04:00
rm -f $< || true 2>/dev/null
printinstall:
clean:
install: printinstall
depend: cleandep
include $(ROOT)/mk/common.mk