From 0606973e5ea1ea785f81898ac9d5995fc666c8a3 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 17 Nov 2021 00:48:06 +0500 Subject: [PATCH] Configure build --- .gitignore | 1 + Makefile | 16 ++++++++++++++-- config.mk | 44 -------------------------------------------- config/default.mk | 24 ++++++++++++++++++++++++ config/freebsd.mk | 6 ++++++ config/openbsd.mk | 5 +++++ configure | 5 +++++ 7 files changed, 55 insertions(+), 46 deletions(-) delete mode 100644 config.mk create mode 100644 config/default.mk create mode 100644 config/freebsd.mk create mode 100644 config/openbsd.mk create mode 100755 configure diff --git a/.gitignore b/.gitignore index 651dd4e..3392289 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +/config/active.mk /polytreewm /src/*.o diff --git a/Makefile b/Makefile index 8a372c1..8ab498c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,16 @@ # PolytreeWM - tiling window manager # See LICENSE file for copyright and license details. -include config.mk +include config/active.mk + +VERSION = 6.2 + +INCS = -I$(X11INC) -I$(FREETYPEINC) +LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) -lX11-xcb -lxcb -lxcb-res $(KVMLIB) + +CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DXINERAMA +CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os $(INCS) $(CPPFLAGS) +LDFLAGS = $(LIBS) SRC = \ src/atoms.c \ @@ -56,6 +65,9 @@ ${OBJ}: config.mk ${HDR} clean: rm -f polytreewm ${OBJ} +distclean: clean + rm -f config/active.mk + install: all mkdir -p ${DESTDIR}${PREFIX}/bin cp -f polytreewm ${DESTDIR}${PREFIX}/bin @@ -70,4 +82,4 @@ uninstall: ${DESTDIR}${PREFIX}/bin/polytreewm \ ${DESTDIR}${MANPREFIX}/man1/polytreewm.1 -.PHONY: all options clean install uninstall +.PHONY: all options clean distclean install uninstall diff --git a/config.mk b/config.mk deleted file mode 100644 index b605bae..0000000 --- a/config.mk +++ /dev/null @@ -1,44 +0,0 @@ -# PolytreeWM version -VERSION = 6.2 - -# Customize below to fit your system - -# paths -PREFIX = /usr/local -MANPREFIX = ${PREFIX}/share/man - -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib -# FreeBSD (uncomment) -#X11INC = /usr/local/include -#X11LIB = /usr/local/lib - -# Xinerama, comment if you don't want it -XINERAMALIBS = -lXinerama -XINERAMAFLAGS = -DXINERAMA - -# freetype -FREETYPELIBS = -lfontconfig -lXft -FREETYPEINC = /usr/include/freetype2 -# FreeBSD (uncomment) -#FREETYPEINC = /usr/local/include/freetype2 -# OpenBSD (uncomment) -#FREETYPEINC = ${X11INC}/freetype2 -#KVMLIB = -lkvm - -# includes and libs -INCS = -I${X11INC} -I${FREETYPEINC} -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB} - -# flags -CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} -CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} -LDFLAGS = ${LIBS} - -# Solaris -#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" -#LDFLAGS = ${LIBS} - -# compiler and linker -CC = cc diff --git a/config/default.mk b/config/default.mk new file mode 100644 index 0000000..a60edf3 --- /dev/null +++ b/config/default.mk @@ -0,0 +1,24 @@ +########################## +# Compiler, linker, etc. # +########################## + +CC = cc + +######### +# Paths # +######### + +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man + +################ +# Dependencies # +################ + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +XINERAMALIBS = -lXinerama + +FREETYPELIBS = -lfontconfig -lXft +FREETYPEINC = /usr/include/freetype2 diff --git a/config/freebsd.mk b/config/freebsd.mk new file mode 100644 index 0000000..ca7b902 --- /dev/null +++ b/config/freebsd.mk @@ -0,0 +1,6 @@ +include default.mk + +X11INC = /usr/local/include +X11LIB = /usr/local/lib + +FREETYPEINC = /usr/include/freetype2 diff --git a/config/openbsd.mk b/config/openbsd.mk new file mode 100644 index 0000000..4e6ee3e --- /dev/null +++ b/config/openbsd.mk @@ -0,0 +1,5 @@ +include default.mk + +FREETYPEINC = $(X11INC)/freetype2 + +KVMLIB = -lkvm diff --git a/configure b/configure new file mode 100755 index 0000000..5596dd3 --- /dev/null +++ b/configure @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +ln -sf default.mk config/active.mk