diff --git a/LICENSE/LICENSE.dwl b/LICENSE similarity index 100% rename from LICENSE/LICENSE.dwl rename to LICENSE diff --git a/LICENSE/LICENSE.dwm b/LICENSE.dwm similarity index 100% rename from LICENSE/LICENSE.dwm rename to LICENSE.dwm diff --git a/LICENSE/LICENSE.sway b/LICENSE.sway similarity index 100% rename from LICENSE/LICENSE.sway rename to LICENSE.sway diff --git a/LICENSE/LICENSE.tinywl b/LICENSE.tinywl similarity index 100% rename from LICENSE/LICENSE.tinywl rename to LICENSE.tinywl diff --git a/Makefile b/Makefile index c3126b6..578194f 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ .POSIX: .SUFFIXES: -.DEFAULT_GOAL := all include config.mk # flags for compiling -DWLCPPFLAGS = -I$(INCLUDE) -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \ +DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \ -DVERSION=\"$(VERSION)\" $(XWAYLAND) DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \ -Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \ @@ -17,31 +16,13 @@ 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) -# macros to relevant path definitions -define mkbin -$(addprefix $(BIN)/,$1) -endef -define mkobj -$(addprefix $(OBJ)/,$1) -endef -define mkinclude -$(addprefix $(INCLUDE)/,$1) -endef -define mksrc -$(addprefix $(SRC)/,$1) -endef - -.PHONY: setup -setup: - mkdir -p $(BIN) $(BUILD) $(INCLUDE) $(OBJ) - -all: setup $(call mkbin,dwl) -$(BIN)/dwl: $(call mkobj,dwl.o util.o) - $(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ -$(OBJ)/dwl.o: $(call mksrc,dwl.c client.h) config.mk $(call mkinclude,config.h cursor-shape-v1-protocol.h \ +all: dwl +dwl: dwl.o util.o + $(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ +dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h \ pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \ - wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h) -$(OBJ)/util.o: $(call mksrc,util.c util.h) + wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h +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 @@ -49,39 +30,39 @@ $(OBJ)/util.o: $(call mksrc,util.c util.h) WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner` WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` -$(INCLUDE)/cursor-shape-v1-protocol.h: +cursor-shape-v1-protocol.h: $(WAYLAND_SCANNER) enum-header \ $(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@ -$(INCLUDE)/pointer-constraints-unstable-v1-protocol.h: +pointer-constraints-unstable-v1-protocol.h: $(WAYLAND_SCANNER) enum-header \ $(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@ -$(INCLUDE)/wlr-layer-shell-unstable-v1-protocol.h: +wlr-layer-shell-unstable-v1-protocol.h: $(WAYLAND_SCANNER) enum-header \ protocols/wlr-layer-shell-unstable-v1.xml $@ -$(INCLUDE)/wlr-output-power-management-unstable-v1-protocol.h: +wlr-output-power-management-unstable-v1-protocol.h: $(WAYLAND_SCANNER) server-header \ protocols/wlr-output-power-management-unstable-v1.xml $@ -$(INCLUDE)/xdg-shell-protocol.h: +xdg-shell-protocol.h: $(WAYLAND_SCANNER) server-header \ $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ -$(INCLUDE)/config.h: - cp $(SRC)/config.def.h $@ +config.h: + cp config.def.h $@ clean: - rm -rf $(INCLUDE) $(OBJ) $(BUILD) $(BIN) + rm -f dwl *.o *-protocol.h dist: clean mkdir -p dwl-$(VERSION) - cp -R LICENSE Makefile CHANGELOG.md README.md src \ - config.mk protocols dwl.1 dwl.desktop \ + cp -R LICENSE* Makefile CHANGELOG.md README.md client.h config.def.h \ + config.mk protocols dwl.1 dwl.c util.c util.h dwl.desktop \ dwl-$(VERSION) tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION) rm -rf dwl-$(VERSION) -install: $(BIN)/dwl +install: dwl mkdir -p $(DESTDIR)$(PREFIX)/bin rm -f $(DESTDIR)$(PREFIX)/bin/dwl - cp -f $(BIN)/dwl $(DESTDIR)$(PREFIX)/bin + cp -f dwl $(DESTDIR)$(PREFIX)/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl mkdir -p $(DESTDIR)$(MANDIR)/man1 cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1 @@ -93,5 +74,6 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 \ $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop -%.c %.o: +.SUFFIXES: .c .o +.c.o: $(CC) $(CPPFLAGS) $(DWLCFLAGS) -o $@ -c $< diff --git a/src/client.h b/client.h similarity index 100% rename from src/client.h rename to client.h diff --git a/src/config.def.h b/config.def.h similarity index 100% rename from src/config.def.h rename to config.def.h diff --git a/config.mk b/config.mk index 7d1dc14..eb08a05 100644 --- a/config.mk +++ b/config.mk @@ -8,12 +8,6 @@ PREFIX = /usr/local MANDIR = $(PREFIX)/share/man DATADIR = $(PREFIX)/share -SRC = src -BUILD = build -OBJ = $(BUILD)/obj -INCLUDE = $(BUILD)/include -BIN = bin - WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19` WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19` diff --git a/src/dwl.c b/dwl.c similarity index 100% rename from src/dwl.c rename to dwl.c diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 5d48cd6..0000000 --- a/flake.lock +++ /dev/null @@ -1,27 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1755922037, - "narHash": "sha256-wY1+2JPH0ZZC4BQefoZw/k+3+DowFyfOxv17CN/idKs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "b1b3291469652d5a2edb0becc4ef0246fff97a7c", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-25.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 3ceb42f..0000000 --- a/flake.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - description = "DWL Development Shell"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; - }; - - outputs = {nixpkgs, ...}: let - system = "x86_64-linux"; - enableXWayland = false; - in { - devShells."${system}".default = let - pkgs = import nixpkgs { - inherit system; - }; - lib = nixpkgs.lib; - stdenv = pkgs.stdenv; - in - pkgs.mkShell { - packages = with pkgs; - [ - # NativeBuildInputs - installShellFiles - pkg-config - wayland-scanner - - # BuildInputs - libinput - xorg.libxcb - libxkbcommon - pixman - wayland - wayland-protocols - wlroots_0_19 - ] - ++ lib.optionals enableXWayland - [ - # XWayland - xorg.libX11 - xorg.xcbutilwm - xwayland - ]; - - shellHook = let - makeFlags = - lib.strings.concatStringsSep " " - ([ - "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" - "WAYLAND_SCANNER=wayland-scanner" - # "PREFIX=$(out)" - # "MANDIR=$(man)/share/man" - ] - ++ lib.optionals enableXWayland [ - ''XWAYLAND="-DXWAYLAND"'' - ''XLIBS="xcb xcb-icccm"'' - ]); - in '' - TERM=xterm-256color - alias mk='${makeFlags} make' - ''; - }; - }; -} diff --git a/src/util.c b/util.c similarity index 100% rename from src/util.c rename to util.c diff --git a/src/util.h b/util.h similarity index 100% rename from src/util.h rename to util.h