libixp

git clone git://oldgit.suckless.org/libixp/
Log | Files | Refs | LICENSE

commit 794384bcd069adb911fd31e59f103b71a93cc785
parent 6e7e6eba4610988e0e48c91992ac5b6fd3e82b0e
Author: Kris Maglione <kris@suckless.org>
Date:   Sun, 23 May 2010 12:50:06 -0400

Sync makefiles with wmii.

Diffstat:
Makefile | 4++--
cmd/Makefile | 10+++++-----
examples/Makefile | 10+++++-----
include/Makefile | 6+++---
lib/libixp/Makefile | 2+-
lib/libixp_pthread/Makefile | 6+++---
lib/libixp_rubythread/Makefile | 8++++----
lib/libixp_task/Makefile | 8++++----
man/Makefile | 6+++---
mk/common.mk | 26++++++++++++++++----------
mk/dir.mk | 4++--
mk/gcc.mk | 5++---
mk/hdr.mk | 134+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
mk/ixp.mk | 4+++-
mk/lib.mk | 6+++---
mk/man.mk | 6++++--
mk/many.mk | 10+++++-----
mk/one.mk | 4++--
mk/so.mk | 4++--
19 files changed, 149 insertions(+), 114 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,10 +1,10 @@ ROOT=. -include ${ROOT}/mk/hdr.mk +include $(ROOT)/mk/hdr.mk DIRS = lib \ cmd \ include \ man -include ${ROOT}/mk/dir.mk +include $(ROOT)/mk/dir.mk diff --git a/cmd/Makefile b/cmd/Makefile @@ -1,10 +1,10 @@ ROOT=.. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk -LDLIBS = -L${ROOT}/lib -lixp +LDLIBS = -L$(ROOT)/lib -lixp TARG = ixpc -LIB = ${ROOT}/lib/libixp.a +LIB = $(ROOT)/lib/libixp.a -include ${ROOT}/mk/many.mk +include $(ROOT)/mk/many.mk diff --git a/examples/Makefile b/examples/Makefile @@ -1,10 +1,10 @@ ROOT=.. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk -LDFLAGS += -L${ROOT}/lib -lixp +LDFLAGS += -L$(ROOT)/lib -lixp TARG = ixpsrv -LIB = ${ROOT}/lib/libixp.a +LIB = $(ROOT)/lib/libixp.a -include ${ROOT}/mk/many.mk +include $(ROOT)/mk/many.mk diff --git a/include/Makefile b/include/Makefile @@ -1,9 +1,9 @@ ROOT= .. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk HFILES = ixp.h \ ixp_srvutil.h -install: ${HFILES:.h=.install} +install: $(HFILES:.h=.install) diff --git a/lib/libixp/Makefile b/lib/libixp/Makefile @@ -19,5 +19,5 @@ OBJ = client \ transport \ util -include ${ROOT}/mk/lib.mk +include $(ROOT)/mk/lib.mk diff --git a/lib/libixp_pthread/Makefile b/lib/libixp_pthread/Makefile @@ -1,10 +1,10 @@ ROOT= ../.. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk TARG = libixp_pthread OBJ = thread_pthread -include ${ROOT}/mk/lib.mk +include $(ROOT)/mk/lib.mk diff --git a/lib/libixp_rubythread/Makefile b/lib/libixp_rubythread/Makefile @@ -1,11 +1,11 @@ ROOT= ../.. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk -CFLAGS += ${RUBYINC} +CFLAGS += $(RUBYINC) TARG = libixp_rubythread OBJ = thread_ruby -include ${ROOT}/mk/lib.mk +include $(ROOT)/mk/lib.mk diff --git a/lib/libixp_task/Makefile b/lib/libixp_task/Makefile @@ -1,11 +1,11 @@ ROOT= ../.. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk -CFLAGS += ${TASKINC} +CFLAGS += $(TASKINC) TARG = libixp_task OBJ = thread_task -include ${ROOT}/mk/lib.mk +include $(ROOT)/mk/lib.mk diff --git a/man/Makefile b/man/Makefile @@ -1,7 +1,7 @@ ROOT=.. -include ${ROOT}/mk/hdr.mk -include ${ROOT}/mk/ixp.mk +include $(ROOT)/mk/hdr.mk +include $(ROOT)/mk/ixp.mk TARG = ixpc.1 -include ${ROOT}/mk/man.mk +include $(ROOT)/mk/man.mk diff --git a/mk/common.mk b/mk/common.mk @@ -1,12 +1,21 @@ all: -install: all +install: all simpleinstall +uninstall: simpleuninstall -MANDIRS=$(MAN)/man1 -mkdirs: - for i in $(BIN) $(ETC) $(LIBDIR) $(MANDIRS) $(INCLUDE); do \ - test -d $(DESTDIR)$$i || echo MKDIR $$i; \ - mkdir -pm 0755 $(DESTDIR)$$i; \ +DOCDIR = $(DOC) +simpleinstall: + for f in $(DOCS); do \ + $(INSTALL) 0644 $$f $(DOCDIR)/$$f; \ + done + for f in $(TEXT); do \ + $(INSTALL) 0644 $$f $(DIR)/$$f; \ + done + for f in $(BINARY); do \ + $(INSTALL) -b 0644 $$f $(DIR)/$$f; \ + done + for f in $(EXECS); do \ + $(INSTALL) -b 0755 $$f $(DIR)/$$f; \ done cleandep: @@ -21,8 +30,5 @@ tags: echo CTAGS $$files $(TAGFILES) || \ ctags $$files $(TAGFILES) -DEP:=${shell if test -f .depend;then echo .depend;else echo /dev/null; fi} -DEP!=echo /dev/null -include $(DEP) - .PHONY: all options clean dist install uninstall depend cleandep tags +.PHONY: simpleuninstall simpleinstall diff --git a/mk/dir.mk b/mk/dir.mk @@ -1,8 +1,8 @@ MKSUBDIR = \ set -e; \ - targ=`echo $@ |sed 's/^d//'`; \ + targ=$@; targ=$${targ\#d}; \ for i in $$dirs; do \ - export BASE=$(BASE)$$i/; \ + export $(SUBMAKE_EXPORT) BASE=$(BASE)$$i/; \ if [ ! -d $$i ]; then \ echo Skipping nonexistent directory: $$i 1>&2; \ else \ diff --git a/mk/gcc.mk b/mk/gcc.mk @@ -5,11 +5,10 @@ DEBUGCFLAGS = \ -fno-inline \ -fno-omit-frame-pointer \ -fno-optimize-sibling-calls \ - -fno-unroll-loops \ - -DIXPlint + -fno-unroll-loops CFLAGS += \ -std=c99 \ - -pedantic \ + -pedantic-errors \ -pipe \ -fno-strict-aliasing \ -Wall \ diff --git a/mk/hdr.mk b/mk/hdr.mk @@ -1,12 +1,33 @@ +DIR = +DIRS = +DOC = +DOCDIR = +DOCS = +EXECS = +HFILES = +INCLUDES = +LIB = +LIBS = +OBJ = +OFILES = +OFILES_PIC = +PACKAGES = +PROG = +SO = +TAGFILES = +TARG = +TEXT = + FILTER = cat 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)" +COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS) $$(pkg-config --cflags $(PACKAGES)) +COMPILE = $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS)" +COMPILEPIC = $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS) $(SOCFLAGS)" -LINK = $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(LDFLAGS)" -LINKSO = $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(SOLDFLAGS) $(SHARED)" +LINK = $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(LDFLAGS) $(LIBS)" +LINKSO = $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(SOLDFLAGS) $(LIBS) $(SHARED)" CLEANNAME=$(ROOT)/util/cleanname @@ -17,14 +38,6 @@ CTAGS=ctags 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) - # 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. @@ -34,13 +47,23 @@ BINSH := $(shell \ else echo /bin/sh; fi) BINSH != echo /bin/sh +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) + .SILENT: .SUFFIXES: .out .o .o_pic .c .pdf .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean all: +MAKEFILES=.depend .c.depend: echo MKDEP $< - $(MKDEP) $(EXCFLAGS) $(CFLAGS) $< >>.depend + [ -n "$(noisycc)" ] && echo $(MKDEP) $(COMPILE_FLAGS) $< || true + eval "$(MKDEP) $(COMPILE_FLAGS)" $< >>.depend .sh.depend .rc.depend .1.depend .awk.depend: : @@ -53,64 +76,68 @@ all: .o.out: $(LINK) $@ $< .c.out: - $(COMPILE) ${<:.c=.o} $< - $(LINK) $@ ${<:.c=.o} + $(COMPILE) $(<:.c=.o) $< + $(LINK) $@ $(<:.c=.o) -.sh.out: - echo FILTER $(BASE)$< - $(FILTER) $< >$@ - sh -n $@ - chmod 0755 $@ -.rc.out .awk.out: +.rc.out .awk.out .sh.out: echo FILTER $(BASE)$< - $(FILTER) $< >$@ + [ -n "$(<:%.sh=)" ] || $(BINSH) -n $< + set -e; \ + [ -n "$(noisycc)" ] && set -x; \ + $(FILTER) $< >$@; \ chmod 0755 $@ + .man1.1: echo TXT2TAGS $(BASE)$< + [ -n "$(noisycc)" ] && set -x; \ 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; \ + set +x; \ + }; _install +UNINSTALL= _uninstall() { set -e; \ + echo UNINSTALL $$($(CLEANNAME) $(BASE)$$2); \ + [ -n "$(noisycc)" ] && set -x; \ + rm -f $(DESTDIR)$$3; \ + }; _uninstall + .out.install: - echo INSTALL $$($(CLEANNAME) $(BASE)$*) - cp -f $< $(DESTDIR)$(BIN)/$* - chmod 0755 $(DESTDIR)$(BIN)/$* + $(INSTALL) -b 0755 $< $(BIN)/$* .out.uninstall: - echo UNINSTALL $$($(CLEANNAME) $(BASE)$*) - rm -f $(DESTDIR)$(BIN)/$* + $(UNINSTALL) $< $(BIN)/$* .a.install .$(SOEXT).install: - echo INSTALL $$($(CLEANNAME) $(BASE)$<) - cp -f $< $(DESTDIR)$(LIBDIR)/$< - chmod 0644 $(DESTDIR)$(LIBDIR)/$< + $(INSTALL) -b 0644 $< $(LIBDIR)/$< .a.uninstall .$(SOEXT).uninstall: - echo UNINSTALL $$($(CLEANNAME) $(BASE)$<) - rm -f $(DESTDIR)$(LIBDIR)/$< + $(UNINSTALL) $< $(LIBDIR)/$< .h.install: - echo INSTALL $$($(CLEANNAME) $(BASE)$<) - cp -f $< $(DESTDIR)$(INCLUDE)/$< - chmod 0644 $(DESTDIR)$(INCLUDE)/$< + $(INSTALL) 0644 $< $(INCLUDE)/$< .h.uninstall: - echo UNINSTALL $$($(CLEANNAME) $(BASE)$<) - rm -f $(DESTDIR)$(INCLUDE)/$< + $(UNINSTALL) $< $(INCLUDE)/$< .pdf.install: - echo INSTALL $$($(CLEANNAME) $(BASE)$<) - cp -f $< $(DESTDIR)$(DOC)/$< - chmod 0644 $(DESTDIR)$(DOC)/$< + $(INSTALL) -b 0644 $< $(DOC)/$< .pdf.uninstall: - echo UNINSTALL $$($(CLEANNAME) $(BASE)$<) - rm -f $(DESTDIR)$(DOC)/$< + $(UNINSTALL) $< $(DOC)/$< -.1.install: - set -e; \ - man=1; \ - path="$(MAN)/man$$man/$*.$$man"; \ - echo INSTALL man $$($(CLEANNAME) "$(BASE)/$*($$man)"); \ - $(FILTER) <"$<" >$(DESTDIR)"$$path"; \ - chmod 0644 $(DESTDIR)"$$path" -.1.uninstall: - echo UNINSTALL man $$($(CLEANNAME) $*'(1)') - rm -f $(DESTDIR)$(MAN)/man1/$< +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) $< .out.clean: echo CLEAN $$($(CLEANNAME) $(BASE)$<) @@ -121,9 +148,8 @@ all: rm -f $< || true 2>/dev/null printinstall: -mkdirs: clean: -install: printinstall mkdirs +install: printinstall depend: cleandep include $(ROOT)/mk/common.mk diff --git a/mk/ixp.mk b/mk/ixp.mk @@ -1,5 +1,7 @@ VERSION = 0.5 +COPYRIGHT = ©2010 Kris Maglione + $(ROOT)/include/ixp.h: $(ROOT)/config.mk -CFLAGS += '-DVERSION=\"$(VERSION)\"' -D_XOPEN_SOURCE=600 +CFLAGS += '-DVERSION=\"$(VERSION)\"' '-DCOPYRIGHT=\"$(COPYRIGHT)\"' diff --git a/mk/lib.mk b/mk/lib.mk @@ -1,13 +1,13 @@ PTARG = $(ROOT)/lib/$(TARG) LIB = $(PTARG).a -OFILES = ${OBJ:=.o} +OFILES = $(OBJ:=.o) all: $(HFILES) $(LIB) install: $(PTARG).install uninstall: $(PTARG).uninstall clean: libclean -depend: ${OBJ:=.depend} +depend: $(OBJ:=.depend) libclean: for i in $(LIB) $(OFILES); do \ @@ -26,7 +26,7 @@ $(LIB): $(OFILES) $(AR) $@ $(OFILES) SOMKSH=case "$(MAKESO)" in 1|[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]) echo $(ROOT)/mk/so.mk;; *) echo /dev/null;; esac -SOMK:=${shell $(SOMKSH)} +SOMK:=$(shell $(SOMKSH)) SOMK!=$(SOMKSH) include $(SOMK) diff --git a/mk/man.mk b/mk/man.mk @@ -1,5 +1,7 @@ -install: ${TARG:.1=.install} -uninstall: ${TARG:.1=.uninstall} + +all: $(TARG) +install: $(TARG:.1=.install) +uninstall: $(TARG:.1=.uninstall) printinstall: echo 'Install directories:' diff --git a/mk/many.mk b/mk/many.mk @@ -1,10 +1,10 @@ -PROGS = ${TARG:=.out} +PROGS = $(TARG:=.out) all: $(OFILES) $(PROGS) -install: ${TARG:=.install} -uninstall: ${TARG:=.uninstall} -depend: ${OFILES:.o=.depend} ${TARG:=.depend} +install: $(TARG:=.install) +uninstall: $(TARG:=.uninstall) +depend: $(OFILES:.o=.depend) $(TARG:=.depend) clean: manyclean printinstall: @@ -12,7 +12,7 @@ printinstall: echo ' Bin: $(BIN)' manyclean: - for i in ${TARG:=.o} ${TARG:=.out} $(OFILES); do \ + for i in $(TARG:=.o) $(TARG:=.out) $(OFILES); do \ [ -e $$i ] && \ echo CLEAN $$($(CLEANNAME) $(BASE)$$i); \ rm -f $$i; \ diff --git a/mk/one.mk b/mk/one.mk @@ -1,12 +1,12 @@ PROG = $(TARG).out -OFILES = ${OBJ:=.o} +OFILES = $(OBJ:=.o) all: $(PROG) install: $(TARG).install uninstall: $(TARG).uninstall clean: oneclean -depend: ${OBJ:=.depend} +depend: $(OBJ:=.depend) printinstall: echo 'Install directories:' diff --git a/mk/so.mk b/mk/so.mk @@ -1,14 +1,14 @@ SOPTARG = $(ROOT)/lib/$(TARG) SO = $(SOPTARG).$(SOEXT) SONAME = $(TARG).$(SOEXT) -OFILES_PIC = ${OBJ:=.o_pic} +OFILES_PIC = $(OBJ:=.o_pic) all: $(HFILES) $(SO) install: $(SOPTARG).install uninstall: $(SOPTARG).uninstall clean: soclean -depend: ${OBJ:=.depend} +depend: $(OBJ:=.depend) soclean: for i in $(SO) $(OFILES_PIC); do \