commit 41c901a65ffa93711e27e2484f1d7b01cfdd5be7
parent ddd21e594a8527607dfa503d3639179335182137
Author: pancake <pancake@nopcode.org>
Date: Wed, 18 Aug 2010 23:30:10 +0200
use config.def.mk to cache build options
simplify readme
Diffstat:
3 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,13 +1,8 @@
.PHONY: all t clean install
-CC?=gcc
-CFLAGS?=-Wall -g -std=c99
-VERSION=0.1
-DESTDIR?=
-PREFIX?=${DESTDIR}/usr/local
-INCDIR?=${PREFIX}/include
-LIBDIR?=${PREFIX}/lib
-CFLAGS+=-I.
+-include config.mk
+
+VERSION=0.1
# graphic backend
GI?=sdl
ifeq (${GI},sdl)
@@ -21,20 +16,23 @@ endif
GI_OBJS=gi_${GI}.o
GI_SRCS=gi_${GI}.c
-all: static shared t
+all: config.mk static shared t
-x:
+x: config.mk
make clean ; make GI=x11 && cd t ; ./test
-s:
+s: config.mk
make clean ; make GI=sdl && cd t ; ./test
-t:
+t: config.mk
cd t && ${MAKE} all
config.h:
cp config.def.h config.h
+config.mk: config.h
+ cp config.def.mk config.mk
+
clean:
echo >swk.mk
cd t && ${MAKE} clean
@@ -62,12 +60,12 @@ static: libswk.a
shared: libswk.so
-libswk.so: config.h swk.o ${GI_OBJS}
+libswk.so: config.mk swk.o ${GI_OBJS}
${CC} ${CFLAGS} -fPIC -shared swk.c ${GI_SRCS} -o libswk.so
-swk.o: config.h
+swk.o: config.mk
-libswk.a: config.h swk.o ${GI_OBJS}
+libswk.a: config.mk swk.o ${GI_OBJS}
rm -f libswk.a
ar qcvf libswk.a swk.o ${GI_OBJS}
echo SWKINCS+=-I${PREFIX}/include > swk.mk
diff --git a/README b/README
@@ -3,16 +3,12 @@ SWK - simple widget kit
swk is a minimalist widget kit with support for SDL and X11
-How to build for SDL:
----------------------
-make PREFIX=/usr
-sudo make install PREFIX=/usr
-
+How to build
+------------
+supported backends are: x11, sdl
-How to build for X11:
----------------------
-make x PREFIX=/usr
-sudo make install PREFIX=/usr
+ make GI=x11 PREFIX=/usr
+ sudo make install
Requirements
diff --git a/config.def.mk b/config.def.mk
@@ -0,0 +1,7 @@
+CC?=gcc
+CFLAGS?=-Wall -g -std=c99
+DESTDIR?=
+PREFIX?=${DESTDIR}/usr/local
+INCDIR?=${PREFIX}/include
+LIBDIR?=${PREFIX}/lib
+CFLAGS+=-I.