commit 6e54af68313ffadfd72c1a7b348195ff74c2b49d
parent b0e967a3e9660ba571d1fb8e0b9a42e7d0b6f196
Author: Kris Maglione <jg@suckless.org>
Date: Mon, 26 Mar 2007 12:57:46 -0400
Fix build for gmake. Add uninstall target. Fix if statement with no command.
Diffstat:
27 files changed, 128 insertions(+), 31 deletions(-)
diff --git 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
@@ -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
@@ -5,8 +5,11 @@
#include <assert.h>
#include <math.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
static void place_frame(Frame *f);
diff --git a/cmd/wmii/bar.c b/cmd/wmii/bar.c
@@ -3,7 +3,9 @@
* See LICENSE file for license details.
*/
#include <string.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
Bar *free_bars = nil;
diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c
@@ -3,9 +3,12 @@
* See LICENSE file for license details.
*/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <X11/Xatom.h>
-#include "wmii.h"
+#include <util.h>
+#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
@@ -4,7 +4,9 @@
*/
#include <math.h>
#include <string.h>
-#include "wmii.h"
+#include <util.h>
+#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
@@ -2,8 +2,11 @@
* See LICENSE file for license details.
*/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
-#include "wmii.h"
+#include <util.h>
+#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
@@ -2,8 +2,11 @@
* Copyright ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
+#include <stdio.h>
#include <X11/keysym.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
#include "printevent.h"
void
diff --git a/cmd/wmii/frame.c b/cmd/wmii/frame.c
@@ -1,7 +1,9 @@
/* Copyright ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
-#include "wmii.h"
+#include <util.h>
+#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
@@ -3,10 +3,13 @@
*/
#include <assert.h>
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
/* Datatypes: */
diff --git a/cmd/wmii/geom.c b/cmd/wmii/geom.c
@@ -1,7 +1,10 @@
/* Copyright ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
-#include "wmii.h"
+#include <stdio.h>
+#include <util.h>
+#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
@@ -4,7 +4,9 @@
#include <string.h>
#include <stdlib.h>
#include <X11/keysym.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
void
init_lock_keys() {
diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c
@@ -9,12 +9,15 @@
#include <locale.h>
#include <pwd.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
-#include "wmii.h"
+#include <util.h>
+#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
@@ -3,7 +3,9 @@
*/
#include <stdlib.h>
#include <string.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
enum {
ButtonMask =
diff --git 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 <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xproto.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
#include "printevent.h"
static char* sep = " ";
diff --git a/cmd/wmii/rule.c b/cmd/wmii/rule.c
@@ -5,7 +5,9 @@
#include <string.h>
#include <stdlib.h>
-#include "wmii.h"
+#include <util.h>
+#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
@@ -3,8 +3,11 @@
* See LICENSE file for license details.
*/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
-#include "wmii.h"
+#include <util.h>
+#include "dat.h"
+#include "fns.h"
static Bool
is_empty(View *v) {
diff --git 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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