Configure build for both GNU and BSD makes

This commit is contained in:
Alex Kotov 2021-11-17 03:35:52 +05:00
parent 000c7fbeea
commit 488bbf13be
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
5 changed files with 42 additions and 10 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
/config/1-custom.mk /config/1-custom.mk
/config/2-generated.mk /config/2-generated.mk
/config/3-custom.mk /config/3-custom.mk
/config/4-defvars.mk
/config/5-custom.mk /config/5-custom.mk
/polytreewm /polytreewm
/src/*.o /src/*.o

View file

@ -1,6 +1,12 @@
# PolytreeWM - tiling window manager # PolytreeWM - tiling window manager
# See LICENSE file for copyright and license details. # See LICENSE file for copyright and license details.
include config/1-custom.mk
include config/2-generated.mk
include config/3-custom.mk
include config/4-defvars.mk
include config/5-custom.mk
CONFIGMKS = \ CONFIGMKS = \
config/1-custom.mk \ config/1-custom.mk \
config/2-generated.mk \ config/2-generated.mk \
@ -8,8 +14,6 @@ CONFIGMKS = \
config/4-defvars.mk \ config/4-defvars.mk \
config/5-custom.mk config/5-custom.mk
include $(CONFIGMKS)
VERSION = 6.2 VERSION = 6.2
SRC = \ SRC = \
@ -66,7 +70,12 @@ clean:
rm -f polytreewm ${OBJ} rm -f polytreewm ${OBJ}
distclean: clean distclean: clean
rm -f config/2-generated.mk rm -f \
config/1-custom.mk \
config/2-generated.mk \
config/3-custom.mk \
config/4-defvars.mk \
config/5-custom.mk
install: all install: all
mkdir -p ${DESTDIR}${BINDIR} mkdir -p ${DESTDIR}${BINDIR}

15
config/4-defvars-bsd.mk Normal file
View file

@ -0,0 +1,15 @@
CC = cc
PKGCONFIG = pkg-config
PKGS += fontconfig freetype2 x11 x11-xcb xcb xcb-res xft
.if "$(ENABLE_XINERAMA)" == 'yes'
CPPFLAGS += -DENABLE_XINERAMA
PKGS += xinerama
.endif
CFLAGS += `$(PKGCONFIG) --cflags $(PKGS)`
LDFLAGS += `$(PKGCONFIG) --libs $(PKGS)`
CPPFLAGS += -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L
CFLAGS += $(CPPFLAGS) -std=c99 -Os -pedantic -Wall -Wno-deprecated-declarations

21
configure vendored
View file

@ -108,11 +108,18 @@ touch 'config/1-custom.mk'
touch 'config/3-custom.mk' touch 'config/3-custom.mk'
touch 'config/5-custom.mk' touch 'config/5-custom.mk'
rm -f 'config/2-generated.mk' cat > 'config/2-generated.mk' << MAKE
PREFIX = $prefix
EPREFIX = $eprefix
BINDIR = $bindir
DATAROOTDIR = $datarootdir
MANDIR = $mandir
ENABLE_XINERAMA = $enable_xinerama
MAKE
echo "PREFIX = $prefix" >> 'config/2-generated.mk' make_help_result="$(make --help)"
echo "EPREFIX = $eprefix" >> 'config/2-generated.mk' if [ "$(echo "$make_help_result" | grep 'gnu.org')" = '' ]; then
echo "BINDIR = $bindir" >> 'config/2-generated.mk' ln -sf '4-defvars-bsd.mk' 'config/4-defvars.mk'
echo "DATAROOTDIR = $datarootdir" >> 'config/2-generated.mk' else
echo "MANDIR = $mandir" >> 'config/2-generated.mk' ln -sf '4-defvars-gnu.mk' 'config/4-defvars.mk'
echo "ENABLE_XINERAMA = $enable_xinerama" >> 'config/2-generated.mk' fi