SERVER_DIR := server CLIENT_DIR := client OBJ_DIR := server_obj CLIENT_OBJ_DIR := client_obj BIN_DIR := bin EXE := $(BIN_DIR)/umami CLIENT_EXE = $(BIN_DIR)/client SRC := $(wildcard $(SERVER_DIR)/*.c) OBJ := $(SRC:$(SERVER_DIR)/%.c=$(OBJ_DIR)/%.o) 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 CFLAGS += $(NIX_CFLAGS_COMPILE) .PHONY: all clean all: $(EXE) $(CLIENT_EXE) $(EXE): $(OBJ) | $(BIN_DIR) $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(CLIENT_EXE): $(CLIENT_OBJ) | $(BIN_DIR) $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(OBJ_DIR)/%.o: $(SERVER_DIR)/%.c | $(OBJ_DIR) $(CC) $(CFLAGS) -c $< -o $@ $(CLIENT_OBJ_DIR)/%.o: $(CLIENT_DIR)/%.c | $(CLIENT_OBJ_DIR) $(CC) $(CFLAGS) -c $< -o $@ $(BIN_DIR) $(OBJ_DIR): mkdir -p $@ clean: @$(RM) -rv $(BIN_DIR) $(OBJ_DIR) result -include $(OBJ:.o=.d)