From 4c90d1d9e4092f9ee0106d316829144653a276ea Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Tue, 30 Dec 2025 02:45:11 +0100 Subject: Split monolithic dwm.h into modular headers and group them by it's functionalities The new plan of refactoring this project is to split entire monolithic codebase into separate, (kind of) independent modules. This will help with understanding the code by turning off modules and deciding which ones require some work. Signed-off-by: Filip Wandzio --- Makefile | 116 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 86 insertions(+), 30 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ad5119d..84c0b68 100644 --- a/Makefile +++ b/Makefile @@ -1,46 +1,95 @@ -# dwm - dynamic window manager -# See LICENSE file for copyright and license details. +# ========================= +# config +# ========================= -include src/config/config.mk +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man -SRC = src/drw/drw.c src/core/dwm.c src/util/util.c -OBJ = $(SRC:.c=.o) +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib -CFLAGS += -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os \ - -I/usr/X11R6/include \ - -I/usr/include/freetype2 \ - -I./src/util \ +FREETYPEINC = /usr/include/freetype2 +FREETYPELIBS= -lfontconfig -lXft + +XINERAMAFLAGS = -DXINERAMA +XINERAMALIBS = -lXinerama + +# ========================= +# flags +# ========================= + +INCS = \ + -I${X11INC} \ + -I${FREETYPEINC} \ + -I./src \ -I./src/drw \ - -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L \ - -DVERSION=\"6.4\" -DXINERAMA + -I./src/util + +CPPFLAGS = \ + -D_DEFAULT_SOURCE \ + -D_BSD_SOURCE \ + -D_XOPEN_SOURCE=700L \ + -DVERSION=\"${VERSION}\" \ + ${XINERAMAFLAGS} + +CFLAGS = \ + -std=c99 \ + -pedantic \ + -Wall \ + -Wno-deprecated-declarations \ + -Os \ + ${INCS} \ + ${CPPFLAGS} + +LDFLAGS = \ + -L${X11LIB} \ + -lX11 \ + ${XINERAMALIBS} \ + ${FREETYPELIBS} \ + -lX11-xcb \ + -lxcb \ + -lxcb-res + +CC = clang + +# ========================= +# sources +# ========================= + +SRC = \ + src/core/dwm.c \ + src/drw/drw.c \ + src/util/util.c + # src/core/globals.c \ + # src/x11/xevents.c \ + # src/x11/xutil.c \ + # src/wm/client.c \ + # src/wm/monitor.c \ + # src/wm/layout.c \ + # src/ui/input.c \ + # src/ui/bar.c \ + # src/ui/systray.c \ -LDFLAGS += -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft -lX11-xcb -lxcb -lxcb-res + +OBJ = ${SRC:.c=.o} + +# ========================= +# build rules +# ========================= all: dwm %.o: %.c ${CC} -c ${CFLAGS} -o $@ $< -${OBJ}: src/config/config.h src/config/config.mk - -config.h: - cp src/config/config.def.h $@ - dwm: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} -clean: - rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz +# ========================= +# install +# ========================= -dist: clean - mkdir -p dwm-${VERSION} - cp -R LICENSE Makefile README src/config/config.def.h src/config/config.mk \ - src/core/dwm.1 src/drw/drw.h src/util/util.h ${SRC} /assets/dwm.png src/transient/transient.c dwm-${VERSION} - tar -cf dwm-${VERSION}.tar dwm-${VERSION} - gzip dwm-${VERSION}.tar - rm -rf dwm-${VERSION} - -install: all +install: dwm mkdir -p ${DESTDIR}${PREFIX}/bin cp -f dwm ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/dwm @@ -50,6 +99,13 @@ install: all uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dwm \ - ${DESTDIR}${MANPREFIX}/man1/dwm.1 + ${DESTDIR}${MANPREFIX}/man1/dwm.1 + +# ========================= +# housekeeping +# ========================= + +clean: + rm -f dwm ${OBJ} -.PHONY: all clean dist install uninstall +.PHONY: all clean install uninstall -- cgit v1.2.3