swk

static widget kit
git clone git://git.suckless.org/swk
Log | Files | Refs | README | LICENSE

Makefile (1971B)


      1 .PHONY: all t clean install
      2 
      3 -include config.mk
      4 
      5 VERSION=0.1
      6 OBJS=swk.o text.o image.o
      7 # graphic backend
      8 GI?=sdl
      9 ifeq (${GI},sdl)
     10 GI_LIBS=-lSDL -lSDL_ttf -lSDL_image
     11 CFLAGS+=-DUSE_SDL
     12 else
     13 ifeq (${GI},x11)
     14 GI_LIBS=-lX11 -ldc -lImlib2
     15 CFLAGS+=-DUSE_X11
     16 endif
     17 endif
     18 
     19 GI_OBJS=gi_${GI}.o
     20 GI_SRCS=gi_${GI}.c
     21 
     22 all: config.mk static shared t
     23 
     24 x: config.mk
     25 	make clean ; make GI=x11 && cd t ; ./test
     26 
     27 s: config.mk
     28 	make clean ; make GI=sdl && cd t ; ./test
     29 
     30 t: config.mk
     31 	cd t && ${MAKE} all
     32 
     33 config.h:
     34 	cp config.def.h config.h
     35 
     36 config.mk: config.h
     37 	cp config.def.mk config.mk
     38 
     39 clean:
     40 	echo >swk.mk
     41 	cd t && ${MAKE} clean
     42 	rm -f swk.pc swk.mk libswk.a libswk.so ${OBJS} ${GI_OBJS}
     43 
     44 install:
     45 	mkdir -p ${DESTDIR}/${INCDIR}
     46 	cp swk.h ${DESTDIR}/${INCDIR}
     47 	mkdir -p ${DESTDIR}/${LIBDIR}
     48 	cp libswk.a ${DESTDIR}/${LIBDIR}
     49 	cp libswk.so ${DESTDIR}/${LIBDIR}
     50 	mkdir -p ${DESTDIR}/${LIBDIR}/mk
     51 	cp swk.mk ${DESTDIR}/${LIBDIR}/mk/swk.mk
     52 	mkdir -p ${DESTDIR}/${LIBDIR}/pkgconfig
     53 	cp swk.pc ${DESTDIR}/${LIBDIR}/pkgconfig/swk.pc
     54 
     55 deinstall uninstall:
     56 	rm -f ${DESTDIR}/${INCDIR}/swk.h
     57 	rm -f ${DESTDIR}/${LIBDIR}/libswk.a
     58 	rm -f ${DESTDIR}/${LIBDIR}/libswk.so
     59 	rm -f ${DESTDIR}/${LIBDIR}/mk/swk.mk
     60 	rm -f ${DESTDIR}/${LIBDIR}/pkgconfig/swk.pc
     61 
     62 static: libswk.a
     63 
     64 shared: libswk.so
     65 
     66 libswk.so: config.mk ${OBJS} ${GI_OBJS}
     67 	${CC} ${CFLAGS} -fPIC -shared image.c swk.c text.c ${GI_SRCS} -o libswk.so
     68 
     69 swk.o: config.mk
     70 
     71 libswk.a: config.mk ${OBJS} ${GI_OBJS}
     72 	rm -f libswk.a
     73 	ar qcvf libswk.a ${OBJS} ${GI_OBJS}
     74 	echo SWKINCS+=-I${PREFIX}/include > swk.mk
     75 	echo SWKLIB+=${PREFIX}/lib/libswk.a >> swk.mk
     76 	echo SWKLIBS+=${GI_LIBS} >> swk.mk
     77 	echo prefix=${PREFIX} > swk.pc
     78 	echo libdir=${LIBDIR} >> swk.pc
     79 	echo >> swk.pc
     80 	echo Name: swk >> swk.pc
     81 	echo Version: ${VERSION} >> swk.pc
     82 	echo Description: simple widget kit >> swk.pc
     83 	echo Libs: -L${PREFIX}/lib -lswk ${GI_LIBS} >> swk.pc
     84 	echo Libs.private: ${PREFIX}/lib/libswk.a ${GI_LIBS} >> swk.pc
     85 	echo Cflags: -I${PREFIX}/include >> swk.pc