wmii/mk/hdr.mk

156 lines
3.6 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 = $(ROOT)/util/compile "$(CC)" "$(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES))"
COMPILEPIC = $(ROOT)/util/compile "$(CC)" "$(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES)) $(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
CLEANNAME=$(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
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)
2009-09-29 01:24:01 +04:00
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
.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) $(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES)) $< || true
$(MKDEP) $(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES)) $< >>.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=}" ] || sh -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=$$(dirname $$3); \
if [ ! -d $(DESTDIR)$$d ]; then echo MKDIR $$d; mkdir -p $(DESTDIR)$$d; fi; \
echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
[ -n "${noisycc}" ] && set -x; \
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; \
}; _install
UNINSTALL= _uninstall() { set -e; \
echo UNINSTALL $$($(CLEANNAME) $(BASE)$$2); \
[ -n "${noisycc}" ] && set -x; \
rm -f $(DESTDIR)$$3; \
}; _uninstall
2009-09-03 22:20:44 +04:00
.out.install:
$(INSTALL) -b 0755 $< $(BIN)/$*
2009-09-03 22:20:44 +04:00
.out.uninstall:
$(UNINSTALL) $< $(BIN)/$*
.a.install .$(SOEXT).install:
$(INSTALL) -b 0644 $< $(LIBDIR)/$<
.a.uninstall .$(SOEXT).uninstall:
$(UNINSTALL) $< $(LIBDIR)/$<
.h.install:
$(INSTALL) 0644 $< $(INCLUDE)/$<
.h.uninstall:
$(UNINSTALL) $< $(INCLUDE)/$<
2009-09-29 04:09:38 +04:00
.pdf.install:
$(INSTALL) -b 0644 $< $(DOC)/$<
2009-09-29 04:09:38 +04:00
.pdf.uninstall:
$(UNINSTALL) $< $(DOC)/$<
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