summaryrefslogtreecommitdiff
path: root/contrib/vdr2jpeg/Makefile
blob: a113a1b45bf61c11f18f085b4c0a572a8a8ed06f (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
################################################################################
#
# Makefile -- for building vdr2jpeg
#
# Copyright (c) 2005-2010 Andreas Brachold
#
# This code is distributed under the terms and conditions of the
# GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
#


# You can change the compile options here 
# or add options at own file Make.config


# Build ffmpeg e.g. with ./configure --enable-shared --enable-swscale
#FFMDIR = /usr/local/include/ffmpeg

# Build with debugging symbol and lots of dumped messages
#DEBUG = 1

# Build full static paket, if ffmpeg configured without --enable-shared
# you should defined FFMDIR 
#STATIC = 1

# Place where vdr2jpeg should installed
INSTALLBINDIR ?= /usr/local/bin

# Place where should package created, need some space.
TMPDIR = /tmp

################################################################################
#
# there none user configurable options below this point
#
################################################################################
ifdef DESTDIR
INSTALLDIR = $(DESTDIR)/$(INSTALLBINDIR)
else
INSTALLDIR = $(INSTALLBINDIR)
endif
################################################################################
# Compiler/linker settings
CXX      ?= g++
STRIP    ?= strip
PKG-CONFIG ?= pkg-config

# Allow user defined options to overwrite defaults:
-include Make.config

# General settings:

ifdef DEBUG
	CXXFLAGS ?= -O0
	CXXFLAGS += -g -ggdb
	LDFLAGS += -g -ggdb
	DEFINES += -DDEBUG
else
	CXXFLAGS ?= -O2
endif
CXXFLAGS += -fPIC -Wall -Woverloaded-virtual

ifdef FFMDIR
INCLUDES += -I$(FFMDIR) 
LIBS += -L$(FFMDIR) -L$(FFMDIR)/libavformat -L$(FFMDIR)/libavcodec -L$(FFMDIR)/libavutil -L$(FFMDIR)/libswscale
LIBS += -lavformat -lavcodec -lavutil -lswscale
else
ifeq ($(shell $(PKG-CONFIG) --exists libavformat && echo 1), 1)
INCLUDES += $(shell $(PKG-CONFIG) --cflags libavformat libavcodec libavutil libswscale)
LIBS += $(shell $(PKG-CONFIG) --libs libavformat libavcodec libavutil libswscale)
endif
endif


ifdef STATIC
    CXXFLAGS += -static
endif

################################################################################
# Target configuration

PRGNAME = vdr2jpeg
VERSION = $(shell grep 'static const char \*VERSION *=' vdr2jpeg.cpp | awk '{ print $$6 }' | sed -e 's/[";]//g')
ARCHIVE = $(PRGNAME)-$(VERSION)
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
FILES = README LIESMICH HISTORY COPYING Makefile \
	vdr2jpeg.cpp \
	gop.cpp gop.h \
	mpegdec.cpp mpegdec.h \
	ffm.cpp ffm.h \
	tools.cpp tools.h
OBJS = vdr2jpeg.o tools.o gop.o mpegdec.o ffm.o

################################################################################
# Implicit rules:

%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<


################################################################################
# Main targets :

all:    vdr2jpeg
.PHONY: all

vdr2jpeg: $(OBJS)
	$(CXX) $(CXXFLAGS) $(OBJS) $(LIBS) -o vdr2jpeg
ifndef DEBUG
	$(STRIP) $@	
endif

install: all
	install -d $(INSTALLDIR)
	install -m 755 -o root -g root -s vdr2jpeg $(INSTALLDIR)

uninstall:
	rm -f $(INSTALLDIR)/vdr2jpeg

clean:
	@-rm -f vdr2jpeg a.out *.o *.tgz core* *~

distclean:  clean
	@-rm -f *.jpg *.mpv

dist:	distclean
	@-rm -rf $(TMPDIR)/$(ARCHIVE)
	@mkdir -p $(TMPDIR)/$(ARCHIVE)
	@cp -a $(FILES) $(TMPDIR)/$(ARCHIVE)
	@find $(TMPDIR)/$(ARCHIVE) -type d -exec chmod 755 {} \;
	@find $(TMPDIR)/$(ARCHIVE) -type f -exec chmod 644 {} \;
	@chown root.root -R $(TMPDIR)/$(ARCHIVE)/*
	@tar czfh $(ARCHIVE).tgz -C $(TMPDIR) $(ARCHIVE) 
	@-rm -rf $(TMPDIR)/$(ARCHIVE)
	@echo Distribution package created as $(ARCHIVE).tgz