-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
39 lines (29 loc) · 1.05 KB
/
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
NAME := $(shell basename $(CURDIR))
#------------------------------------------------
BUILD := build
SOURCE := .
#------------------------------------------------
SOURCES := $(shell find $(SOURCE) -name '*.c')
OBJECTS := $(addprefix $(BUILD)/,$(SOURCES:%.c=%.o))
#------------------------------------------------
CFLAGS := -Wall -g $(shell pkg-config libv4l1 --cflags)
LDFLAGS := -lc $(shell pkg-config libv4l1 --libs)
#------------------------------------------------
all: $(NAME)
#------------------------------------------------
#------------------------------------------------
$(NAME): $(OBJECTS)
#------------------------------------------------
@echo Linking...
@$(CC) $(LDFLAGS) $(OBJECTS) -o $(NAME)
@echo Build done.
#------------------------------------------------
$(BUILD)/%.o: %.c
#------------------------------------------------
@echo - $<
@mkdir -p $(BUILD)/$(SOURCE)
@$(CC) $(CFLAGS) -I$(dir $<) -c $< -o $@
#------------------------------------------------
clean:
#------------------------------------------------
@rm -rf $(BUILD) $(NAME)