wmii/mk/hdr.mk

150 lines
3.4 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
COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS)
COMPILE = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS)"
COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS) $(SOCFLAGS)"
2009-10-10 00:40:33 +04:00
LINK = $(SHELL) $(ROOT)/util/link "$(LD)" "$(PACKAGES)" "$(LDFLAGS) $(LIBS)"
LINKSO = $(SHELL) $(ROOT)/util/link "$(LD)" "$(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
2010-10-08 00:31:42 +04:00
CTAGS=ctags --fields=+S --c-kinds=+px
PACKAGES =
2009-05-21 22:22:58 +04:00
2008-05-30 01:22:56 +04:00
# 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.
SHELLSEARCH = for sh in /bin/dash /bin/ksh /bin/sh; do \
if test -x $$sh; then echo $$sh; exit; fi; done
BINSH:= $(shell $(SHELLSEARCH))
BINSH!= $(SHELLSEARCH)
SHELL := $(BINSH)
.SHELL: name=sh path=$(SHELL)
2010-05-20 17:30:13 +04:00
include $(ROOT)/config.mk
sinclude $(ROOT)/config.local.mk
sinclude $(shell echo .)depend
2010-05-21 19:12:41 +04:00
.SILENT:
.SUFFIXES: .$(SOEXT) .1 .3 .awk .build .c .clean .depend .install .man1 .man3 .o .o_pic .out .pdf .py .rc .sh .uninstall
all:
.c.depend:
echo MKDEP $<
$(DEBUG) eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend
.sh.depend .rc.depend .1.depend .3.depend .awk.depend:
2007-07-03 18:16:14 +04:00
:
.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; \
$(DEBUG) $(FILTER) $< >$@; \
$(DEBUG) chmod 0755 $@
.man1.1 .man3.3:
echo TXT2TAGS $(BASE)$<
$(DEBUG) txt2tags -o- $< >$@
DEBUG = _debug() { [ -n "$$noisycc" ] && echo >&2 $$@ || true; "$$@"; }; _debug
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); \
$(DEBUG) rm -f $$f; \
if [ "$$dashb" = -b ]; \
then $(DEBUG) cp -f $$2 $$f; \
else $(DEBUG) $(FILTER) <$$2 >$$f; \
fi; \
$(DEBUG) chmod $$1 $$f; \
}; _install
UNINSTALL= _uninstall() { set -e; \
echo UNINSTALL $$($(CLEANNAME) $(BASE)$$1); \
$(DEBUG) rm -f $(DESTDIR)$$2/$$(basename $$3); \
}; _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):
$(UNINSTALLMAN) $<
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