commit 04d94badb03c95e9baca7076233804944b7d04d9
parent 335a9d46c2a40e6c0376446a579a4c0b397088e7
Author: pancake <pancake@nopcode.org>
Date: Tue, 20 Apr 2010 23:56:55 +0200
create and install .mk and pkgconfig files
fix build and clean warnings
Diffstat:
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,5 +1,6 @@
CC?=gcc
CFLAGS?=-Wall -g
+VERSION=0.1
DESTDIR?=
PREFIX?=${DESTDIR}/usr/local
LIBDIR?=${PREFIX}/lib
@@ -19,14 +20,28 @@ test: test.o libswk.a
${CC} test.o -o test libswk.a ${GI_LIBS}
clean:
- rm -f libswk.a test.o swk.o test ${GI_OBJS}
+ rm -f swk.pc swk.mk libswk.a test.o swk.o test ${GI_OBJS}
install:
+ mkdir -p ${DESTDIR}/${LIBDIR}
cp libswk.a ${DESTDIR}/${LIBDIR}
- # TODO: create pkgconfig?
+ mkdir -p ${DESTDIR}/${LIBDIR}/mk
+ cp swk.mk ${DESTDIR}/${LIBDIR}/mk/swk.mk
+ mkdir -p ${DESTDIR}/${LIBDIR}/pkgconfig
+ cp swk.pc ${DESTDIR}/${LIBDIR}/pkgconfig/swk.pc
static: libswk.a
libswk.a: swk.o ${GI_OBJS}
rm -f libswk.a
ar qcvf libswk.a swk.o ${GI_OBJS}
+ echo CFLAGS+=-I${PREFIX}/include > swk.mk
+ echo LDFLAGS+=${PREFIX}/lib/libswk.a ${GI_LIBS} >> swk.mk
+ echo prefix=${PREFIX} > swk.pc
+ echo libdir=${LIBDIR} >> swk.pc
+ echo >> swk.pc
+ echo Name: swk >> swk.pc
+ echo Version: ${VERSION} >> swk.pc
+ echo Description: simple widget kit >> swk.pc
+ echo Libs: ${PREFIX}/lib/libswk.a ${GI_LIBS} >> swk.pc
+ echo Cflags: -I${PREFIX}/include >> swk.pc
diff --git a/swk.c b/swk.c
@@ -106,6 +106,9 @@ swk_button(SwkEvent *e) {
case EExpose:
// TODO: use box position
swk_gi_rect(0, 0, 10, 10);
+ break;
+ default:
+ break;
}
}
diff --git a/test.c b/test.c
@@ -3,13 +3,13 @@
static int count = 3;
-static int mybutton(SwkEvent *e) {
+static void mybutton(SwkEvent *e) {
if (e->type == EClick) {
fprintf(stderr, "Button clicked %d\n", count);
if (count-- == 0)
swk_exit();
}
- return swk_button(e);
+ swk_button(e);
}
static SwkBox helloworld[] = {