mediatools/Makefile

45 lines
1 KiB
Makefile
Raw Normal View History

2020-02-04 23:32:59 +00:00
RM := rm -f
CFLAGS := -O3 -Wall -Isrc -I/usr/include/ffmpeg
2020-05-19 00:37:19 +00:00
LIBS := -lavformat -lavutil -lavcodec -lswscale
2020-02-04 23:32:59 +00:00
LDFLAGS :=
INSTALL ?= install
PREFIX ?= /usr/local
2020-05-19 00:37:19 +00:00
COMMON_OBJECTS := build/validation.o build/png.o
2020-02-04 23:32:59 +00:00
MEDIASTAT_OBJECTS := build/stat.o
2020-05-19 00:37:19 +00:00
MEDIATHUMB_OBJECTS := build/thumb.o
2020-02-04 23:32:59 +00:00
# Phony rules
.PHONY: all mediastat clean
2020-05-19 00:37:19 +00:00
all: mediastat mediathumb
2020-02-04 23:32:59 +00:00
install: all
$(INSTALL) build/mediastat $(PREFIX)/bin/mediastat
2020-05-19 00:37:19 +00:00
$(INSTALL) build/mediathumb $(PREFIX)/bin/mediathumb
2020-02-04 23:32:59 +00:00
uninstall:
$(RM) -rf $(PREFIX)/bin/mediastat
2020-05-19 00:37:19 +00:00
$(RM) -rf $(PREFIX)/bin/mediathumb
2020-02-04 23:32:59 +00:00
mediastat: build/mediastat
2020-05-19 00:37:19 +00:00
mediathumb: build/mediathumb
2020-02-04 23:32:59 +00:00
clean:
2020-05-19 00:37:19 +00:00
$(RM) $(COMMON_OBJECTS) $(MEDIASTAT_OBJECTS)$(MEDIATHUMB_OBJECTS)
2020-02-04 23:32:59 +00:00
# Build rules
build/mediastat: $(COMMON_OBJECTS) $(MEDIASTAT_OBJECTS)
$(CC) $^ $(LDFLAGS) $(LIBS) -o $@
2020-05-19 00:37:19 +00:00
build/mediathumb: $(COMMON_OBJECTS) $(MEDIATHUMB_OBJECTS)
$(CC) $^ $(LDFLAGS) $(LIBS) -o $@
2020-02-04 23:32:59 +00:00
build/%.o: src/%.c
$(CC) $(CFLAGS) -MMD -c $< -o $@
# Declare dependencies
-include $(COMMON_OBJECTS:.o=.d)
-include $(MEDIASTAT_OBJECTS:.o=.d)