]> git.vomp.tv Git - vompserver.git/blob - Makefile
Add forgotten vdrcommand.h changes
[vompserver.git] / Makefile
1 #
2 # Makefile for a Video Disk Recorder plugin
3 #
4 # $Id$
5
6 # The official name of this plugin.
7 # This name will be used in the '-P...' option of VDR to load the plugin.
8 # By default the main source file also carries this name.
9
10 PLUGIN = vompserver
11
12 ### The version number of this plugin (taken from the main source file):
13
14 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
15
16 ### The directory environment:
17
18 # Use package data if installed...otherwise assume we're under the VDR source directory:
19 PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
20 LIBDIR = $(call PKGCFG,libdir)
21 LOCDIR = $(call PKGCFG,locdir)
22 PLGCFG = $(call PKGCFG,plgcfg)
23 #
24 TMPDIR ?= /tmp
25
26 ### The compiler options:
27
28 export CFLAGS   = $(call PKGCFG,cflags)
29 export CXXFLAGS = $(call PKGCFG,cxxflags)
30
31 ### The version number of VDR's plugin API:
32
33 APIVERSION = $(call PKGCFG,apiversion)
34
35 ### Allow user defined options to overwrite defaults:
36
37 -include $(PLGCFG)
38
39 # VOMP-INSERT
40 -include .standalone
41 # END-VOMP-INSERT
42
43 ### The name of the distribution archive:
44
45 ARCHIVE = $(PLUGIN)-$(VERSION)
46 PACKAGE = vdr-$(ARCHIVE)
47
48 ### The name of the shared object file:
49
50 SOFILE = libvdr-$(PLUGIN).so
51
52 ### Includes and Defines (add further entries here):
53
54 INCLUDES +=
55
56 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
57
58 # VOMP-INSERT
59 DEFINES += -DVOMPSERVER
60 # END-VOMP-INSERT
61
62 ### The object files (add further files here):
63
64 OBJS = $(PLUGIN).o
65
66 # VOMP-INSERT
67 OBJS += dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
68                    ringbuffer.o mvprelay.o vompclientrrproc.o \
69                    config.o log.o thread.o tftpclient.o \
70                    media.o responsepacket.o \
71                    mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o \
72                    picturereader.o
73
74 OBJS2 = recplayer.o mvpreceiver.o
75 # END-VOMP-INSERT
76
77 ### The main target:
78
79 # VOMP-INSERT
80 all: allbase $(SOFILE) # i18n
81 standalone: standalonebase vompserver-standalone
82 # END-VOMP-INSERT
83
84 ### Implicit rules:
85
86 %.o: %.c
87         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
88
89 ### Dependencies:
90
91 MAKEDEP = $(CXX) -MM -MG
92 DEPFILE = .dependencies
93 $(DEPFILE): Makefile
94         @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
95
96 -include $(DEPFILE)
97
98 ### Internationalization (I18N):
99
100 PODIR     = po
101 I18Npo    = $(wildcard $(PODIR)/*.po)
102 I18Nmo    = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
103 I18Nmsgs  = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
104 I18Npot   = $(PODIR)/$(PLUGIN).pot
105
106 %.mo: %.po
107         msgfmt -c -o $@ $<
108
109 $(I18Npot): $(wildcard *.c)
110         xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
111
112 %.po: $(I18Npot)
113         msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
114         @touch $@
115
116 $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
117         install -D -m644 $< $@
118
119 .PHONY: i18n
120 i18n: $(I18Nmo) $(I18Npot)
121
122 install-i18n: $(I18Nmsgs)
123
124 ### Targets:
125
126 # rest of file modified for vomp
127
128 objectsstandalone: $(OBJS)
129 objects: $(OBJS) $(OBJS2)
130
131 allbase:
132         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
133 standalonebase:
134         ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; make objectsstandalone ) ; else exit 0 ;fi )
135
136
137 $(SOFILE): objects
138         $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(OBJS2) -o $@
139
140 vompserver-standalone: objectsstandalone
141         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
142         chmod u+x $@
143
144 install-lib: $(SOFILE)
145         install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
146
147 install: install-lib install-i18n
148
149 dist: $(I18Npo) clean
150         @-rm -rf $(TMPDIR)/$(ARCHIVE)
151         @mkdir $(TMPDIR)/$(ARCHIVE)
152         @cp -a * $(TMPDIR)/$(ARCHIVE)
153         @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
154         @-rm -rf $(TMPDIR)/$(ARCHIVE)
155         @echo Distribution package created as $(PACKAGE).tgz
156
157 clean:
158         @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
159         @-rm -f $(OBJS) $(OBJS2) $(DEPFILE) *.so *.tgz core* *~ .standalone vompserver-standalone