[hackers] [swk] use config.def.mk to cache build options || pancake

From: <hg_AT_suckless.org>
Date: Wed, 18 Aug 2010 21:33:42 +0000 (UTC)

changeset: 55:dc5cdef1af18
tag: tip
user: pancake <pancake_AT_nopcode.org>
date: Wed Aug 18 23:30:10 2010 +0200
files: Makefile README config.def.mk
description:
use config.def.mk to cache build options
simplify readme

diff -r 380acd1537c4 -r dc5cdef1af18 Makefile
--- a/Makefile Wed Aug 18 20:14:28 2010 +0200
+++ b/Makefile Wed Aug 18 23:30:10 2010 +0200
@@ -1,13 +1,8 @@
 .PHONY: all t clean install
-CC?=gcc
-CFLAGS?=-Wall -g -std=c99
+
+-include config.mk
+
 VERSION=0.1
-DESTDIR?=
-PREFIX?=${DESTDIR}/usr/local
-INCDIR?=${PREFIX}/include
-LIBDIR?=${PREFIX}/lib
-CFLAGS+=-I.
-
 # graphic backend
 GI?=sdl
 ifeq (${GI},sdl)
@@ -21,20 +16,23 @@
 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 @@
 
 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 -r 380acd1537c4 -r dc5cdef1af18 README
--- a/README Wed Aug 18 20:14:28 2010 +0200
+++ b/README Wed Aug 18 23:30:10 2010 +0200
@@ -3,16 +3,12 @@
 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 -r 380acd1537c4 -r dc5cdef1af18 config.def.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config.def.mk Wed Aug 18 23:30:10 2010 +0200
@@ -0,0 +1,7 @@
+CC?=gcc
+CFLAGS?=-Wall -g -std=c99
+DESTDIR?=
+PREFIX?=${DESTDIR}/usr/local
+INCDIR?=${PREFIX}/include
+LIBDIR?=${PREFIX}/lib
+CFLAGS+=-I.
Received on Wed Aug 18 2010 - 23:33:42 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 18 2010 - 23:36:03 CEST