-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (29 loc) · 982 Bytes
/
Makefile
File metadata and controls
40 lines (29 loc) · 982 Bytes
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
CC = gcc
PKG_CONFIG := pkg-config
GLIB_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
GLIB_LIBS := $(shell $(PKG_CONFIG) --libs glib-2.0)
CFLAGS = -Wall -g -fsanitize=address -Iinclude $(GLIB_CFLAGS)
LDFLAGS = $(GLIB_LIBS) -fsanitize=address
# Lista de todos os arquivos fonte
SRC = $(wildcard src/*.c)
OBJ = $(patsubst src/%.c, obj/%.o, $(SRC))
# Targets dos executáveis
SERVER_EXEC = bin/dserver
CLIENT_EXEC = bin/dclient
# Regras principais
all: folders $(SERVER_EXEC) $(CLIENT_EXEC)
#server: folders $(SERVER_EXEC)
#client: folders $(CLIENT_EXEC)
folders:
@mkdir -p obj bin tmp
# Compilar dserver
$(SERVER_EXEC): obj/dserver.o obj/utils.o obj/server_helpers.o obj/cache.o
$(CC) $^ -o $@ $(LDFLAGS)
# Compilar dclient
$(CLIENT_EXEC): obj/dclient.o obj/utils.o obj/server_helpers.o obj/cache.o
$(CC) $^ -o $@ $(LDFLAGS)
# Regra geral para compilar objetos
obj/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf obj/* bin/* tmp/* obj bin tmp meta_info.txt