]> git.vomp.tv Git - vompserver.git/blob - Makefile
15 years that line of code has been waiting to crash
[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_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
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 += -D__STL_CONFIG_H -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 dsock6.o mvpserver.o udpreplier.o udp6replier.o bootpd.o tftpd.o i18n.o \
68                    vompclient.o tcp.o 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         @echo CC $@
88         $(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
89
90 ### Dependencies:
91
92 MAKEDEP = $(CXX) -MM -MG
93 DEPFILE = .dependencies
94 $(DEPFILE): Makefile
95         @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
96
97 -include $(DEPFILE)
98
99 ### Internationalization (I18N):
100
101 PODIR     = po
102 I18Npo    = $(wildcard $(PODIR)/*.po)
103 I18Nmo    = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
104 I18Nmsgs  = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
105 I18Npot   = $(PODIR)/$(PLUGIN).pot
106
107 %.mo: %.po
108         @echo MO $@
109         $(Q)msgfmt -c -o $@ $<
110
111 $(I18Npot): $(wildcard *.c)
112         @echo GT $@
113         $(Q)xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
114
115 %.po: $(I18Npot)
116         @echo PO $@
117         $(Q)msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
118         @touch $@
119
120 $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
121         install -D -m644 $< $@
122
123 .PHONY: i18n
124 i18n: $(I18Nmo) $(I18Npot)
125
126 install-i18n: $(I18Nmsgs)
127
128 ### Targets:
129
130 # VOMP-INSERT
131
132 objectsstandalone: $(OBJS)
133 objects: $(OBJS) $(OBJS2)
134
135 allbase:
136         ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
137 standalonebase:
138         ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; make objectsstandalone ) ; else exit 0 ;fi )
139
140 $(SOFILE): objects
141         @echo LD $@
142         $(Q)$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(OBJS2) -o $@
143
144 vompserver-standalone: objectsstandalone
145         $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
146         chmod u+x $@
147 # END-VOMP-INSERT
148
149 install-lib: $(SOFILE)
150         install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
151
152 install: install-lib install-i18n
153
154 dist: $(I18Npo) clean
155         @-rm -rf $(TMPDIR)/$(ARCHIVE)
156         @mkdir $(TMPDIR)/$(ARCHIVE)
157         @cp -a * $(TMPDIR)/$(ARCHIVE)
158         @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
159         @-rm -rf $(TMPDIR)/$(ARCHIVE)
160         @echo Distribution package created as $(PACKAGE).tgz
161
162 clean:
163         @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
164         @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
165 # VOMP-INSERT
166         @-rm -f $(OBJS2) .standalone vompserver-standalone
167 # END-VOMP-INSERT