aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 32 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 4b60314..287a5d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,43 +1,54 @@
-SERVER_DIR := server
-CLIENT_DIR := client
-OBJ_DIR := server_obj
-CLIENT_OBJ_DIR := client_obj
+SRC_DIR := src/common
+OBJ_DIR := obj
+RAMEN_OBJ_DIR := ramen_obj
+MSG_OBJ_DIR := msg_obj
BIN_DIR := bin
-EXE := $(BIN_DIR)/umami
-CLIENT_EXE = $(BIN_DIR)/client
+RAMEN_DIR := src/ramen
+MSG_DIR := src/msg
-SRC := $(wildcard $(SERVER_DIR)/*.c)
-OBJ := $(SRC:$(SERVER_DIR)/%.c=$(OBJ_DIR)/%.o)
+RAMEN_EXE := $(BIN_DIR)/ramen
+MSG_EXE := $(BIN_DIR)/msg
-CLIENT_SRC := $(wildcard $(CLIENT_DIR/*.c))
-CLIENT_OBJ := $(CLIENT_SRC:$(CLIENT_DIR)/%.c=$(OBJ_DIR)/%.o)
-
-CFLAGS := -Wall -Iinclude -lcrypto -lssl
-LDFLAGS := -Llib
-LDLIBS := -lm
+SRC := $(wildcard $(SRC_DIR)/*.c)
+OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
+CFLAGS := -Wall -lcrypto -lssl
CFLAGS += $(NIX_CFLAGS_COMPILE)
+
+RAMEN_SRC := $(wildcard $(RAMEN_DIR)/*.c)
+RAMEN_OBJ := $(RAMEN_SRC:$(RAMEN_DIR)/%.c=$(RAMEN_OBJ_DIR)/%.o)
+
+MSG_SRC := $(wildcard $(MSG_DIR)/*.c)
+MSG_OBJ := $(MSG_SRC:$(MSG_DIR)/%.c=$(MSG_OBJ_DIR)/%.o)
+
+LDFLAGS :=
+LDLIBS :=
+LDFLAGS += $(NIX_LDFLAGS_COMPILE)
+
.PHONY: all clean
-all: $(EXE) $(CLIENT_EXE)
+all: $(RAMEN_EXE) $(MSG_EXE)
-$(EXE): $(OBJ) | $(BIN_DIR)
+$(RAMEN_EXE): $(OBJ) $(RAMEN_OBJ) | $(BIN_DIR)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
-$(CLIENT_EXE): $(CLIENT_OBJ) | $(BIN_DIR)
+$(RAMEN_OBJ_DIR)/%.o: $(RAMEN_DIR)/%.c | $(RAMEN_OBJ_DIR)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(MSG_EXE): $(OBJ) $(MSG_OBJ) | $(BIN_DIR)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
-$(OBJ_DIR)/%.o: $(SERVER_DIR)/%.c | $(OBJ_DIR)
+$(MSG_OBJ_DIR)/%.o: $(MSG_DIR)/%.c | $(MSG_OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
-$(CLIENT_OBJ_DIR)/%.o: $(CLIENT_DIR)/%.c | $(CLIENT_OBJ_DIR)
+$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
-$(BIN_DIR) $(OBJ_DIR):
+$(BIN_DIR) $(OBJ_DIR) $(MSG_OBJ_DIR) $(RAMEN_OBJ_DIR):
mkdir -p $@
clean:
- @$(RM) -rv $(BIN_DIR) $(OBJ_DIR) result
+ @$(RM) -rv $(BIN_DIR) $(OBJ_DIR) $(MSG_OBJ_DIR) $(RAMEN_OBJ_DIR) result
-include $(OBJ:.o=.d)