From 103c86db03133d05ab52c13e4014e9de96701aaa Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Sun, 14 Nov 2010 15:19:36 +0100 Subject: [PATCH] BuildSystem: small stuffs move VERSION to common.mk Remove obscure {C|LD}_FLAGS OPTIONS with optional libs and LIBS = ${REQUIRED} ${OPTIONS} --- BSDmakefile | 12 ++++++++++-- Makefile | 30 ++++++++++++++---------------- common.mk | 8 ++++++-- config.mk | 11 ++--------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index aced1b8..01af54c 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -25,6 +25,13 @@ LDFLAGS_LIBS!= pkg-config --libs ${LIBS} CFLAGS+= ${CFLAGS_LIBS} LDADD+= ${LDFLAGS_LIBS} -lpthread +options: + @echo wmfs compile with ${LIBS} + @echo - CFLAGS ${CFLAGS} + @echo - LDFLAGS ${LDFLAGS} + @echo - OUTPUT ${.OBJDIR} + + install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin @@ -49,10 +56,11 @@ uninstall: @echo removing config file from ${DESTDIR}${XDG_CONFIG_DIR} @rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfsrc +all: options .include .c.o: config.mk @if [ ! -d `dirname ${.TARGET}` ]; then mkdir -p `dirname ${.TARGET}`; fi - @echo CC ${.IMPSRC} - @${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + diff --git a/Makefile b/Makefile index 508bb71..3fd56d0 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,7 @@ ${O}/wmfs.1.gz: wmfs.1 ${O}/%.o: %.c config.mk @if [ ! -d `dirname ${O}/$<` ]; then mkdir -p `dirname ${O}/$<`; fi - @echo CC $< - @${CC} -c ${CFLAGS} $< -o $@ + ${CC} -c ${CFLAGS} $< -o $@ options: @echo wmfs compile with ${LIBS} @@ -45,35 +44,34 @@ options: @if [ ! -d ${O} ]; then mkdir -p ${O}; fi ${O}/wmfs: ${OBJ} config.mk src/structs.h src/wmfs.h src/parse/parse.h - @echo CC -o $@ - @${CC} -o $@ ${OBJ} ${LDFLAGS} + ${CC} -o $@ ${OBJ} ${LDFLAGS} clean: @rm -f ${OBJ} ${O}/wmfs ${O}/wmfs.1.gz install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin - @mkdir -p ${DESTDIR}${PREFIX}/bin - @install ${O}/wmfs ${DESTDIR}${PREFIX}/bin + mkdir -p ${DESTDIR}${PREFIX}/bin + install ${O}/wmfs ${DESTDIR}${PREFIX}/bin @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 - @mkdir -p ${DESTDIR}${MANPREFIX}/man1 - @install -m 644 ${O}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + install -m 644 ${O}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions - @mkdir -p ${DESTDIR}${PREFIX}/share/xsessions - @install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions/ + mkdir -p ${DESTDIR}${PREFIX}/share/xsessions + install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions/ @echo installing default config file to ${DESTDIR}${XDG_CONFIG_DIR} - @mkdir -p ${DESTDIR}${XDG_CONFIG_DIR} - @install -m 444 wmfsrc ${DESTDIR}${XDG_CONFIG_DIR} + mkdir -p ${DESTDIR}${XDG_CONFIG_DIR} + install -m 444 wmfsrc ${DESTDIR}${XDG_CONFIG_DIR} uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin - @rm -f ${DESTDIR}${PREFIX}/bin/wmfs + rm -f ${DESTDIR}${PREFIX}/bin/wmfs @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 - @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz + rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions - @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop @echo removing config file from ${DESTDIR}${XDG_CONFIG_DIR} - @rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfsrc + rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfsrc diff --git a/common.mk b/common.mk index 3799f9f..8c82390 100644 --- a/common.mk +++ b/common.mk @@ -1,3 +1,6 @@ +# wmfs version +VERSION= 201011 + SRCS= \ src/barwin.c \ src/client.c \ @@ -23,11 +26,12 @@ src/util.c \ src/viwmfs.c \ src/wmfs.c +# Used libs +LIBS= x11 xft freetype2 ${OPTIONS} + # flags -CFLAGS+= ${C_FLAGS} CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" -LDFLAGS+= ${LD_FLAGS} # build directory O?= build diff --git a/config.mk b/config.mk index 739dfdb..dc7b600 100644 --- a/config.mk +++ b/config.mk @@ -1,10 +1,6 @@ -# wmfs version -VERSION= 201011 - # Customize below to fit your system # x11 xft and freetype2 are REQUIRED, others are optionals -LIBS= x11 xft freetype2 xrandr xinerama imlib2 - +OPTIONS= xrandr xinerama imlib2 # If theses variables are defined, make will not call pkg-config # @@ -21,7 +17,4 @@ PREFIX= /usr/local MANPREFIX= ${PREFIX}/man XDG_CONFIG_DIR= /usr/local/etc/xdg/wmfs - -# CFLAGS LDFLAGS can be customised here -C_FLAGS= -Wall -LD_FLAGS= +CFLAGS= -Wall