diff --git a/Makefile b/Makefile index 3e4f23e..6a175fa 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include config.mk BIN = ${NAME}-${LAYOUT} SRC = drw.c ${NAME}.c util.c -OBJ = ${NAME}-${LAYOUT}.o +OBJ = ${SRC:.c=.o} MAN1 = ${NAME}.1 all: ${BIN} @@ -24,11 +24,16 @@ options: config.h: cp config.def.h $@ -${BIN}: - ${CC} -o $@ ${SRC} ${SVKBD_CFLAGS} ${SVKBD_CPPFLAGS} ${SVKBD_LDFLAGS} +.c.o: + ${CC} ${SVKBD_CFLAGS} ${SVKBD_CPPFLAGS} -c $< + +${OBJ}: config.h config.mk + +${BIN}: ${OBJ} + ${CC} -o ${BIN} ${OBJ} ${SVKBD_LDFLAGS} clean: - rm -f ${NAME}-?? ${NAME}-??.o ${OBJ} + rm -f ${NAME}-?? ${NAME}-??.o ${OBJ} ${BIN} dist: rm -rf "${NAME}-${VERSION}" diff --git a/config.mk b/config.mk index bc4eeca..50d9c7f 100644 --- a/config.mk +++ b/config.mk @@ -7,15 +7,21 @@ MANPREFIX = ${PREFIX}/share/man X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib +PKG_CONFIG = pkg-config + # Xinerama, comment if you don't want it XINERAMALIBS = -L${X11LIB} -lXinerama XINERAMAFLAGS = -DXINERAMA # includes and libs -INCS = -I. -I./layouts -I${X11INC} -I/usr/include/freetype2 -LIBS = -L${X11LIB} -lX11 -lXtst -lfontconfig -lXft ${XINERAMALIBS} +INCS = -I. -I./layouts -I${X11INC} \ + `$(PKG_CONFIG) --cflags fontconfig` \ + `$(PKG_CONFIG) --cflags freetype2` +LIBS = -L${X11LIB} -lX11 -lXtst -lXft ${XINERAMALIBS} \ + `$(PKG_CONFIG) --libs fontconfig` \ + `$(PKG_CONFIG) --libs freetype2` # use system flags -SVKBD_CFLAGS = ${CFLAGS} +SVKBD_CFLAGS = ${CFLAGS} ${INCS} SVKBD_LDFLAGS = ${LDFLAGS} ${LIBS} -SVKBD_CPPFLAGS = ${CPPFLAGS} ${INCS} -DVERSION=\"VERSION\" ${XINERAMAFLAGS} -DLAYOUT=\"layout.${LAYOUT}.h\" +SVKBD_CPPFLAGS = ${CPPFLAGS} -DVERSION=\"VERSION\" ${XINERAMAFLAGS} -DLAYOUT=\"layout.${LAYOUT}.h\"