-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (34 loc) · 893 Bytes
/
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
# Matt McFarland
# Makefile for Hashmap and its test components
# Compiler and compiler flags
CC = gcc
CFLAGS = -Wall -pedantic -std=c11 -g
# Source directory files
SRC_DIR = ./src/
# Source .c files
SRC_FILES = $(SRC_DIR)hashmap.c
SRC_INCS = $(SRC_DIR)hashmap.h
# Should be SRC_FILES with .o
SRC_OBJS = hashmap.o
# Test files
TEST_DIR = ./test/
TEST_SRC = $(TEST_DIR)TestHashMap.c
# Test object files
TEST_OBJS = TestHashMap.o
# Test executable
TEST_EXEC = TestHashMap
test: $(TEST_EXEC)
./$(TEST_EXEC)
verbose: $(TEST_EXEC)
./$(TEST_EXEC) verbose
$(TEST_EXEC): $(TEST_OBJS) $(SRC_OBJS)
$(CC) $(CFLAGS) $(SRC_OBJS) $(TEST_OBJS) -o $(TEST_EXEC)
$(TEST_OBJS): $(SRC_OBJS)
$(CC) $(CFLAGS) -c $(TEST_SRC)
$(SRC_OBJS): $(SRC_FILES) $(SRC_INCS)
$(CC) $(CFLAGS) -c $(SRC_FILES) $(SRC_INCS)
clean:
rm -f $(SRC_OBJS)
rm -f $(TEST_EXEC)
rm -f $(TEST_OBJS)
rm -f $(SRC_DIR)*.gch