Makefile, config.mk: use pkg-config, fix config.h rule + tweaks

This commit is contained in:
Hiltjo Posthuma 2020-08-02 18:23:30 +02:00
parent 13d20da8ef
commit 3fe7bcc7a4
2 changed files with 19 additions and 8 deletions

View File

@ -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}"

View File

@ -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\"