-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.server
49 lines (39 loc) · 1016 Bytes
/
Makefile.server
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
44
45
46
47
48
49
TARGET = server
FILENAME = server
CC = gcc
LD = ld
FORMATTER = clang-format-3.8
FORMATTER_ARGS = -i -style=file
INC_DIR = include
OBJ_DIR = obj
SRC_DIR = src
OUT_DIR = out
CFLAGS = -Wall -g
CFLAGS += -I./$(INC_DIR)
CFLAGS += `pkg-config --cflags glib-2.0`
#CFLAGS += -I/usr/include/glib-2.0
#CFLAGS += -I/usr/lib/glib-2.0/include
LIBS = -lm
LIBS += -lpthread
LIBS += -L/usr/lib
LIBS += `pkg-config --libs glib-2.0`
SRC = $(SRC_DIR)/$(FILENAME).c
OBJ = $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(SRC:.c=.o))
$(OBJ_DIR)/%.o : $(SRC)
@echo " [CC] $<"
$(CC) $(CFLAGS) -c $< -o $@
$(TARGET) : $(OBJ)
@echo " [LD] $@"
$(CC) -o $(OUT_DIR)/$@ $^ $(LIBS)
# To start over from scratch, type 'make clean'. This
# removes the executable file, as well as old .o object
# files and *~ backup files:
clean:
@echo " [RM] $(OBJ)"
@$(RM) $(OBJ)
@echo " [RM] $(TARGET) "
@$(RM) $(OUT_DIR)/$(TARGET)
@$(RM) $(SRC_DIR)/.*~ $(SRC_DIR)/*~
@$(RM) $(INC_DIR)/.*~ $(INC_DIR)/*~
@$(RM) ./.*~
.PHONY: clean