# Compiler CC := gcc # 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) users: -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 permissions: -sudo chown djumbaiq:djumbai $(BINDIR)/djumbai_enqueue/djumbai_enqueue -sudo chmod u+s $(BINDIR)/djumbai_enqueue/djumbai_enqueue -sudo chown djumbaid:djumbai_queue $(BINDIR)/djumbai_dequeue/djumbai_dequeue -sudo chmod u+s $(BINDIR)/djumbai_dequeue/djumbai_dequeue -sudo chown root:djumbai_send $(BINDIR)/djumbai_send/djumbai_send -sudo chmod u+s $(BINDIR)/djumbai_send/djumbai_send directories: -sudo mkdir -m 050 /opt/djumbai -sudo mkdir -m 070 /opt/djumbai/fifos -sudo mkdir -m 070 /opt/djumbai/user -sudo mkdir -m 070 /opt/djumbai/group -sudo chown nobody:djumbai /opt/djumbai -sudo chown nobody:djumbai /opt/djumbai/fifos -sudo chown nobody:djumbai /opt/djumbai/user -sudo chown nobody:djumbai /opt/djumbai/group setup: users permissions directories clean: rm -rf $(BINDIR)