-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
51 lines (40 loc) · 1.12 KB
/
Makefile
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
CC = cc
CFLAGS = -O3 -ffast-math -Wall -Wextra -pedantic
CFLAGS += -isystem api/include
LDLIBS = -lxcb -lxcb-keysyms -lxcb-icccm -lxcb-cursor -lxcb-randr -lxcb-composite -lxcb-ewmh -lX11 -lX11-xcb -lGL -lm -lconfig
SRC = ./src/*.c ./src/ipc/*.c
BIN = ragnar
RAGNAR_API = api/lib/ragnar.a
PREFIX = /usr
BINDIR = $(PREFIX)/bin
.PHONY: all
all: $(RAGNAR_API)
mkdir -p ./bin
$(CC) -o bin/$(BIN) $(CFLAGS) $(SRC) $(LDLIBS)
$(RAGNAR_API):
$(MAKE) -C api
SOURCE_DIR := ./cfg/
DEST_DIR := $(HOME)/.config/ragnarwm
CONFIG_FILE := $(DEST_DIR)/ragnar.cfg
.PHONY: config
config:
@if [ ! -f "$(CONFIG_FILE)" ]; then \
echo "Config file does not exist. Copying default config..."; \
mkdir -p "$(DEST_DIR)"; \
cp -r "./cfg/ragnar.cfg" "$(DEST_DIR)"; \
else \
echo "Config file already exists. Skipping copy."; \
fi
.PHONY: install
install:
install -Dm755 bin/$(BIN) -t $(BINDIR)
install -Dm755 ragnarstart -t $(BINDIR)
cp -f ragnar.desktop $(PREFIX)/share/xsessions/
.PHONY: clean
clean:
$(RM) bin/*
.PHONY: uninstall
uninstall:
$(RM) $(BINDIR)/ragnar
$(RM) $(PREFIX)/share/xsessions/ragnar.desktop
$(RM) $(BINDIR)/ragnarstart