From 8db4ed06e4ca601c9765f710279a0d695cd979fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 1 Aug 2024 20:07:36 -0600 Subject: [PATCH] use POSIX.1-2024 (aka Issue 8) in the makefile --- Makefile | 18 ++++++++++-------- config.mk | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 8db7409..63cbbcf 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,19 @@ include config.mk # flags for compiling -DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \ - -DVERSION=\"$(VERSION)\" $(XWAYLAND) -DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \ +DWLCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \ -Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \ -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types \ -Wfloat-conversion +DWLCFLAGS += -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \ + -DVERSION=\"$(VERSION)\" $(XWAYLAND) # CFLAGS / LDFLAGS -PKGS = wayland-server xkbcommon libinput $(XLIBS) -DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS) -LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS) +PKGS = wayland-server xkbcommon libinput $(XLIBS) +PKGS_INCS != $(PKG_CONFIG) --cflags $(PKGS) +DWLCFLAGS += $(WLR_INCS) $(PKGS_INCS) $(CFLAGS) +PKGS_LIBS != $(PKG_CONFIG) --libs $(PKGS) +LDLIBS += $(WLR_LIBS) $(PKGS_LIBS) -lm $(LIBS) all: dwl dwl: dwl.o util.o @@ -27,8 +29,8 @@ util.o: util.c util.h # wayland-scanner is a tool which generates C headers and rigging for Wayland # protocols, which are specified in XML. wlroots requires you to rig these up # to your build system yourself and provide them in the include path. -WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner` -WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` +WAYLAND_SCANNER != $(PKG_CONFIG) --variable=wayland_scanner wayland-scanner +WAYLAND_PROTOCOLS != $(PKG_CONFIG) --variable=pkgdatadir wayland-protocols cursor-shape-v1-protocol.h: $(WAYLAND_SCANNER) enum-header \ diff --git a/config.mk b/config.mk index e374ccb..e6d8f2c 100644 --- a/config.mk +++ b/config.mk @@ -1,7 +1,7 @@ _VERSION = 0.8-dev -VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)` +VERSION != git describe --tags --dirty 2>/dev/null || echo $(_VERSION) -PKG_CONFIG = pkg-config +PKG_CONFIG ?= pkg-config # paths PREFIX = /usr/local @@ -21,8 +21,8 @@ DATADIR = $(PREFIX)/share # -I$(PWD)/wlroots/0.19/include/wlroots-0.19 #WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/0.19/lib64 -L$(PWD)/wlroots/0.19/lib64 -lwlroots-0.19 -WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19` -WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19` +WLR_INCS != $(PKG_CONFIG) --cflags wlroots-0.19 +WLR_LIBS != $(PKG_CONFIG) --libs wlroots-0.19 XWAYLAND = XLIBS = @@ -33,4 +33,4 @@ XLIBS = # dwl itself only uses C99 features, but wlroots' headers use anonymous unions (C11). # To avoid warnings about them, we do not use -std=c99 and instead of using the # gmake default 'CC=c99', we use cc. -CC = cc +CC ?= cc