summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorauric <auric@japegames.com>2026-02-21 11:08:36 -0600
committerauric <auric@japegames.com>2026-02-21 11:08:36 -0600
commit0d706ae72ceefd74053ad6cb0900ecce6cf1f085 (patch)
tree6faf7d3919182b8838a6ae69ad1a2a0fac468740 /Makefile
Add Umbrella 0.1.5
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile57
1 files changed, 57 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7cfa4a1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,57 @@
+# ── umbrella Makefile ─────────────────────────────────────────────────────────
+
+CC = gcc
+CFLAGS = -Wall -Wextra -Wpedantic -std=c11 -D_GNU_SOURCE \
+ -O2 -g
+LDFLAGS = -lyaml
+
+DAEMON_SRCS = \
+ src/main.c \
+ src/daemon.c \
+ src/unit.c \
+ src/proto.c \
+ src/client.c \
+ src/log.c \
+ src/log_tail.c \
+ src/console/rcon.c
+
+CLI_SRCS = clients/umbrella-cli/main.c
+
+DAEMON_OBJS = $(DAEMON_SRCS:.c=.o)
+CLI_OBJS = $(CLI_SRCS:.c=.o)
+
+.PHONY: all clean install
+
+all: umbrella umbrella-cli
+
+umbrella: $(DAEMON_OBJS)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+umbrella-cli: $(CLI_OBJS)
+ $(CC) $(CFLAGS) -o $@ $^
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+# ── Install ───────────────────────────────────────────────────────────────────
+PREFIX ?= /usr/local
+CONF_DIR = /etc/umbrella
+UNITS_DIR = /etc/umbrella/units
+RUN_DIR = /run/umbrella
+LOG_DIR = /var/log/umbrella
+
+install: all
+ install -Dm755 umbrella $(PREFIX)/sbin/umbrella
+ install -Dm755 umbrella-cli $(PREFIX)/bin/umbrella-cli
+ install -dm755 $(CONF_DIR)
+ install -dm755 $(UNITS_DIR)
+ install -dm755 $(RUN_DIR)
+ install -dm755 $(LOG_DIR)
+ @if [ ! -f $(CONF_DIR)/umbrella.conf ]; then \
+ install -Dm644 umbrella.conf.example $(CONF_DIR)/umbrella.conf; \
+ echo "Installed default config to $(CONF_DIR)/umbrella.conf"; \
+ fi
+ @echo "Done. Edit $(CONF_DIR)/umbrella.conf and add unit files to $(UNITS_DIR)/"
+
+clean:
+ rm -f $(DAEMON_OBJS) $(CLI_OBJS) umbrella umbrella-cli