2008-01-26 18:03:06 +03:00
|
|
|
FILTER = cat
|
|
|
|
EXCFLAGS = -I$$(echo $(INCPATH)|sed 's/:/ -I/g') -D_XOPEN_SOURCE=600
|
2009-05-21 22:22:58 +04:00
|
|
|
COMPILE= CC="$(CC)" CFLAGS="$(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES))" $(ROOT)/util/compile
|
|
|
|
COMPILEPIC= CC="$(CC)" CFLAGS="$(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES)) $(SOCFLAGS)" $(ROOT)/util/compile
|
|
|
|
LINK= LD="$(LD)" LDFLAGS="$(LDFLAGS) $$(pkg-config --libs $(PACKAGES))" $(ROOT)/util/link
|
|
|
|
LINKSO= LD="$(LD)" LDFLAGS="$(SOLDFLAGS) $(SHARED) $$(pkg-config --libs $(PACKAGES))" $(ROOT)/util/link
|
2008-01-26 18:03:06 +03:00
|
|
|
CLEANNAME=$(ROOT)/util/cleanname
|
|
|
|
SOEXT=so
|
|
|
|
|
2009-05-21 22:22:58 +04:00
|
|
|
PACKAGES = 2>/dev/null
|
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
include $(ROOT)/config.mk
|
|
|
|
|
|
|
|
# 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)
|
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
|
|
|
|
# usually bash on Linux, which means, it's painfully slow.
|
|
|
|
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
|
|
|
|
2007-03-26 08:48:00 +04:00
|
|
|
.SILENT:
|
2008-02-10 01:43:52 +03:00
|
|
|
.SUFFIXES: .O .o .o_pic .c .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean
|
2007-03-26 08:48:00 +04:00
|
|
|
all:
|
|
|
|
|
|
|
|
.c.depend:
|
2007-04-23 10:29:02 +04:00
|
|
|
echo MKDEP $<
|
2008-01-27 05:13:42 +03:00
|
|
|
$(MKDEP) $(EXCFLAGS) $(CFLAGS) $< >>.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
|
|
|
|
2007-03-26 08:48:00 +04:00
|
|
|
.o.O:
|
2008-01-18 01:50:35 +03:00
|
|
|
$(LINK) $@ $<
|
2007-03-26 20:57:46 +04:00
|
|
|
.c.O:
|
2008-02-09 02:17:08 +03:00
|
|
|
$(COMPILE) ${<:.c=.o} $<
|
|
|
|
$(LINK) $@ ${<:.c=.o}
|
2008-01-18 01:50:35 +03:00
|
|
|
|
2008-01-20 02:05:50 +03:00
|
|
|
.sh.O:
|
|
|
|
echo FILTER $(BASE)$<
|
|
|
|
$(FILTER) $< >$@
|
|
|
|
sh -n $@
|
|
|
|
chmod 0755 $@
|
|
|
|
.rc.O .awk.O:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo FILTER $(BASE)$<
|
|
|
|
$(FILTER) $< >$@
|
2007-03-26 20:57:46 +04:00
|
|
|
chmod 0755 $@
|
2008-12-10 02:06:10 +03:00
|
|
|
.man1.1:
|
|
|
|
echo TXT2TAGS $(BASE)$<
|
|
|
|
txt2tags -o- $< | $(FILTER) >$@
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
.O.install:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo INSTALL $$($(CLEANNAME) $(BASE)$*)
|
2008-12-11 02:04:00 +03:00
|
|
|
cp -f $< $(DESTDIR)$(BIN)/$*
|
|
|
|
chmod 0755 $(DESTDIR)$(BIN)/$*
|
2007-03-26 20:57:46 +04:00
|
|
|
.O.uninstall:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo UNINSTALL $$($(CLEANNAME) $(BASE)$*)
|
2008-12-11 02:04:00 +03:00
|
|
|
rm -f $(DESTDIR)$(BIN)/$*
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2008-01-26 18:03:06 +03:00
|
|
|
.a.install .$(SOEXT).install:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo INSTALL $$($(CLEANNAME) $(BASE)$<)
|
2008-12-11 02:04:00 +03:00
|
|
|
cp -f $< $(DESTDIR)$(LIBDIR)/$<
|
|
|
|
chmod 0644 $(DESTDIR)$(LIBDIR)/$<
|
2008-01-24 05:45:30 +03:00
|
|
|
.a.uninstall .$(SOEXT).uninstall:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo UNINSTALL $$($(CLEANNAME) $(BASE)$<)
|
2008-12-11 02:04:00 +03:00
|
|
|
rm -f $(DESTDIR)$(LIBDIR)/$<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
.h.install:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo INSTALL $$($(CLEANNAME) $(BASE)$<)
|
2008-12-11 02:04:00 +03:00
|
|
|
cp -f $< $(DESTDIR)$(INCLUDE)/$<
|
|
|
|
chmod 0644 $(DESTDIR)$(INCLUDE)/$<
|
2007-03-26 20:57:46 +04:00
|
|
|
.h.uninstall:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo UNINSTALL $$($(CLEANNAME) $(BASE)$<)
|
2008-12-11 02:04:00 +03:00
|
|
|
rm -f $(DESTDIR)$(INCLUDE)/$<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2008-12-10 02:06:10 +03:00
|
|
|
.1.install:
|
2008-02-10 01:43:52 +03:00
|
|
|
set -e; \
|
2008-08-25 20:47:56 +04:00
|
|
|
man=1; \
|
2008-02-10 01:43:52 +03:00
|
|
|
path="$(MAN)/man$$man/$*.$$man"; \
|
|
|
|
echo INSTALL man $$($(CLEANNAME) "$(BASE)/$*($$man)"); \
|
2008-12-11 02:04:00 +03:00
|
|
|
cp "$<" $(DESTDIR)"$$path"; \
|
|
|
|
chmod 0644 $(DESTDIR)"$$path"
|
2008-12-10 02:06:10 +03:00
|
|
|
.1.uninstall:
|
2008-01-18 01:50:35 +03:00
|
|
|
echo UNINSTALL man $$($(CLEANNAME) $*'(1)')
|
2008-12-11 02:04:00 +03:00
|
|
|
rm -f $(DESTDIR)$(MAN)/man1/$<
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
.O.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:
|
|
|
|
mkdirs:
|
|
|
|
clean:
|
|
|
|
install: printinstall mkdirs
|
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
|
|
|
|