From 8146021a2ea4130cfb0d2bf846b451ec538b1bb6 Mon Sep 17 00:00:00 2001 From: philw Date: Tue, 15 Apr 2025 01:41:05 +0200 Subject: Refactor the project Refactored core logic to improve readability and maintainability. Documented the 'transient.c' file to provide clear explanations of its purpose and functions. Updated the 'util.c' file with necessary comments and improvements to existing code. Documented the 'util.h' header file to clarify function prototypes and usage. This update should improve the overall code quality and make it easier for future development. Signed-off-by: philw --- Makefile | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ffa69b4..ad5119d 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,30 @@ # dwm - dynamic window manager # See LICENSE file for copyright and license details. -include config.mk +include src/config/config.mk -SRC = drw.c dwm.c util.c -OBJ = ${SRC:.c=.o} +SRC = src/drw/drw.c src/core/dwm.c src/util/util.c +OBJ = $(SRC:.c=.o) + +CFLAGS += -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os \ + -I/usr/X11R6/include \ + -I/usr/include/freetype2 \ + -I./src/util \ + -I./src/drw \ + -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L \ + -DVERSION=\"6.4\" -DXINERAMA + +LDFLAGS += -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft -lX11-xcb -lxcb -lxcb-res all: dwm -.c.o: - ${CC} -c ${CFLAGS} $< +%.o: %.c + ${CC} -c ${CFLAGS} -o $@ $< -${OBJ}: config.h config.mk +${OBJ}: src/config/config.h src/config/config.mk config.h: - cp config.def.h $@ + cp src/config/config.def.h $@ dwm: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} @@ -24,8 +34,8 @@ clean: dist: clean mkdir -p dwm-${VERSION} - cp -R LICENSE Makefile README config.def.h config.mk\ - dwm.1 drw.h util.h ${SRC} dwm.png transient.c 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} @@ -35,11 +45,11 @@ install: all cp -f dwm ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/dwm mkdir -p ${DESTDIR}${MANPREFIX}/man1 - sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 + sed "s/VERSION/${VERSION}/g" < assets/dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 uninstall: - rm -f ${DESTDIR}${PREFIX}/bin/dwm\ + rm -f ${DESTDIR}${PREFIX}/bin/dwm \ ${DESTDIR}${MANPREFIX}/man1/dwm.1 .PHONY: all clean dist install uninstall -- cgit v1.2.3