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-05-22 06:52:47 +04:00
|
|
|
COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES))
|
|
|
|
COMPILE = $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS)"
|
|
|
|
COMPILEPIC = $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS) $(SOCFLAGS)"
|
2009-10-10 00:40:33 +04:00
|
|
|
|
2009-10-26 22:27:43 +03:00
|
|
|
LINK = $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(LDFLAGS) $(LIBS)"
|
|
|
|
LINKSO = $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(SOLDFLAGS) $(LIBS) $(SHARED)"
|
2009-10-10 00:40:33 +04:00
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
CLEANNAME=$(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
|
|
|
|
2009-06-12 03:46:01 +04:00
|
|
|
CTAGS=ctags
|
2008-01-26 18:03:06 +03:00
|
|
|
|
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
|
2008-01-26 18:03:06 +03:00
|
|
|
|
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)
|
|
|
|
|
2007-03-26 08:48:00 +04:00
|
|
|
.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
|
2007-03-26 08:48:00 +04:00
|
|
|
all:
|
|
|
|
|
2009-10-26 00:05:55 +03:00
|
|
|
MAKEFILES=.depend
|
2007-03-26 08:48:00 +04:00
|
|
|
.c.depend:
|
2007-04-23 10:29:02 +04:00
|
|
|
echo MKDEP $<
|
2010-05-23 04:55:16 +04:00
|
|
|
[ -n "$(noisycc)" ] && echo $(MKDEP) $(COMPILE_FLAGS) $< || true
|
2010-05-22 06:52:47 +04:00
|
|
|
eval "$(MKDEP) $(COMPILE_FLAGS)" $< >>.depend
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2007-07-03 18:16:14 +04:00
|
|
|
.sh.depend .rc.depend .1.depend .awk.depend:
|
|
|
|
:
|
|
|
|
|
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-05-23 04:55:16 +04:00
|
|
|
[ -n "$(noisycc)" ] && set -x; \
|
2009-10-25 21:57:21 +03:00
|
|
|
$(FILTER) $< >$@; \
|
2007-03-26 20:57:46 +04:00
|
|
|
chmod 0755 $@
|
2009-10-13 10:40:45 +04:00
|
|
|
|
2008-12-10 02:06:10 +03:00
|
|
|
.man1.1:
|
|
|
|
echo TXT2TAGS $(BASE)$<
|
2010-05-23 04:55:16 +04:00
|
|
|
[ -n "$(noisycc)" ] && set -x; \
|
2009-10-10 00:40:33 +04:00
|
|
|
txt2tags -o- $< >$@
|
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; \
|
|
|
|
d=$$(dirname $$3); \
|
2009-10-13 23:55:17 +04:00
|
|
|
if [ ! -d $(DESTDIR)$$d ]; then echo MKDIR $$d; mkdir -p $(DESTDIR)$$d; fi; \
|
2009-10-13 10:40:45 +04:00
|
|
|
echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
|
2010-05-23 04:55:16 +04:00
|
|
|
[ -n "$(noisycc)" ] && set -x; \
|
2009-10-13 10:40:45 +04:00
|
|
|
if [ "$$dashb" = -b ]; \
|
|
|
|
then cp -f $$2 $(DESTDIR)$$3; \
|
|
|
|
else $(FILTER) <$$2 >$(DESTDIR)$$3; \
|
|
|
|
fi; \
|
|
|
|
chmod $$1 $(DESTDIR)$$3; \
|
2009-10-26 00:05:55 +03:00
|
|
|
set +x; \
|
2009-10-13 10:40:45 +04:00
|
|
|
}; _install
|
|
|
|
UNINSTALL= _uninstall() { set -e; \
|
|
|
|
echo UNINSTALL $$($(CLEANNAME) $(BASE)$$2); \
|
2010-05-23 04:55:16 +04:00
|
|
|
[ -n "$(noisycc)" ] && set -x; \
|
2009-10-13 10:40:45 +04:00
|
|
|
rm -f $(DESTDIR)$$3; \
|
|
|
|
}; _uninstall
|
|
|
|
|
2009-09-03 22:20:44 +04:00
|
|
|
.out.install:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(INSTALL) -b 0755 $< $(BIN)/$*
|
2009-09-03 22:20:44 +04:00
|
|
|
.out.uninstall:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(UNINSTALL) $< $(BIN)/$*
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
.a.install .$(SOEXT).install:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(INSTALL) -b 0644 $< $(LIBDIR)/$<
|
2008-01-24 05:45:30 +03:00
|
|
|
.a.uninstall .$(SOEXT).uninstall:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(UNINSTALL) $< $(LIBDIR)/$<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
.h.install:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(INSTALL) 0644 $< $(INCLUDE)/$<
|
2007-03-26 20:57:46 +04:00
|
|
|
.h.uninstall:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(UNINSTALL) $< $(INCLUDE)/$<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2009-09-29 04:09:38 +04:00
|
|
|
.pdf.install:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(INSTALL) -b 0644 $< $(DOC)/$<
|
2009-09-29 04:09:38 +04:00
|
|
|
.pdf.uninstall:
|
2009-10-13 10:40:45 +04:00
|
|
|
$(UNINSTALL) $< $(DOC)/$<
|
|
|
|
|
2010-05-23 18:19:07 +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):
|
2009-10-13 10:40:45 +04:00
|
|
|
$(UNINSTALL) $<
|
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
|
|
|
|