2009-10-26 23:35:43 +03:00
|
|
|
DIR =
|
|
|
|
DIRS =
|
|
|
|
DOC =
|
|
|
|
DOCDIR =
|
|
|
|
DOCS =
|
|
|
|
EXECS =
|
|
|
|
HFILES =
|
|
|
|
INCLUDES =
|
|
|
|
LIB =
|
|
|
|
LIBS =
|
|
|
|
OBJ =
|
|
|
|
OFILES =
|
|
|
|
OFILES_PIC =
|
|
|
|
PACKAGES =
|
|
|
|
PROG =
|
|
|
|
SO =
|
|
|
|
TAGFILES =
|
|
|
|
TARG =
|
|
|
|
TEXT =
|
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
FILTER = cat
|
2009-10-10 00:40:33 +04:00
|
|
|
|
|
|
|
EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600
|
|
|
|
|
2010-06-28 01:47:45 +04:00
|
|
|
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
|
|
|
|
2010-06-28 01:47:45 +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
|
|
|
|
2010-05-26 16:44:43 +04:00
|
|
|
CLEANNAME=$(SHELL) $(ROOT)/util/cleanname
|
2009-10-10 00:40:33 +04:00
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
SOEXT=so
|
2009-06-12 03:46:01 +04:00
|
|
|
TAGFILES=
|
2009-10-10 00:40:33 +04:00
|
|
|
|
2010-10-08 00:31:42 +04:00
|
|
|
CTAGS=ctags --fields=+S --c-kinds=+px
|
2008-01-26 18:03:06 +03:00
|
|
|
|
2010-06-28 01:47:45 +04:00
|
|
|
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.
|
2010-08-29 16:53:15 +04:00
|
|
|
SHELLSEARCH = for sh in /bin/dash /bin/ksh /bin/sh; do \
|
|
|
|
if test -x $$sh; then echo $$sh; exit; fi; done
|
2008-01-26 18:03:06 +03:00
|
|
|
|
2010-08-29 16:53:15 +04:00
|
|
|
BINSH:= $(shell $(SHELLSEARCH))
|
|
|
|
BINSH!= $(SHELLSEARCH)
|
|
|
|
SHELL := $(BINSH)
|
|
|
|
.SHELL: name=sh path=$(SHELL)
|
2010-05-20 17:30:13 +04:00
|
|
|
|
2010-08-29 16:53:15 +04:00
|
|
|
include $(ROOT)/config.mk
|
|
|
|
sinclude $(ROOT)/config.local.mk
|
|
|
|
sinclude $(shell echo .)depend
|
2010-05-21 19:12:41 +04:00
|
|
|
|
2007-03-26 08:48:00 +04:00
|
|
|
.SILENT:
|
2010-06-28 01:47:45 +04:00
|
|
|
.SUFFIXES: .$(SOEXT) .1 .3 .awk .build .c .clean .depend .install .man1 .man3 .o .o_pic .out .pdf .py .rc .sh .uninstall
|
2007-03-26 08:48:00 +04:00
|
|
|
all:
|
|
|
|
|
|
|
|
.c.depend:
|
2007-04-23 10:29:02 +04:00
|
|
|
echo MKDEP $<
|
2010-06-28 01:47:45 +04:00
|
|
|
$(DEBUG) eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2010-06-23 18:55:55 +04:00
|
|
|
.sh.depend .rc.depend .1.depend .3.depend .awk.depend:
|
2007-07-03 18:16:14 +04:00
|
|
|
:
|
|
|
|
|
2007-03-26 20:57:46 +04:00
|
|
|
.c.o:
|
2008-01-18 01:50:35 +03:00
|
|
|
$(COMPILE) $@ $<
|
|
|
|
.c.o_pic:
|
|
|
|
$(COMPILEPIC) $@ $<
|
2007-03-26 20:57:46 +04:00
|
|
|
|
2009-09-03 22:20:44 +04:00
|
|
|
.o.out:
|
2008-01-18 01:50:35 +03:00
|
|
|
$(LINK) $@ $<
|
2009-09-03 22:20:44 +04:00
|
|
|
.c.out:
|
2010-05-23 04:55:16 +04:00
|
|
|
$(COMPILE) $(<:.c=.o) $<
|
|
|
|
$(LINK) $@ $(<:.c=.o)
|
2008-01-18 01:50:35 +03:00
|
|
|
|
2009-10-13 10:40:45 +04:00
|
|
|
.rc.out .awk.out .sh.out:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo FILTER $(BASE)$<
|
2010-05-23 04:55:16 +04:00
|
|
|
[ -n "$(<:%.sh=)" ] || $(BINSH) -n $<
|
2009-10-25 21:57:21 +03:00
|
|
|
set -e; \
|
2010-06-28 01:47:45 +04:00
|
|
|
$(DEBUG) $(FILTER) $< >$@; \
|
|
|
|
$(DEBUG) chmod 0755 $@
|
2009-10-13 10:40:45 +04:00
|
|
|
|
2010-06-23 18:55:55 +04:00
|
|
|
.man1.1 .man3.3:
|
2008-12-10 02:06:10 +03:00
|
|
|
echo TXT2TAGS $(BASE)$<
|
2010-06-28 01:47:45 +04:00
|
|
|
$(DEBUG) txt2tags -o- $< >$@
|
|
|
|
|
|
|
|
DEBUG = _debug() { [ -n "$$noisycc" ] && echo >&2 $$@ || true; "$$@"; }; _debug
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2009-10-13 10:40:45 +04:00
|
|
|
INSTALL= _install() { set -e; \
|
|
|
|
dashb=$$1; [ $$1 = -b ] && shift; \
|
2010-05-24 23:24:38 +04:00
|
|
|
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; \
|
2009-10-13 10:40:45 +04:00
|
|
|
echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
|
2010-06-28 01:47:45 +04:00
|
|
|
$(DEBUG) rm -f $$f; \
|
2009-10-13 10:40:45 +04:00
|
|
|
if [ "$$dashb" = -b ]; \
|
2010-06-28 01:47:45 +04:00
|
|
|
then $(DEBUG) cp -f $$2 $$f; \
|
|
|
|
else $(DEBUG) $(FILTER) <$$2 >$$f; \
|
2009-10-13 10:40:45 +04:00
|
|
|
fi; \
|
2010-06-28 01:47:45 +04:00
|
|
|
$(DEBUG) chmod $$1 $$f; \
|
2009-10-13 10:40:45 +04:00
|
|
|
}; _install
|
|
|
|
UNINSTALL= _uninstall() { set -e; \
|
2010-06-23 18:55:55 +04:00
|
|
|
echo UNINSTALL $$($(CLEANNAME) $(BASE)$$1); \
|
2010-06-28 01:47:45 +04:00
|
|
|
$(DEBUG) rm -f $(DESTDIR)$$2/$$(basename $$3); \
|
2009-10-13 10:40:45 +04:00
|
|
|
}; _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) $*
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
.a.install .$(SOEXT).install:
|
2010-05-24 16:49:12 +04:00
|
|
|
$(INSTALL) -b 0644 $< $(LIBDIR) $<
|
2008-01-24 05:45:30 +03:00
|
|
|
.a.uninstall .$(SOEXT).uninstall:
|
2010-05-24 16:49:12 +04:00
|
|
|
$(UNINSTALL) $< $(LIBDIR) $<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
.h.install:
|
2010-05-24 16:49:12 +04:00
|
|
|
$(INSTALL) 0644 $< $(INCLUDE) $<
|
2007-03-26 20:57:46 +04:00
|
|
|
.h.uninstall:
|
2010-05-24 16:49:12 +04:00
|
|
|
$(UNINSTALL) $< $(INCLUDE) $<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
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) $<
|
2009-10-13 10:40:45 +04:00
|
|
|
|
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
|
2009-10-13 10:40:45 +04:00
|
|
|
MANSECTIONS=1 2 3 4 5 6 7 8 9
|
2010-05-23 04:55:16 +04:00
|
|
|
$(MANSECTIONS:%=.%.install):
|
2009-10-13 10:40:45 +04:00
|
|
|
$(INSTALMAN) $<
|
2010-05-23 04:55:16 +04:00
|
|
|
$(MANSECTIONS:%=.%.uninstall):
|
2010-06-23 18:55:55 +04:00
|
|
|
$(UNINSTALLMAN) $<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2009-09-03 22:20:44 +04:00
|
|
|
.out.clean:
|
2008-01-27 05:13:42 +03:00
|
|
|
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
|
2008-01-18 01:50:35 +03:00
|
|
|
.o.clean .o_pic.clean:
|
2008-01-27 05:13:42 +03:00
|
|
|
echo CLEAN $$($(CLEANNAME) $(BASE)$<)
|
2007-04-19 22:53:07 +04:00
|
|
|
rm -f $< || true 2>/dev/null
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
printinstall:
|
|
|
|
clean:
|
2009-10-13 10:40:45 +04:00
|
|
|
install: printinstall
|
2007-04-23 10:29:02 +04:00
|
|
|
depend: cleandep
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2008-01-18 01:50:35 +03:00
|
|
|
include $(ROOT)/mk/common.mk
|
2007-04-24 12:34:14 +04:00
|
|
|
|