-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (47 loc) · 1007 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
56
57
.SUFFIXES:
.DEFAULT:
.EXTRA_PREREQS:= $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFLAGS += -r --no-print-directory
BUILDDIR ?= build
CC ?= cc
CFLAGS += -std=gnu99 -Wall -Wextra -Werror -pedantic
LDFLAGS +=
ifeq ($(DEBUG), 1)
CONFIG = debug
CFLAGS += -O0 -ggdb3
else ifeq ($(ASAN), 1)
CONFIG = asan
CFLAGS += -O0 -ggdb3 -fsanitize=address
LDFLAGS += -fsanitize=address
else
CONFIG = release
CFLAGS += -O3
endif
DEPFLAGS = -MMD -MP
COMPILE.c = $(CC) $(CFLAGS) $(DEPFLAGS) -MT $@ -MF $@.d
OBJDIR ?= $(BUILDDIR)/$(CONFIG)
all: $(OBJDIR)/malincam
$(OBJDIR)/%.c.o: %.c
@mkdir -p $(dir $@)
$(COMPILE.c) -c $< -o $@
SOURCES += \
src/Node.c \
src/Pilatform.c \
src/UVC.c \
src/V4l2Control.c \
src/device.c \
src/Led.c \
src/main.c \
src/pollinator.c \
src/pump.c \
src/queue.c \
src/subdev.c \
src/v4l2-print.c \
OBJS = $(SOURCES:%=$(OBJDIR)/%.o)
DEPS = $(OBJS:%=%.d)
-include $(DEPS)
$(OBJDIR)/malincam: $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
clean:
rm -rf $(BUILDDIR)
.PHONY: all clean