From 9f304641b215b88d77e9113ffd0fdc0acdf04bab Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Thu, 28 Aug 2025 00:11:54 +1000 Subject: [PATCH] Makefile uses Bear to improve clangd --- Makefile | 2 +- config.mk | 3 ++- flake.nix | 10 +++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 663ef22..a9bd94e 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ setup: all: setup $(BIN)/$(BINARY) $(BUILD)/$(BINARY).desktop $(BIN)/$(BINARY): $(call mkobj,main.o util.o) $(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ -$(OBJ)/main.o: $(call mksrc,main.c client.h) config.mk $(call mkinclude,config.h cursor-shape-v1-protocol.h \ +$(OBJ)/main.o: $(call mksrc,main.c) config.mk $(call mkinclude,config.h 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) diff --git a/config.mk b/config.mk index d6a0c5f..2e4b9eb 100644 --- a/config.mk +++ b/config.mk @@ -41,4 +41,5 @@ 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 +# NOTE: Bear is used if available+executable (generate compile_commands.json) +CC = $$([ -x "$$(command -v bear)" ] && echo 'bear -- ') cc diff --git a/flake.nix b/flake.nix index 3ceb42f..f89413a 100644 --- a/flake.nix +++ b/flake.nix @@ -19,12 +19,16 @@ pkgs.mkShell { packages = with pkgs; [ - # NativeBuildInputs + # CryWL Build Utils + gnumake + bear + + # DWL - NativeBuildInputs installShellFiles pkg-config wayland-scanner - # BuildInputs + # DWL - BuildInputs libinput xorg.libxcb libxkbcommon @@ -35,7 +39,7 @@ ] ++ lib.optionals enableXWayland [ - # XWayland + # DWL - XWayland xorg.libX11 xorg.xcbutilwm xwayland