blob: 4b603149ab30dee808d22c77045c76631b631e4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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)
|