-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (41 loc) · 1.23 KB
/
Makefile
File metadata and controls
51 lines (41 loc) · 1.23 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
# Makefile for plexmon
CC = cc
CFLAGS = -I/usr/local/include -Wall -Wextra -g -o2 -flto
LDFLAGS = -L/usr/local/lib -lcurl -ljson-c
# Source and header files
SRC = src/main.c src/config.c src/monitor.c src/plexapi.c src/events.c src/dircache.c src/utilities.c src/logger.c src/queue.c
OBJ = $(SRC:.c=.o)
TARGET = plexmon
# Installation directories
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
ETCDIR = $(PREFIX)/etc
RCDIR = $(ETCDIR)/rc.d
# Default target
all: $(TARGET)
# Compile source files with header dependencies
%.o: %.c $(SRC)
$(CC) $(CFLAGS) -c $< -o $@
# Link object files
$(TARGET): $(OBJ)
$(CC) $(OBJ) $(LDFLAGS) -o $(TARGET)
strip $(TARGET)
# Install the program
install: $(TARGET)
install -d $(DESTDIR)$(BINDIR)
install -m 755 $(TARGET) $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(ETCDIR)
install -m 644 etc/plexmon.conf.sample $(DESTDIR)$(ETCDIR)/
install -d $(DESTDIR)$(RCDIR)
install -m 755 etc/plexmon.rc $(DESTDIR)$(RCDIR)/plexmon
# Clean up
clean:
rm -f $(OBJ) $(TARGET)
# Help message
help:
@echo "Available targets:"
@echo " all - Build plexmon"
@echo " install - Install plexmon to $(BINDIR)"
@echo " clean - Remove build files"
@echo " help - Show this help message"
.PHONY: all install clean help