-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (38 loc) Β· 1.31 KB
/
Makefile
File metadata and controls
51 lines (38 loc) Β· 1.31 KB
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
CC = gcc
CFLAGS = -std=c99 -Wall -Wextra -g -Iinclude
TARGET = database
TEST_TARGET = test_db
SERVER_TARGET = server
SRC = main2.c src/storage.c src/table.c src/query.c
OBJ = src/storage.o src/table.o src/query.o
TEST_SRC = tests/test_db.c src/storage.c
TEST_OBJ = $(TEST_SRC:.c=.o)
SERVER_SRC = server.c src/storage.c src/table.c src/query.c
SERVER_OBJ = $(SERVER_SRC:.c=.o)
all: $(TARGET)
$(TARGET): $(OBJ) main2.o
$(CC) $(CFLAGS) -o $@ $^
$(TEST_TARGET): $(TEST_OBJ)
$(CC) $(CFLAGS) -o $@ $^
$(SERVER_TARGET): $(SERVER_OBJ)
$(CC) $(CFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
run: all
@echo "π Eseguendo diagnosi con Valgrind..."
@valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./$(TARGET)
@echo "β
Nessun memory leak trovato!"
@./$(TARGET)
test: $(TEST_TARGET)
@echo "π Eseguendo test con Valgrind..."
@valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./$(TEST_TARGET)
@echo "β
Nessun memory leak trovato! Ora eseguo i test..."
@./$(TEST_TARGET)
run-server: $(SERVER_TARGET)
@echo "π Avvio del server C..."
@./$(SERVER_TARGET)
clean:
rm -f $(OBJ) $(TEST_OBJ) main2.o $(TARGET) $(TEST_TARGET) database.txt database_test.txt database_test_extended.txt
clean-server:
rm -f $(OBJ) $(SERVER_OBJ) main2.o $(TARGET) $(SERVER_TARGET)
rebuild: clean all