| 1 |
ifneq ($(shell which xxd),) |
| 2 |
LOGODEP=logo.c seek.c |
| 3 |
else |
| 4 |
LOGODEP=logo.o seek.o |
| 5 |
endif |
| 6 |
|
| 7 |
include ../common.mak |
| 8 |
|
| 9 |
CONFIGTEMP=conf.out |
| 10 |
|
| 11 |
ifeq ($(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --exists libavcodec libavformat libavutil libswscale || echo no), no) |
| 12 |
$(error "http://ffmpeg.org is required - install libavcodec-dev, libswscale-dev, etc") |
| 13 |
endif |
| 14 |
|
| 15 |
ifeq ($(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --exists libpng || echo no), no) |
| 16 |
$(error "libpng is required - install libpng-dev") |
| 17 |
endif |
| 18 |
|
| 19 |
ifeq ($(shell $(CC) ../misc/jpeg-test.c -o $(CONFIGTEMP) $(ARCHINCLUDES) $(LDFLAGS) -ljpeg 2>/dev/null || echo no; $(RM) -f $(CONFIGTEMP)), no) |
| 20 |
$(error "libjpeg is required - install libjpeg-dev, libjpeg8-dev or libjpeg62-dev") |
| 21 |
endif |
| 22 |
|
| 23 |
FLAGS=-I../libharvid/ |
| 24 |
FLAGS+=$(ARCHINCLUDES) $(ARCHFLAGS) |
| 25 |
FLAGS+=`pkg-config --cflags libavcodec libavformat libavutil libpng libswscale` |
| 26 |
|
| 27 |
LOADLIBES=$(ARCHLIBES) |
| 28 |
LOADLIBES+=`pkg-config --libs libavcodec libavformat libavutil libpng libswscale` |
| 29 |
LOADLIBES+=-ljpeg |
| 30 |
LOADLIBES+=-lz -lm |
| 31 |
|
| 32 |
FLAGS+=-DICSVERSION="\"$(VERSION)\"" -DICSARCH="\"$(UNAME)\"" |
| 33 |
|
| 34 |
all: harvid |
| 35 |
|
| 36 |
HARVID_H = \ |
| 37 |
daemon_log.h daemon_util.h \ |
| 38 |
socket_server.h \ |
| 39 |
enums.h \ |
| 40 |
favicon.h \ |
| 41 |
ics_handler.h httprotocol.h htmlconst.h \ |
| 42 |
image_format.h \ |
| 43 |
../libharvid/vinfo.h \ |
| 44 |
../libharvid/frame_cache.h \ |
| 45 |
../libharvid/image_cache.h\ |
| 46 |
../libharvid/ffdecoder.h \ |
| 47 |
../libharvid/decoder_ctrl.h \ |
| 48 |
../libharvid/ffcompat.h \ |
| 49 |
../libharvid/timecode.h |
| 50 |
|
| 51 |
HARVID_SRC = \ |
| 52 |
harvid.c \ |
| 53 |
daemon_log.c daemon_util.c \ |
| 54 |
fileindex.c htmlseek.c \ |
| 55 |
httprotocol.c ics_handler.c \ |
| 56 |
image_format.c \ |
| 57 |
socket_server.c \ |
| 58 |
../libharvid/libharvid.a |
| 59 |
|
| 60 |
ifneq ($(shell which xxd),) |
| 61 |
FLAGS+=-DXXDI |
| 62 |
|
| 63 |
logo.c: ../doc/harvid.jpg |
| 64 |
xxd -i ../doc/harvid.jpg > logo.c |
| 65 |
|
| 66 |
seek.c: ../doc/seek.js |
| 67 |
xxd -i ../doc/seek.js > seek.c |
| 68 |
|
| 69 |
logo.o: ../doc/harvid.jpg |
| 70 |
xxd -i ../doc/harvid.jpg | $(CC) -x c - -c -o logo.o |
| 71 |
|
| 72 |
seek.o: ../doc/seek.js |
| 73 |
xxd -i ../doc/seek.js | $(CC) -x c - -c -o seek.o |
| 74 |
|
| 75 |
else |
| 76 |
|
| 77 |
logo.o: ../doc/harvid.jpg |
| 78 |
$(LD) -r -b binary -o logo.o ../doc/harvid.jpg |
| 79 |
|
| 80 |
seek.o: ../doc/seek.js |
| 81 |
$(LD) -r -b binary -o seek.o ../doc/seek.js |
| 82 |
|
| 83 |
endif |
| 84 |
|
| 85 |
harvid: $(HARVID_SRC) $(HARVID_H) $(LOGODEP) |
| 86 |
export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH);\ |
| 87 |
$(CC) -o $(@) $(CFLAGS) $(FLAGS) $(HARVID_SRC) $(LOGODEP) $(LDFLAGS) $(LOADLIBES) |
| 88 |
|
| 89 |
clean: |
| 90 |
rm -f harvid logo.c logo.o seek.c seek.o cscope.* tags |
| 91 |
|
| 92 |
man: harvid |
| 93 |
help2man -N -n 'video server' -o ../doc/harvid.1 ./harvid |
| 94 |
|
| 95 |
install: install-bin |
| 96 |
|
| 97 |
uninstall: uninstall-bin |
| 98 |
|
| 99 |
install-bin: harvid |
| 100 |
install -d $(DESTDIR)$(bindir) |
| 101 |
install -m755 harvid $(DESTDIR)$(bindir) |
| 102 |
|
| 103 |
uninstall-bin: |
| 104 |
rm -f $(DESTDIR)$(bindir)/harvid |
| 105 |
-rmdir $(DESTDIR)$(bindir) |
| 106 |
|
| 107 |
install-man: |
| 108 |
|
| 109 |
uninstall-man: |
| 110 |
|
| 111 |
install-lib: |
| 112 |
|
| 113 |
uninstall-lib: |
| 114 |
|
| 115 |
.PHONY: all install uninstall install-man uninstall-man install-bin uninstall-bin install-lib uninstall-lib |