-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
40 lines (30 loc) · 1.01 KB
/
Copy pathmakefile
File metadata and controls
40 lines (30 loc) · 1.01 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
.PRECIOUS: object/%.o object/test_%.o
BIN_DIR = binary
INC_DIR = include
LIB_DIR = library
OBJ_DIR = object
SRC_DIR = source
DEP_DIR = dependencies
TEST_DIR = tests
TARGETS = data entry list serialization table
EXECS = $(foreach target,$(TARGETS),$(BIN_DIR)/test_$(target))
OBJS = $(foreach target,$(TARGETS),$(OBJ_DIR)/test_$(target).o)
binary/test_data :=
binary/test_entry := object/data.o
binary/test_list := object/data.o object/entry.o
binary/test_serialization := object/data.o object/entry.o object/list.o
binary/test_table := object/data.o object/list.o object/entry.o
CC = gcc
# CFLAGS = -Wall -Werror -g -MMD -MP -MF -I $(INC_DIR)
CFLAGS = -Wall -Werror -g -I $(INC_DIR)
compile: $(EXECS)
$(BIN_DIR)/test_%: $($@) $(OBJ_DIR)/test_%.o $(OBJ_DIR)/%.o
$(CC) $^ $($@) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJ_DIR)/test_%.o: $(SRC_DIR)/test_%.c
$(CC) $(CFLAGS) -c $< -o $@
# Include makefiles from dependencies
include $(wildcard $(DEP_DIR)/*.d)
clean:
rm $(OBJ_DIR)/*.o $(BIN_DIR)/test_*