-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (43 loc) · 1.29 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
52
53
54
55
# Compiler
CC = gcc
# Compiler and optimization flags
CFLAGS ?= -Wall -O2
CFLAGS += $(shell pkg-config --cflags gtk4)
CFLAGS += -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_0 -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0
LDFLAGS ?=
LDFLAGS += $(shell pkg-config --libs gtk4)
# Source files
SRC = ssdd.c resources.c
# Output executable
TARGET = ssdd
# Resource files
RESOURCE_XML = resources.gresource.xml
RESOURCE_C = resources.c
RESOURCE_H = resources.h
# Installation directories
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
DATADIR = $(PREFIX)/share/ssdd
# Default target
all: $(TARGET)
# Build the target
$(TARGET): $(RESOURCE_C) $(SRC)
$(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LDFLAGS)
# Compile resources
$(RESOURCE_C) $(RESOURCE_H): $(RESOURCE_XML)
glib-compile-resources $(RESOURCE_XML) --generate-source --target=$(RESOURCE_C)
glib-compile-resources $(RESOURCE_XML) --generate-header --target=$(RESOURCE_H)
# Install target
install: $(TARGET)
install -d $(DESTDIR)$(BINDIR)
install -m 755 $(TARGET) $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(DATADIR)
install -m 644 $(RESOURCE_XML) $(DESTDIR)$(DATADIR)
# Uninstall target
uninstall:
rm -f $(DESTDIR)$(BINDIR)/$(TARGET)
rm -rf $(DESTDIR)$(DATADIR)
# Clean target
clean:
rm -f $(TARGET) $(RESOURCE_C) $(RESOURCE_H)
.PHONY: all clean install uninstall