-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
56 lines (39 loc) · 831 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
48
49
50
51
52
53
54
55
NAME = Datalogger
CC = gcc
LD = gcc
DEFINES =
C_OPTS = -std=gnu99 -g -Werror
LIBS = -lm
SOURCE_DIR = .
BUILD_DIR = Build
all: build
C_FILES = AD7608.c \
AD7608Source.c \
Config.c \
CS5467.c \
CS5467Source.c \
Evaluator.c \
I2C.c \
INA220.c \
INA220Source.c \
INA226.c \
INA226Source.c \
jsmn.c \
Main.c \
Measure.c \
Registers.c \
TimeSource.c
C_OBJS = $(C_FILES:%.c=$(BUILD_DIR)/%.o)
ALL_CFLAGS = $(C_OPTS) $(DEFINES) $(CFLAGS)
ALL_LDFLAGS = $(LD_FLAGS)
AUTODEPENDENCY_CFLAGS=-MMD -MF$(@:.o=.d) -MT$@
build: $(NAME)
.SUFFIXES: .o .c
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(ALL_CFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o $@
$(NAME): $(C_OBJS)
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
clean:
rm -rf $(BUILD_DIR) $(NAME)
-include $(C_OBJS:.o=.d)