-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
44 lines (32 loc) · 1.02 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
40
41
42
43
44
RM := rm -f
CFLAGS := -O3 -Wall -Isrc -I/usr/include/ffmpeg
LIBS := -lavformat -lavutil -lavcodec -lswscale
LDFLAGS :=
INSTALL ?= install
PREFIX ?= /usr/local
COMMON_OBJECTS := build/validation.o build/png.o
MEDIASTAT_OBJECTS := build/stat.o
MEDIATHUMB_OBJECTS := build/thumb.o
# Phony rules
.PHONY: all mediastat clean
all: mediastat mediathumb
install: all
$(INSTALL) build/mediastat $(PREFIX)/bin/mediastat
$(INSTALL) build/mediathumb $(PREFIX)/bin/mediathumb
uninstall:
$(RM) -rf $(PREFIX)/bin/mediastat
$(RM) -rf $(PREFIX)/bin/mediathumb
mediastat: build/mediastat
mediathumb: build/mediathumb
clean:
$(RM) $(COMMON_OBJECTS) $(MEDIASTAT_OBJECTS)$(MEDIATHUMB_OBJECTS)
# Build rules
build/mediastat: $(COMMON_OBJECTS) $(MEDIASTAT_OBJECTS)
$(CC) $^ $(LDFLAGS) $(LIBS) -o $@
build/mediathumb: $(COMMON_OBJECTS) $(MEDIATHUMB_OBJECTS)
$(CC) $^ $(LDFLAGS) $(LIBS) -o $@
build/%.o: src/%.c
$(CC) $(CFLAGS) -MMD -c $< -o $@
# Declare dependencies
-include $(COMMON_OBJECTS:.o=.d)
-include $(MEDIASTAT_OBJECTS:.o=.d)