BuildSystem: complete rewrite
Should compile properly on Linux, FreeBSD, OpenBSD and NetBSD
This commit is contained in:
85
Makefile
85
Makefile
@@ -1,61 +1,68 @@
|
||||
include config.mk
|
||||
include common.mk
|
||||
PREFIX=/usr/local
|
||||
XDG_CONFIG_DIR=/usr/local/etc/xdg/wmfs
|
||||
MANPREFIX=/usr/local/man
|
||||
|
||||
OBJ = ${patsubst %.c,${O}/%.o,${SRCS}}
|
||||
CFLAGS=-I/usr/include/freetype2 -DHAVE_XINERAMA -DHAVE_XRANDR -DHAVE_IMLIB2
|
||||
LDFLAGS=-lX11 -lXft -lfreetype -lXinerama -lXrandr -lImlib2 -lpthread
|
||||
|
||||
ifneq ($(findstring xrandr, ${LIBS}),)
|
||||
CFLAGS+= -DHAVE_XRANDR
|
||||
endif
|
||||
PROG=wmfs
|
||||
MAN=wmfs.1
|
||||
|
||||
ifneq ($(findstring xinerama, ${LIBS}),)
|
||||
CFLAGS+= -DHAVE_XINERAMA
|
||||
endif
|
||||
# wmfs version
|
||||
VERSION= 201011
|
||||
|
||||
ifneq ($(findstring imlib2, ${LIBS}),)
|
||||
CFLAGS+= -DHAVE_IMLIB
|
||||
endif
|
||||
SRCS= \
|
||||
src/barwin.c \
|
||||
src/client.c \
|
||||
src/config.c \
|
||||
src/draw.c \
|
||||
src/event.c \
|
||||
src/ewmh.c \
|
||||
src/frame.c \
|
||||
src/getinfo.c \
|
||||
src/infobar.c \
|
||||
src/init.c \
|
||||
src/launcher.c \
|
||||
src/layout.c \
|
||||
src/menu.c \
|
||||
src/mouse.c \
|
||||
src/parse/api.c \
|
||||
src/parse/parse.c \
|
||||
src/screen.c \
|
||||
src/status.c \
|
||||
src/systray.c \
|
||||
src/tag.c \
|
||||
src/util.c \
|
||||
src/viwmfs.c \
|
||||
src/wmfs.c
|
||||
|
||||
ifndef CFLAGS_LIBS
|
||||
CFLAGS_LIBS= $(shell pkg-config --cflags-only-I ${LIBS})
|
||||
endif
|
||||
# flags
|
||||
CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\"
|
||||
CFLAGS+= -DWMFS_VERSION=\"${VERSION}\"
|
||||
|
||||
ifndef LDFLAGS_LIBS
|
||||
LDFLAGS_LIBS= $(shell pkg-config --libs ${LIBS})
|
||||
endif
|
||||
OBJS= ${SRCS:.c=.o}
|
||||
|
||||
CFLAGS+= ${CFLAGS_LIBS}
|
||||
LDFLAGS+= ${LDFLAGS_LIBS} -lpthread
|
||||
all: ${PROG} ${MAN}.gz
|
||||
|
||||
all: options ${O}/wmfs ${O}/wmfs.1.gz
|
||||
${PROG}: ${OBJS} src/structs.h src/wmfs.h src/parse/parse.h
|
||||
${CC} -o $@ ${OBJS} ${LDFLAGS}
|
||||
|
||||
${O}/wmfs.1.gz: wmfs.1
|
||||
gzip -cn -9 $< > $@
|
||||
${MAN}.gz: ${MAN}
|
||||
gzip -cn -9 ${MAN} > $@
|
||||
|
||||
${O}/%.o: %.c config.mk
|
||||
@if [ ! -d `dirname ${O}/$<` ]; then mkdir -p `dirname ${O}/$<`; fi
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $< -o $@
|
||||
|
||||
options:
|
||||
@echo wmfs compile with ${LIBS}
|
||||
@echo - CFLAGS ${CFLAGS}
|
||||
@echo - LDFLAGS ${LDFLAGS}
|
||||
@echo - OUTPUT ${O}
|
||||
|
||||
@if [ ! -d ${O} ]; then mkdir -p ${O}; fi
|
||||
|
||||
${O}/wmfs: ${OBJ} config.mk src/structs.h src/wmfs.h src/parse/parse.h
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
@rm -f ${OBJ} ${O}/wmfs ${O}/wmfs.1.gz
|
||||
rm -f ${OBJS} wmfs ${MAN}.gz
|
||||
|
||||
install: all
|
||||
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
|
||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||
install ${O}/wmfs ${DESTDIR}${PREFIX}/bin
|
||||
install ${PROG} ${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/
|
||||
install -m 644 ${MAN}.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/
|
||||
|
||||
Reference in New Issue
Block a user