-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
52 lines (41 loc) · 1.59 KB
/
Copy pathmakefile
File metadata and controls
52 lines (41 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# plaque – simple Pango/Cairo/X11 overlay
# Installation paths (override with: make PREFIX=/usr)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man/man1
# Compiler and flags
CC ?= gcc
PKGS := x11 cairo pango pangocairo fontconfig glib-2.0
CFLAGS := -std=c99 -D_GNU_SOURCE -march=native -flto -s -pipe -Wall -Wextra -O2 $(shell pkg-config --cflags $(PKGS))
LDFLAGS := $(shell pkg-config --libs $(PKGS)) -lm
SRC := plaque.c
BIN := plaque
# Sample config (shipped with the source)
SAMPLECONF := plaque.conf.sample
all: $(BIN)
$(BIN): $(SRC)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
install: all
install -Dm755 $(BIN) $(DESTDIR)$(BINDIR)/$(BIN)
# Optionally install man page if you have one
# install -Dm644 plaque.1 $(DESTDIR)$(MANDIR)/plaque.1
# Install sample config to the user's config directory
# Only if no config already exists (safe for repeated installs)
install-config:
@mkdir -p $(HOME)/.config/plaque
@if [ ! -f $(HOME)/.config/plaque/config ]; then \
cp $(SAMPLECONF) $(HOME)/.config/plaque/config; \
echo "Installed default config to $(HOME)/.config/plaque/config"; \
else \
echo "Config already exists at $(HOME)/.config/plaque/config – skipping"; \
fi
# Alternatively, install system-wide example (admin can copy to user's dir)
install-config-system: $(SAMPLECONF)
install -Dm644 $(SAMPLECONF) $(DESTDIR)/etc/plaque/config.example
uninstall:
rm -f $(DESTDIR)$(BINDIR)/$(BIN)
# Remove man page if installed
# rm -f $(DESTDIR)$(MANDIR)/plaque.1
clean:
rm -f $(BIN)
.PHONY: all install install-config install-config-system uninstall clean