diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 57 |
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 |
