-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
52 lines (37 loc) · 1.04 KB
/
makefile
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
50
51
52
# Define compiler
CC = g++
# Define compile-time options
CFLAGS = -Wall
# Define library paths to be included (-L\..)
LFLAGS =
# Define libraries to link into executable
LIBS = -lwsock32 -lws2_32 -static-libgcc -static-libstdc++
# Define header, library, and object directories
IDIR = .\include
LDIR = .\lib
ODIR = .\obj
SDIR = .\src
# Define the executable file
MAIN = server.exe
# Define source files
SRCS = server_main.cpp server_functions.cpp server_commands.cpp
#SRCS = $(patsubst %,$(SDIR)\%,$(_SRCS))
# Define header files
DEPS = server_functions.h server_commands.h command_def.h
#DEPS = $(patsubst %,$(IDIR)\%,$(_DEPS))
# Define object files
OBJS = $(SRCS:.cpp=.o)
#OBJS = $(patsubst %,$(ODIR)\%,$(_OBJ))
all: $(MAIN)
# Compile source codes into objects
%.o: %.cpp $(DEPS)
$(CC) -c $(CFLAGS) $< -o $@
# Compile objects into executable
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) $^ -o $(MAIN) $(LFLAGS) $(LIBS)
# Clean up objects
.PHONY: clean
clean:
@echo "Cleaning up..."
rm -f *.o
rm -f *~