From 6e54af68313ffadfd72c1a7b348195ff74c2b49d Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 26 Mar 2007 12:57:46 -0400 Subject: [PATCH] Fix build for gmake. Add uninstall target. Fix if statement with no command. --- cmd/Makefile | 10 ++++++---- cmd/wmii/Makefile | 2 ++ cmd/wmii/area.c | 5 ++++- cmd/wmii/bar.c | 4 +++- cmd/wmii/client.c | 5 ++++- cmd/wmii/column.c | 4 +++- cmd/wmii/draw.c | 5 ++++- cmd/wmii/event.c | 5 ++++- cmd/wmii/frame.c | 4 +++- cmd/wmii/fs.c | 5 ++++- cmd/wmii/geom.c | 5 ++++- cmd/wmii/key.c | 4 +++- cmd/wmii/main.c | 6 +++++- cmd/wmii/mouse.c | 4 +++- cmd/wmii/printevent.c | 4 +++- cmd/wmii/rule.c | 4 +++- cmd/wmii/view.c | 5 ++++- include/util.h | 23 +++++++++++++++++++++++ man/Makefile | 2 +- mk/common.mk | 1 + mk/dir.mk | 7 +++++++ mk/hdr.mk | 33 ++++++++++++++++++++++++++------- mk/lib.mk | 1 + mk/man.mk | 1 + mk/many.mk | 7 ++++--- mk/one.mk | 1 + util/compile | 2 +- 27 files changed, 128 insertions(+), 31 deletions(-) diff --git a/cmd/Makefile b/cmd/Makefile index 2b125d3e..c2b63b10 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -2,6 +2,8 @@ ROOT=.. include ${ROOT}/mk/hdr.mk include ${ROOT}/mk/wmii.mk +wmiir.c: ${ROOT}/mk/wmii.mk + DIRS = wmii TARG = wmii9menu \ wmii9rc \ @@ -10,7 +12,7 @@ TARG = wmii9menu \ wmiistartrc OFILES = util.o -FILTER = sed "s|CONFPREFIX|${CONFPREFIX}|g; \ +FILTER = sed "s|CONFPREFIX|${MAN}|g; \ s|CONFVERSION|${CONFVERSION}|g; \ s|P9PATHS|${P9PATHS}|g; \ s|AWKPATH|${AWKPATH}|g" @@ -18,10 +20,10 @@ FILTER = sed "s|CONFPREFIX|${CONFPREFIX}|g; \ include ${ROOT}/mk/many.mk include ${ROOT}/mk/dir.mk -OWMIIR=${OFILES} ${LIBIXP} +OWMIIR=wmiir.o ${OFILES} ${LIBIXP} wmiir.O: ${OWMIIR} - ${LINK} $@ ${STATIC} $*.o ${OWMIIR} + ${LINK} $@ ${STATIC} ${OWMIIR} EXCFLAGS=${INCX11} -wmii9menu.O: +wmii9menu.O: wmii9menu.o ${LINK} $@ $*.o ${LIBX11} diff --git a/cmd/wmii/Makefile b/cmd/wmii/Makefile index a4ac73c2..f5d0de4a 100644 --- a/cmd/wmii/Makefile +++ b/cmd/wmii/Makefile @@ -2,6 +2,8 @@ ROOT= ../.. include ${ROOT}/mk/hdr.mk include ${ROOT}/mk/wmii.mk +main.c: ${ROOT}/mk/wmii.mk + TARG = wmii LIB = ${LIBIXP} diff --git a/cmd/wmii/area.c b/cmd/wmii/area.c index 254b2f3d..f408141a 100644 --- a/cmd/wmii/area.c +++ b/cmd/wmii/area.c @@ -5,8 +5,11 @@ #include #include #include +#include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" static void place_frame(Frame *f); diff --git a/cmd/wmii/bar.c b/cmd/wmii/bar.c index 66534b5a..c9a42e13 100644 --- a/cmd/wmii/bar.c +++ b/cmd/wmii/bar.c @@ -3,7 +3,9 @@ * See LICENSE file for license details. */ #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" Bar *free_bars = nil; diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c index 08fc6fc7..4b7e5f3f 100644 --- a/cmd/wmii/client.c +++ b/cmd/wmii/client.c @@ -3,9 +3,12 @@ * See LICENSE file for license details. */ #include +#include #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" static void update_client_name(Client *c); diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c index 46598186..53be479a 100644 --- a/cmd/wmii/column.c +++ b/cmd/wmii/column.c @@ -4,7 +4,9 @@ */ #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" char * str_of_column_mode(int mode) { diff --git a/cmd/wmii/draw.c b/cmd/wmii/draw.c index 5e4bab10..bca15e5c 100644 --- a/cmd/wmii/draw.c +++ b/cmd/wmii/draw.c @@ -2,8 +2,11 @@ * See LICENSE file for license details. */ #include +#include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" uint textwidth_l(BlitzFont *font, char *text, uint len) { diff --git a/cmd/wmii/event.c b/cmd/wmii/event.c index 59ba455b..c10494ec 100644 --- a/cmd/wmii/event.c +++ b/cmd/wmii/event.c @@ -2,8 +2,11 @@ * Copyright ©2006-2007 Kris Maglione * See LICENSE file for license details. */ +#include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" #include "printevent.h" void diff --git a/cmd/wmii/frame.c b/cmd/wmii/frame.c index f209afd4..af5e6161 100644 --- a/cmd/wmii/frame.c +++ b/cmd/wmii/frame.c @@ -1,7 +1,9 @@ /* Copyright ©2006-2007 Kris Maglione * See LICENSE file for license details. */ -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" Frame * create_frame(Client *c, View *v) { diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c index 212aa499..ea8dd572 100644 --- a/cmd/wmii/fs.c +++ b/cmd/wmii/fs.c @@ -3,10 +3,13 @@ */ #include #include +#include #include #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" /* Datatypes: */ diff --git a/cmd/wmii/geom.c b/cmd/wmii/geom.c index 9a63ba0a..187e65a5 100644 --- a/cmd/wmii/geom.c +++ b/cmd/wmii/geom.c @@ -1,7 +1,10 @@ /* Copyright ©2004-2006 Anselm R. Garbe * See LICENSE file for license details. */ -#include "wmii.h" +#include +#include +#include "dat.h" +#include "fns.h" Bool ptinrect(int x, int y, XRectangle * r) { diff --git a/cmd/wmii/key.c b/cmd/wmii/key.c index 79cfd7b1..e15ec298 100644 --- a/cmd/wmii/key.c +++ b/cmd/wmii/key.c @@ -4,7 +4,9 @@ #include #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" void init_lock_keys() { diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c index f7e1cd6d..1a4032d7 100644 --- a/cmd/wmii/main.c +++ b/cmd/wmii/main.c @@ -9,12 +9,15 @@ #include #include #include +#include #include #include #include #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" static const char version[] = "wmii-"VERSION", ©2007 Kris Maglione\n"; @@ -568,6 +571,7 @@ main(int argc, char *argv[]) { check_x_event(nil); errstr = ixp_serverloop(&srv); if(errstr) + fprintf(stderr, "%s: error: %s\n", argv0, errstr); cleanup(); XCloseDisplay(blz.dpy); diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c index 41069497..eb5fde41 100644 --- a/cmd/wmii/mouse.c +++ b/cmd/wmii/mouse.c @@ -3,7 +3,9 @@ */ #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" enum { ButtonMask = diff --git a/cmd/wmii/printevent.c b/cmd/wmii/printevent.c index 2d2df2cd..a798b1e0 100644 --- a/cmd/wmii/printevent.c +++ b/cmd/wmii/printevent.c @@ -46,7 +46,9 @@ can get it touch with me at the following location: #include #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" #include "printevent.h" static char* sep = " "; diff --git a/cmd/wmii/rule.c b/cmd/wmii/rule.c index 1e243ca3..6370d683 100644 --- a/cmd/wmii/rule.c +++ b/cmd/wmii/rule.c @@ -5,7 +5,9 @@ #include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" /* basic rule matching language /regex/ -> value * regex might contain POSIX regex syntax defined in regex(3) */ diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c index ed6ce18f..16ef263b 100644 --- a/cmd/wmii/view.c +++ b/cmd/wmii/view.c @@ -3,8 +3,11 @@ * See LICENSE file for license details. */ #include +#include #include -#include "wmii.h" +#include +#include "dat.h" +#include "fns.h" static Bool is_empty(View *v) { diff --git a/include/util.h b/include/util.h index 89eb5026..1d8072b4 100644 --- a/include/util.h +++ b/include/util.h @@ -1,3 +1,26 @@ +#define nil ((void*)0) +#define nelem(ary) (sizeof(ary) / sizeof(*ary)) + +/* Types */ +#undef uchar +#undef ushort +#undef uint +#undef ulong +#undef uvlong +#undef vlong +#define uchar _wmiiuchar +#define ushort _wmiiushort +#define uint _wmiiuint +#define ulong _wmiiulong +#define vlong _wmiivlong +#define uvlong _wmiiuvlong +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef unsigned long long uvlong; +typedef long long vlong; + #define strlcat wmii_strlcat /* util.c */ uint tokenize(char *res[], uint reslen, char *str, char delim); diff --git a/man/Makefile b/man/Makefile index c23ab7ad..8ddffdca 100644 --- a/man/Makefile +++ b/man/Makefile @@ -6,7 +6,7 @@ TARG = wmii.1 \ wmiir.1 \ wmiiwm.1 -FILTER = sed "s|CONFPREFIX|${CONFPREFIX}|g; \ +FILTER = sed "s|CONFPREFIX|${MAN}|g; \ s|CONFVERSION|${CONFVERSION}|g; \ s|P9PATHS|${P9PATHS}|g; \ s|AWKPATH|${AWKPATH}|g" diff --git a/mk/common.mk b/mk/common.mk index 908f4456..7f0325df 100644 --- a/mk/common.mk +++ b/mk/common.mk @@ -11,6 +11,7 @@ mkdirs: done install: ${HFILES:.h=.install} +uninstall: ${HFILES:.h=.uninstall} cleandep: rm .depend 2>/dev/null || true diff --git a/mk/dir.mk b/mk/dir.mk index 2f238fdf..79bc5d28 100644 --- a/mk/dir.mk +++ b/mk/dir.mk @@ -16,6 +16,12 @@ dinstall: echo MAKE install ${BASE}$$i/; \ (cd $$i && ${MAKE} BASE="${BASE}$$i/" install) || exit $?; \ done +duninstall: + for i in ${DIRS}; do \ + if [ ! -d $$i ]; then echo Skipping nonexistent directory: $$i 1>&2; continue; fi; \ + echo MAKE uninstall ${BASE}$$i/; \ + (cd $$i && ${MAKE} BASE="${BASE}$$i/" uninstall) || exit $?; \ + done ddepend: for i in ${DIRS}; do \ if [ ! -d $$i ]; then echo Skipping nonexistent directory: $$i 1>&2; continue; fi; \ @@ -26,4 +32,5 @@ ddepend: all: dall clean: dclean install: dinstall +uninstall: duninstall depend: ddepend diff --git a/mk/hdr.mk b/mk/hdr.mk index 4959763c..7f4b114d 100644 --- a/mk/hdr.mk +++ b/mk/hdr.mk @@ -1,47 +1,66 @@ .SILENT: -.SUFFIXES: .O .o .c .sh .rc .awk .1 .depend .install .clean +.SUFFIXES: .O .o .c .sh .rc .awk .1 .depend .install .uninstall .clean all: -.c.o: - ${COMPILE} $@ $< - .c.depend: ${DEPEND} $< >>.depend +.c.o: + ${COMPILE} $@ $< + .o.O: ${LINK} $@ $< +.c.O: + ${COMPILE} $@ $< + ${LINK} $@ $< + .awk.O: echo FILTER ${BASE}$< ${FILTER} $< >$@ + chmod 0755 $@ .rc.O: echo FILTER ${BASE}$< ${FILTER} $< >$@ + chmod 0755 $@ .sh.O: echo FILTER ${BASE}$< ${FILTER} $< >$@ + chmod 0755 $@ .O.install: - echo INSTALL $* + echo INSTALL ${BASE}$* cp -f $< ${BIN}/$* chmod 0755 ${BIN}/$* +.O.uninstall: + echo UNINSTALL ${BASE}$* + rm -f ${BIN}/$* .a.install: - echo INSTALL $< + echo INSTALL ${BASE}$< cp -f $< ${LIBDIR}/$< chmod 0644 ${LIBDIR}/$< +.a.uninstall: + echo UNINSTALL ${BASE}$< + rm -f ${LIBDIR}/$< .h.install: - echo INSTALL $< + echo INSTALL ${BASE}$< cp -f $< ${INCLUDE}/$< chmod 0644 ${INCLUDE}/$< +.h.uninstall: + echo UNINSTALL ${BASE}$< + rm -f ${INCLUDE}/$< .1.install: echo INSTALL man $*'(1)' ${FILTER} $< >${MAN}/man1/$< chmod 0644 ${MAN}/man1/$< +.1.uninstall: + echo UNINSTALL man $*'(1)' + rm -f ${MAN}/man1/$< .O.clean: rm $< || true 2>/dev/null diff --git a/mk/lib.mk b/mk/lib.mk index 4bb7675d..ad403c76 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -4,6 +4,7 @@ OFILES = ${OBJ:=.o} all: ${HFILES} ${LIB} install: ${TARG}.install +uninstall: ${TARG}.uninstall clean: libclean depend: ${OBJ:=.depend} diff --git a/mk/man.mk b/mk/man.mk index a1a5de11..635cf218 100644 --- a/mk/man.mk +++ b/mk/man.mk @@ -1,4 +1,5 @@ install: ${TARG:.1=.install} +uninstall: ${TARG:.1=.uninstall} printinstall: echo 'Install directories:' diff --git a/mk/many.mk b/mk/many.mk index 48471a01..44d74ab0 100644 --- a/mk/many.mk +++ b/mk/many.mk @@ -1,8 +1,9 @@ PROGS = ${TARG:=.O} -all: ${PROGS} +all: ${OFILES} ${PROGS} install: ${TARG:=.install} +uninstall: ${TARG:=.uninstall} clean: manyclean printinstall: @@ -10,8 +11,8 @@ printinstall: echo ' Bin: ${BIN}' manyclean: - for i in ${TARG}; do \ - rm $$i.o; rm $$i.O; \ + for i in ${TARG:=.o} ${TARG:=.O} ${OFILES}; do \ + rm $$i; \ done 2>/dev/null || true include ${ROOT}/mk/common.mk diff --git a/mk/one.mk b/mk/one.mk index 17895a3c..38259dad 100644 --- a/mk/one.mk +++ b/mk/one.mk @@ -4,6 +4,7 @@ OFILES = ${OBJ:=.o} all: ${PROG} install: ${TARG}.install +uninstall: ${TARG}.uninstall clean: oneclean depend: ${OBJ:=.depend} diff --git a/util/compile b/util/compile index 00790d9e..751494a2 100755 --- a/util/compile +++ b/util/compile @@ -11,7 +11,7 @@ $CC -o $outfile $CFLAGS $@ 2>$xtmp status=$? cat $xtmp \ -| egrep -v ': error: .Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|In file included from| from|use of C99 long long|ISO C forbids conversion' \ +| egrep -v ': error: .Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|use of C99 long long|ISO C forbids conversion' \ | sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' \ | uniq 1>&2