Nimbin[12]?Sway / SwBr / Makefile

SwBr git · main

SwBr - status bar for sway

sway wayland c bar · first commit 2026-08-27 · last commit 2026-10-05 (4 days ago) · synced 3 days ago · upstream: github.com/nimbin2/SwBr

C 95.9% Markdown 3.7%
git clone https://git.christianimmanuel.de/sway/SwBr.gitwget https://git.christianimmanuel.de/sway/SwBr/archive/SwBr.tar.gz
Makefile 1.8 KB · 58 lines raw
PREFIX  ?= /usr
BINDIR  ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share/swbr
CONFDIR ?= $(HOME)/.config/swbr

CC      ?= cc
CFLAGS  ?= -std=c11 -O2 -Wall -Wextra
LDLIBS   = -lwayland-client -lm

# short md5 of the source, compiled in: `swbr --version` then tells you
# exactly which build is running
BUILD   := $(shell md5sum swbr.c 2>/dev/null | cut -c1-8)

all: swbr

swbr: swbr.c stb_truetype.h
	$(CC) $(CFLAGS) -DSWBR_BUILD='"$(BUILD)"' -o $@ swbr.c $(LDFLAGS) $(LDLIBS)
	@./$@ --version

stb_truetype.h:
	@echo "missing $@ — drop the vendored header next to the source"
	@echo "(the same one appwheel uses)"
	@false

debug: swbr.c stb_truetype.h
	$(CC) -std=c11 -g -O0 -Wall -Wextra -fsanitize=address,undefined \
		-DSWBR_BUILD='"$(BUILD)-dbg"' -o swbr-debug swbr.c $(LDFLAGS) $(LDLIBS)

install: swbr
	install -Dm755 swbr $(DESTDIR)$(BINDIR)/swbr
	install -Dm644 config.example $(DESTDIR)$(DATADIR)/config.example
	install -Dm644 config.advanced.example $(DESTDIR)$(DATADIR)/config.advanced.example
	@echo "installed $(DESTDIR)$(BINDIR)/swbr"
	@echo "examples  $(DESTDIR)$(DATADIR)/"

# Your own copy: edit it freely, an install never touches it.
config:
	install -d $(CONFDIR)
	[ -f $(CONFDIR)/config ] || install -m644 config.example $(CONFDIR)/config

# The shipped example, live: every install updates what you are running.
# Link the advanced one with  make link EXAMPLE=config.advanced.example
EXAMPLE ?= config.example
link:
	install -d $(CONFDIR)
	ln -sfn $(DATADIR)/$(EXAMPLE) $(CONFDIR)/config
	@echo "$(CONFDIR)/config -> $(DATADIR)/$(EXAMPLE)"

uninstall:
	rm -f $(DESTDIR)$(BINDIR)/swbr
	rm -f $(DESTDIR)$(DATADIR)/config.example
	rm -f $(DESTDIR)$(DATADIR)/config.advanced.example
	-rmdir $(DESTDIR)$(DATADIR) 2>/dev/null || true

clean:
	rm -f swbr swbr-debug

.PHONY: all debug install config link uninstall clean