From c23f9dfe2ebd65c53f728ebd85fb5f73ee584d3a Mon Sep 17 00:00:00 2001 From: Quinn Date: Sun, 25 Jan 2026 12:38:08 +0100 Subject: [PATCH] Move config.mk into `Makefile`, and delete `config.mk`. config.mk shall now contain user-specific configurations, and thus is now ignored. --- .gitignore | 1 + Makefile | 20 +++++++++++++++++++- config.mk | 39 --------------------------------------- 3 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 config.mk diff --git a/.gitignore b/.gitignore index 714c29f..39cef6c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ # Ignore /bin/ directory /bin/ +/config.mk # Unignore specific files. !.gitignore diff --git a/Makefile b/Makefile index 90ace5f..ea883ea 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,30 @@ # dwm - dynamic window manager # See LICENSE file for copyright and license details. -include config.mk +-include config.mk + +VERSION = 6.7 INSTALL ?= install GZIP ?= gzip TAR ?= tar +CFLAGS := -Os $(CFLAGS) -g -std=gnu99\ + -Wall -Wextra -Wpedantic -Wno-pointer-arith +CPPFLAGS := -DNDEBUG $(CPPFLAGS)\ + -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700L -DXINERAMA +LDFLAGS := -flto $(LDFLAGS) +LDLIBS := $(LDLIBS) -lm + +# Use pkg-config to locate dependencies, and set the correct flags. +ifeq (,$(shell command -v pkg-config)) +$(error Failed to locate pkg-config, please make sure it is installed or acessible through PATH.) +else +CPPFLAGS += $(shell pkg-config --cflags-only-I x11 xinerama) +LDFLAGS += $(shell pkg-config --libs-only-L x11 xinerama) +LDLIBS += $(shell pkg-config --libs-only-l x11 xinerama) +endif + SRC := $(wildcard src/*.c) OBJ := $(addsuffix .o,$(SRC)) DEP := $(addsuffix .d,$(SRC)) diff --git a/config.mk b/config.mk deleted file mode 100644 index 6e875f1..0000000 --- a/config.mk +++ /dev/null @@ -1,39 +0,0 @@ -# dwm version -VERSION = 6.7 - -# Customize below to fit your system - -# paths -PREFIX = /usr/local -MANPREFIX = ${PREFIX}/share/man - -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib - -# Xinerama, comment if you don't want it -XINERAMALIBS = -lXinerama -XINERAMAFLAGS = -DXINERAMA - -# freetype -FREETYPELIBS = -lfontconfig -lXft -FREETYPEINC = /usr/include/freetype2 -# OpenBSD (uncomment) -#FREETYPEINC = ${X11INC}/freetype2 -#MANPREFIX = ${PREFIX}/man - -# includes and libs -INCS = -I${X11INC} -I${FREETYPEINC} -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} - -# flags -CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -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