2024-05-10 20:34:01 +01:00
|
|
|
# Compiler
|
2024-05-12 14:38:25 +01:00
|
|
|
CC := gcc
|
2024-05-10 20:34:01 +01:00
|
|
|
# Compiler flags
|
|
|
|
CFLAGS := -Wall -Wextra -Werror -Ilibs -fsanitize=address
|
|
|
|
|
|
|
|
# Directories
|
|
|
|
SRCDIR := src
|
|
|
|
BINDIR := bin
|
|
|
|
LIBDIR := libs
|
|
|
|
|
|
|
|
# Source files
|
|
|
|
SRCS := $(wildcard $(SRCDIR)/*.c)
|
|
|
|
# Object files
|
|
|
|
OBJS := $(patsubst $(SRCDIR)/%.c,$(BINDIR)/%.o,$(SRCS))
|
|
|
|
|
|
|
|
# Libraries
|
|
|
|
LIBS := $(wildcard $(LIBDIR)/*/*.c)
|
|
|
|
# Library object files
|
|
|
|
LIBOBJS := $(patsubst %.c,%.o,$(LIBS))
|
|
|
|
|
|
|
|
# Target executables
|
|
|
|
EXECUTABLES := $(patsubst $(SRCDIR)/%,$(BINDIR)/%,$(basename $(wildcard $(SRCDIR)/*/*.c)))
|
|
|
|
|
|
|
|
.PHONY: all clean
|
|
|
|
|
|
|
|
all: $(EXECUTABLES)
|
|
|
|
|
|
|
|
$(BINDIR)/%: $(BINDIR)/%.o $(LIBOBJS)
|
|
|
|
$(CC) $(CFLAGS) $^ -o $@
|
|
|
|
|
|
|
|
$(BINDIR)/%.o: $(SRCDIR)/%.c | $(BINDIR)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(BINDIR):
|
|
|
|
mkdir -p $(BINDIR)
|
|
|
|
|
2024-05-12 13:18:54 +01:00
|
|
|
users:
|
2024-05-12 13:49:26 +01:00
|
|
|
-sudo useradd -M djumbaiq
|
|
|
|
-sudo useradd -M djumbaid
|
|
|
|
-sudo groupadd djumbai_queue
|
|
|
|
-sudo groupadd djumbai_send
|
|
|
|
-sudo usermod -aG djumbai_queue djumbaiq
|
|
|
|
-sudo usermod -aG djumbai_queue djumbaid
|
|
|
|
-sudo usermod -aG djumbai_send djumbaid
|
|
|
|
-sudo usermod -aG djumbai_send root
|
2024-05-12 13:18:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
permissions:
|
2024-05-12 14:38:25 +01:00
|
|
|
-sudo chown djumbaiq:djumbai $(BINDIR)/djumbai_enqueue/djumbai_enqueue
|
2024-05-12 15:30:33 +01:00
|
|
|
-sudo chmod a+s $(BINDIR)/djumbai_enqueue/djumbai_enqueue
|
2024-05-12 14:38:25 +01:00
|
|
|
-sudo chown djumbaid:djumbai_queue $(BINDIR)/djumbai_dequeue/djumbai_dequeue
|
2024-05-12 15:30:33 +01:00
|
|
|
-sudo chmod a+s $(BINDIR)/djumbai_dequeue/djumbai_dequeue
|
2024-05-12 14:38:25 +01:00
|
|
|
-sudo chown root:djumbai_send $(BINDIR)/djumbai_send/djumbai_send
|
2024-05-12 15:30:33 +01:00
|
|
|
-sudo chmod a+s $(BINDIR)/djumbai_send/djumbai_send
|
2024-05-10 20:34:01 +01:00
|
|
|
|
2024-05-12 13:47:13 +01:00
|
|
|
directories:
|
2024-05-12 16:22:11 +01:00
|
|
|
-sudo mkdir -m 050 /djumbai
|
|
|
|
-sudo mkdir -m 070 /djumbai/fifos
|
|
|
|
-sudo mkdir -m 070 /djumbai/user
|
|
|
|
-sudo mkdir -m 070 /djumbai/group
|
|
|
|
-sudo chown nobody:djumbai /djumbai
|
|
|
|
-sudo chown nobody:djumbai /djumbai/fifos
|
|
|
|
-sudo chown nobody:djumbai /djumbai/user
|
|
|
|
-sudo chown nobody:djumbai /djumbai/group
|
2024-05-12 13:49:26 +01:00
|
|
|
|
2024-05-12 13:51:40 +01:00
|
|
|
setup: users permissions directories
|
2024-05-12 13:47:13 +01:00
|
|
|
|
2024-05-10 20:34:01 +01:00
|
|
|
clean:
|
2024-05-12 14:39:24 +01:00
|
|
|
rm -rf $(BINDIR)
|
2024-05-10 20:34:01 +01:00
|
|
|
|