📄 makefile
字号:
## Softcam plugin to VDR## This code is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.## This code is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# Or, point your browser to http://www.gnu.org/copyleft/gpl.html# The official name of this plugin.# This name will be used in the '-P...' option of VDR to load the plugin.# By default the main source file also carries this name.#PLUGIN = sc### The version number of this pluginDISTFILE = .distversHGARCHIVE = .hg_archival.txtRELEASE := $(shell grep 'define SC_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')SUBREL := $(shell if test -d .hg; then \ echo -n "HG-"; (hg identify 2>/dev/null || echo -n "Unknown") | sed -e 's/ .*//'; \ elif test -r $(HGARCHIVE); then \ echo -n "AR-"; grep "^node" $(HGARCHIVE) | awk '{ printf "%.12s",$$2 }'; \ elif test -r $(DISTFILE); then \ cat $(DISTFILE); \ else \ echo -n "Unknown"; \ fi)VERSION := $(RELEASE)-$(SUBREL)SCAPIVERS := $(shell sed -ne '/define SCAPIVERS/ s/^.[a-zA-Z ]*\([0-9]*\).*$$/\1/p' $(PLUGIN).c)### The directory environment:VDRDIR = ../../..LIBDIR = ../../libSYSDIR = ./systemsPREDIR = ./systems-preTMPDIR = /tmp### The C++ compiler and options:CXX ?= g++CXXFLAGS ?= -O2 -g -fPIC -Wall -Woverloaded-virtual### Includes and DefinesINCLUDES = -I$(VDRDIR)/includeDEFINES = -DPLUGIN_NAME_I18N='"$(PLUGIN)"'SHAREDDEFINES = -DAPIVERSNUM=$(APIVERSNUM) -D_GNU_SOURCELIBS = -lcryptoSHAREDLIBS =### Allow user defined options to overwrite defaults:-include $(VDRDIR)/Make.config-include Make.config### The version number of VDR (taken from VDR's "config.h"):VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/include/vdr/config.h)ifeq ($(strip $(APIVERSION)),) APIVERSION = $(VDRVERSION)endifVDRVERSNUM := $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/include/vdr/config.h)APIVERSNUM := $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/include/vdr/config.h)ifeq ($(strip $(APIVERSNUM)),) APIVERSNUM = $(VDRVERSNUM)endif### The object files (add further files here):OBJS = $(PLUGIN).o data.o filter.o system.o misc.o cam.o version.o \ smartcard.o network.o crypto.o system-common.o parse.o log.o### Internationalization (I18N):PODIR = poI18Npot = $(PODIR)/$(PLUGIN).potifeq ($(strip $(APIVERSION)),1.5.7) I18Nmo = $(PLUGIN).moelse I18Nmo = vdr-$(PLUGIN).moendifI18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))))LOCALEDIR = $(VDRDIR)/localeHASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h)ifeq ($(strip $(HASLOCALE)),) OBJS += i18n.oendif## generic stuff## smartcard default portifdef DEFAULT_PORT TEST := $(shell echo '$(DEFAULT_PORT)' | sed -ne '/".*",.*,.*,.*/p') ifneq ($(strip $(TEST)),) DEFINES += -DDEFAULT_PORT='$(DEFAULT_PORT)' else $(error DEFAULT_PORT has bad format) endif endif# max number of CAIDs per slotMAXCAID := $(shell sed -ne '/define MAXCASYSTEMIDS/ s/^.[a-zA-Z ]*\([0-9]*\).*$$/\1/p' $(VDRDIR)/ci.c)ifneq ($(strip $(MAXCAID)),) DEFINES += -DVDR_MAXCAID=$(MAXCAID)endif# FFdeCSACPUOPT ?= pentiumPARALLEL ?= PARALLEL_32_INTCSAFLAGS ?= -Wall -fPIC -g -O3 -mmmx -fomit-frame-pointer -fexpensive-optimizations -funroll-loopsFFDECSADIR = FFdecsaFFDECSA = $(FFDECSADIR)/FFdecsa.o# SASCifdef SASCDEFINES += -DSASCFFDECSA =endif# export for system makefilesexport SCAPIVERSexport APIVERSIONexport INCLUDESexport SHAREDDEFINESexport SHAREDLIBSexport CXXexport CXXFLAGS### Targets:ifdef STATICBUILDTARGETS = $(LIBDIR)/libvdr-$(PLUGIN).a systemsSHAREDDEFINES += -DSTATICBUILDelseBUILDTARGETS = $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) systems systems-preendififneq ($(strip $(HASLOCALE)),)BUILDTARGETS += i18nendifall: $(BUILDTARGETS).PHONY: i18n systems systems-pre clean clean-core clean-systems clean-pre dist srcdist# Dependencies:MAKEDEP = g++ -MM -MGDEPFILE = .dependenciesDEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c)))$(DEPFILE): $(DEPFILES) $(wildcard *.h) @$(MAKEDEP) $(DEFINES) $(SHAREDDEFINES) $(INCLUDES) $(DEPFILES) > $@-include $(DEPFILE)# Rules%.o: %.c $(CXX) $(CXXFLAGS) -c $(DEFINES) $(SHAREDDEFINES) $(INCLUDES) $<libvdr-$(PLUGIN).so: $(OBJS) $(FFDECSA) $(CXX) $(CXXFLAGS) -shared $(OBJS) $(FFDECSA) $(LIBS) $(SHAREDLIBS) -o $@$(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION): libvdr-$(PLUGIN).so @cp -p $< $@$(LIBDIR)/libvdr-$(PLUGIN).a: $(OBJS) $(AR) r $@ $(OBJS)$(FFDECSA): $(FFDECSADIR)/*.c $(FFDECSADIR)/*.h @$(MAKE) COMPILER="$(CXX)" FLAGS="$(CSAFLAGS) -march=$(CPUOPT) -DPARALLEL_MODE=$(PARALLEL)" -C $(FFDECSADIR) all$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR)) xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<noone@nowhere.org>' -o $@ $^%.po: $(I18Npot) msgmerge -U --no-wrap --no-location --backup=none -q $@ $< @touch $@%.mo: %.po msgfmt -c -o $@ $<$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo @mkdir -p $(dir $@) cp $< $@i18n: $(I18Nmsgs)i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl perl ./po2i18n.pl <i18n-template.c >i18n.cversion.c: FORCE @echo >$@.new "/* generated file, do not edit */"; \ echo >>$@.new 'const char *ScVersion =' '"'$(VERSION)'";'; \ diff $@.new $@ >$@.diff 2>&1; \ if test -s $@.diff; then mv -f $@.new $@; fi; \ rm -f $@.new $@.diff;systems: @for i in `ls -A -I ".*" $(SYSDIR)`; do $(MAKE) -f ../../Makefile.system -C "$(SYSDIR)/$$i" all || exit 1; donesystems-pre: @for i in `ls -A -I ".*" $(PREDIR) | grep -- '-$(SCAPIVERS).so.$(APIVERSION)$$'`; do cp -p "$(PREDIR)/$$i" "$(LIBDIR)"; doneclean-systems: @for i in `ls -A -I ".*" $(SYSDIR)`; do $(MAKE) -f ../../Makefile.system -C "$(SYSDIR)/$$i" clean; doneclean-core: @$(MAKE) -C testing clean @if test -d $(FFDECSADIR); then $(MAKE) -C $(FFDECSADIR) clean; fi @-rm -f $(LIBDIR)/libsc-*-$(SCAPIVERS).so.$(APIVERSION) @-rm -f $(LIBDIR)/libvdr-$(PLUGIN).a $(LIBDIR)/libsc-*.a @-rm -f $(OBJS) $(DEPFILE) version.c i18n.c *.so *.tar.gz core* *~ @-rm -f $(PODIR)/*.moclean-pre: @-find "$(PREDIR)" -type f -not -name ".empty" -not -iname "*-$(SCAPIVERS).so.*" | xargs rm -fclean: clean-core clean-systemsdist: ARCHIVE := $(PLUGIN)-$(RELEASE)dist: clean-core @for i in `ls -A -I ".*" $(SYSDIR)`; do $(MAKE) -f ../../Makefile.system -C "$(SYSDIR)/$$i" dist; done @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) @echo -n "release" >$(TMPDIR)/$(ARCHIVE)/$(DISTFILE) @path="$(TMPDIR)/$(ARCHIVE)/$(notdir $(SYSDIR))";\ for i in `ls -A -I ".*" $$path`; do if [ -f "$$path/$$i/nonpublic.mk" ]; then rm -rf "$$path/$$i"; fi; if [ -f "$$path/$$i/nonpublic.sh" ]; then (cd $$path/$$i ; source ./nonpublic.sh ; rm ./nonpublic.sh); fi; done @strip --strip-unneeded --preserve-dates $(TMPDIR)/$(ARCHIVE)/$(notdir $(PREDIR))/* @tar czf vdr-$(ARCHIVE).tar.gz -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as vdr-$(ARCHIVE).tar.gzcopy: ARCHIVE := $(PLUGIN)-$(VERSION)copy: clean clean-pre @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a .hgtags .hgignore * $(TMPDIR)/$(ARCHIVE) @echo -n $(SUBREL) | sed -e 's/HG-/CP-/' >$(TMPDIR)/$(ARCHIVE)/$(DISTFILE) @tar czf vdr-$(ARCHIVE).tar.gz -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Full copy package created as vdr-$(ARCHIVE).tar.gzFORCE:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -