[hackers] [swk] create and install .mk and pkgconfig files || pancake

From: <hg_AT_suckless.org>
Date: Tue, 20 Apr 2010 22:03:27 +0000 (UTC)

changeset: 9:ac0dda7b826c
tag: tip
user: pancake <pancake_AT_nopcode.org>
date: Tue Apr 20 23:56:55 2010 +0200
files: Makefile swk.c test.c
description:
create and install .mk and pkgconfig files
fix build and clean warnings

diff -r 680faaba0568 -r ac0dda7b826c Makefile
--- a/Makefile Tue Apr 20 10:32:00 2010 +0200
+++ b/Makefile Tue Apr 20 23:56:55 2010 +0200
@@ -1,5 +1,6 @@
 CC?=gcc
 CFLAGS?=-Wall -g
+VERSION=0.1
 DESTDIR?=
 PREFIX?=${DESTDIR}/usr/local
 LIBDIR?=${PREFIX}/lib
@@ -19,14 +20,28 @@
         ${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 -r 680faaba0568 -r ac0dda7b826c swk.c
--- a/swk.c Tue Apr 20 10:32:00 2010 +0200
+++ b/swk.c Tue Apr 20 23:56:55 2010 +0200
@@ -106,6 +106,9 @@
         case EExpose:
                 // TODO: use box position
                 swk_gi_rect(0, 0, 10, 10);
+ break;
+ default:
+ break;
         }
 }
 
diff -r 680faaba0568 -r ac0dda7b826c test.c
--- a/test.c Tue Apr 20 10:32:00 2010 +0200
+++ b/test.c Tue Apr 20 23:56:55 2010 +0200
@@ -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[] = {
Received on Tue Apr 20 2010 - 22:03:27 UTC

This archive was generated by hypermail 2.2.0 : Tue Apr 20 2010 - 22:12:03 UTC