| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 | # Makefileinclude config.makvpath %.c $(SRCPATH)vpath %.h $(SRCPATH)vpath %.S $(SRCPATH)vpath %.asm $(SRCPATH)vpath %.rc $(SRCPATH)GENERATED =all: defaultdefault:SRCS = common/osdep.c common/base.c common/cpu.c common/tables.c \       encoder/api.cSRCS_X = common/mc.c common/predict.c common/pixel.c common/macroblock.c \         common/frame.c common/dct.c common/cabac.c \         common/common.c common/rectangle.c \         common/set.c common/quant.c common/deblock.c common/vlc.c \         common/mvpred.c common/bitstream.c \         encoder/analyse.c encoder/me.c encoder/ratecontrol.c \         encoder/set.c encoder/macroblock.c encoder/cabac.c \         encoder/cavlc.c encoder/encoder.c encoder/lookahead.cSRCS_8 =SRCCLI = x264.c input/input.c input/timecode.c input/raw.c input/y4m.c \         output/raw.c output/matroska.c output/matroska_ebml.c \         output/flv.c output/flv_bytestream.c filters/filters.c \         filters/video/video.c filters/video/source.c filters/video/internal.c \         filters/video/resize.c filters/video/fix_vfr_pts.c \         filters/video/select_every.c filters/video/crop.cSRCCLI_X = filters/video/cache.c filters/video/depth.cSRCSO =SRCCHK_X = tools/checkasm.cSRCEXAMPLE = example.cOBJS =OBJASM =OBJSO =OBJCLI =OBJCHK =OBJCHK_8 =OBJCHK_10 =OBJEXAMPLE =CONFIG := $(shell cat config.h)# Optional module sourcesifneq ($(findstring HAVE_AVS 1, $(CONFIG)),)SRCCLI += input/avs.cendififneq ($(findstring HAVE_THREAD 1, $(CONFIG)),)SRCS_X   += common/threadpool.cSRCCLI_X += input/thread.cendififneq ($(findstring HAVE_WIN32THREAD 1, $(CONFIG)),)SRCS += common/win32thread.cendififneq ($(findstring HAVE_LAVF 1, $(CONFIG)),)SRCCLI += input/lavf.cendififneq ($(findstring HAVE_FFMS 1, $(CONFIG)),)SRCCLI += input/ffms.cendififneq ($(findstring HAVE_GPAC 1, $(CONFIG)),)SRCCLI += output/mp4.cendififneq ($(findstring HAVE_LSMASH 1, $(CONFIG)),)SRCCLI += output/mp4_lsmash.cendififneq ($(AS),)# MMX/SSE optimsSRCASM_X =ifeq ($(SYS_ARCH),X86)ARCH_X86 = yesSRCASM_X += common/x86/dct-32.asm \            common/x86/pixel-32.asmendififeq ($(SYS_ARCH),X86_64)ARCH_X86 = yesSRCASM_X += common/x86/dct-64.asm \            common/x86/trellis-64.asmendififdef ARCH_X86SRCASM_X += common/x86/bitstream-a.asm \            common/x86/const-a.asm \            common/x86/cabac-a.asm \            common/x86/dct-a.asm \            common/x86/deblock-a.asm \            common/x86/mc-a.asm \            common/x86/mc-a2.asm \            common/x86/pixel-a.asm \            common/x86/predict-a.asm \            common/x86/quant-a.asmSRCS_X   += common/x86/mc-c.c \            common/x86/predict-c.cOBJASM += common/x86/cpu-a.oifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)OBJASM += $(SRCASM_X:%.asm=%-8.o) common/x86/sad-a-8.oendififneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)OBJASM += $(SRCASM_X:%.asm=%-10.o) common/x86/sad16-a-10.oendifOBJCHK += tools/checkasm-a.oendif# AltiVec optimsifeq ($(SYS_ARCH),PPC)SRCS_X += common/ppc/dct.c \          common/ppc/deblock.c \          common/ppc/mc.c \          common/ppc/pixel.c \          common/ppc/predict.c \          common/ppc/quant.cendif# NEON optimsifeq ($(SYS_ARCH),ARM)SRCASM_X  = common/arm/bitstream-a.S \            common/arm/dct-a.S \            common/arm/deblock-a.S \            common/arm/mc-a.S \            common/arm/pixel-a.S \            common/arm/predict-a.S \            common/arm/quant-a.SSRCS_X   += common/arm/mc-c.c \            common/arm/predict-c.cOBJASM += common/arm/cpu-a.oifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)OBJASM += $(SRCASM_X:%.S=%-8.o)endififneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)OBJASM += $(SRCASM_X:%.S=%-10.o)endifOBJCHK += tools/checkasm-arm.oendif# AArch64 NEON optimsifeq ($(SYS_ARCH),AARCH64)SRCASM_X  = common/aarch64/bitstream-a.S \            common/aarch64/cabac-a.S \            common/aarch64/dct-a.S \            common/aarch64/deblock-a.S \            common/aarch64/mc-a.S \            common/aarch64/pixel-a.S \            common/aarch64/predict-a.S \            common/aarch64/quant-a.SSRCS_X   += common/aarch64/asm-offsets.c \            common/aarch64/mc-c.c \            common/aarch64/predict-c.cOBJASM +=ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)OBJASM += $(SRCASM_X:%.S=%-8.o)endififneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)OBJASM += $(SRCASM_X:%.S=%-10.o)endifOBJCHK += tools/checkasm-aarch64.oendif# MSA optimsifeq ($(SYS_ARCH),MIPS)ifneq ($(findstring HAVE_MSA 1, $(CONFIG)),)SRCS_X += common/mips/dct-c.c \          common/mips/deblock-c.c \          common/mips/mc-c.c \          common/mips/pixel-c.c \          common/mips/predict-c.c \          common/mips/quant-c.cendifendifendififneq ($(HAVE_GETOPT_LONG),1)SRCCLI += extras/getopt.cendififeq ($(SYS),WINDOWS)OBJCLI += $(if $(RC), x264res.o)ifneq ($(SONAME),)SRCSO  += x264dll.cOBJSO  += $(if $(RC), x264res.dll.o)endifendififeq ($(HAVE_OPENCL),yes)common/oclobj.h: common/opencl/x264-cl.h $(wildcard $(SRCPATH)/common/opencl/*.cl)	cat $^ | $(SRCPATH)/tools/cltostr.sh $@GENERATED += common/oclobj.hSRCS_8 += common/opencl.c encoder/slicetype-cl.cendifOBJS   += $(SRCS:%.c=%.o)OBJCLI += $(SRCCLI:%.c=%.o)OBJSO  += $(SRCSO:%.c=%.o)OBJEXAMPLE += $(SRCEXAMPLE:%.c=%.o)ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)OBJS      += $(SRCS_X:%.c=%-8.o) $(SRCS_8:%.c=%-8.o)OBJCLI    += $(SRCCLI_X:%.c=%-8.o)OBJCHK_8  += $(SRCCHK_X:%.c=%-8.o)checkasm: checkasm8$(EXE)endififneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)OBJS      += $(SRCS_X:%.c=%-10.o)OBJCLI    += $(SRCCLI_X:%.c=%-10.o)OBJCHK_10 += $(SRCCHK_X:%.c=%-10.o)checkasm: checkasm10$(EXE)endif.PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* checkasm etagscli: x264$(EXE)lib-static: $(LIBX264)lib-shared: $(SONAME)$(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM)	rm -f $(LIBX264)	$(AR)$@ $(OBJS) $(OBJASM)	$(if $(RANLIB), $(RANLIB) $@)$(SONAME): $(GENERATED) .depend $(OBJS) $(OBJASM) $(OBJSO)	$(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)ifneq ($(EXE),).PHONY: x264 checkasm8 checkasm10 examplex264: x264$(EXE)checkasm8: checkasm8$(EXE)checkasm10: checkasm10$(EXE)example: example$(EXE)endifx264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264)	$(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_8) $(LIBX264)	$(LD)$@ $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LDFLAGS)checkasm10$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_10) $(LIBX264)	$(LD)$@ $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LDFLAGS)example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264)	$(LD)$@ $(OBJEXAMPLE) $(LIBX264) $(LDFLAGS)$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXAMPLE): .depend%.o: %.c	$(CC) $(CFLAGS) -c $< $(CC_O)%-8.o: %.c	$(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8%-10.o: %.c	$(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10%.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm	$(AS) $(ASFLAGS) -o $@ $<	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile%-8.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm	$(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=8 -Dprivate_prefix=x264_8	-@ $(if $(STRIP), $(STRIP) -x $@)%-10.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm	$(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=10 -Dprivate_prefix=x264_10	-@ $(if $(STRIP), $(STRIP) -x $@)%.o: %.S	$(AS) $(ASFLAGS) -o $@ $<	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile%-8.o: %.S	$(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8	-@ $(if $(STRIP), $(STRIP) -x $@)%-10.o: %.S	$(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10	-@ $(if $(STRIP), $(STRIP) -x $@)%.dll.o: %.rc x264.h	$(RC) $(RCFLAGS)$@ -DDLL $<%.o: %.rc x264.h	$(RC) $(RCFLAGS)$@ $<.depend: config.mak	@rm -f .depend	@echo 'dependency file generation...'ifeq ($(COMPILER),CL)	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%.o)" 1>> .depend;)ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-8.o)" 1>> .depend;)endififneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-10.o)" 1>> .depend;)endifelse	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-8.o) $(DEPMM) 1>> .depend;)endififneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)	@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-10.o) $(DEPMM) 1>> .depend;)endifendifconfig.mak:	./configuredepend: .dependifneq ($(wildcard .depend),)include .dependendifOBJPROF = $(OBJS) $(OBJCLI)# These should cover most of the important codepathsOPT0 = --crf 30 -b1 -m1 -r1 --me dia --no-cabac --direct temporal --ssim --no-weightbOPT1 = --crf 16 -b2 -m3 -r3 --me hex --no-8x8dct --direct spatial --no-dct-decimate -t0  --slice-max-mbs 50OPT2 = --crf 26 -b4 -m5 -r2 --me hex --cqm jvt --nr 100 --psnr --no-mixed-refs --b-adapt 2 --slice-max-size 1500OPT3 = --crf 18 -b3 -m9 -r5 --me umh -t1 -A all --b-pyramid normal --direct auto --no-fast-pskip --no-mbtreeOPT4 = --crf 22 -b3 -m7 -r4 --me esa -t2 -A all --psy-rd 1.0:1.0 --slices 4OPT5 = --frames 50 --crf 24 -b3 -m10 -r3 --me tesa -t2OPT6 = --frames 50 -q0 -m9 -r2 --me hex -AallOPT7 = --frames 50 -q0 -m2 -r1 --me hex --no-cabacifeq (,$(VIDS))fprofiled:	@echo 'usage: make fprofiled VIDS="infile1 infile2 ..."'	@echo 'where infiles are anything that x264 understands,'	@echo 'i.e. YUV with resolution in the filename, y4m, or avisynth.'elsefprofiled: clean	$(MAKE) x264$(EXE) CFLAGS="$(CFLAGS) $(PROF_GEN_CC)" LDFLAGS="$(LDFLAGS) $(PROF_GEN_LD)"	$(foreach V, $(VIDS), $(foreach I, 0 1 2 3 4 5 6 7, ./x264$(EXE) $(OPT$I) --threads 1 $(V) -o $(DEVNULL) ;))ifeq ($(COMPILER),CL)# Because Visual Studio timestamps the object files within the PGD, it fails to build if they change - only the executable should be deleted	rm -f x264$(EXE)else	rm -f $(OBJPROF)endif	$(MAKE) CFLAGS="$(CFLAGS) $(PROF_USE_CC)" LDFLAGS="$(LDFLAGS) $(PROF_USE_LD)"	rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgcendifclean:	rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(GENERATED) .depend TAGS	rm -f $(SONAME) *.a *.lib *.exp *.pdb x264$(EXE) x264_lookahead.clbin	rm -f checkasm8$(EXE) checkasm10$(EXE) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10)	rm -f example$(EXE) $(OBJEXAMPLE)	rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgcdistclean: clean	rm -f config.mak x264_config.h config.h config.log x264.pc x264.def	rm -rf conftest*install-cli: cli	$(INSTALL) -d $(DESTDIR)$(bindir)	$(INSTALL) x264$(EXE) $(DESTDIR)$(bindir)install-lib-dev:	$(INSTALL) -d $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig	$(INSTALL) -m 644 $(SRCPATH)/x264.h x264_config.h $(DESTDIR)$(includedir)	$(INSTALL) -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfiginstall-lib-static: lib-static install-lib-dev	$(INSTALL) -d $(DESTDIR)$(libdir)	$(INSTALL) -m 644 $(LIBX264) $(DESTDIR)$(libdir)	$(if $(RANLIB), $(RANLIB) $(DESTDIR)$(libdir)/$(LIBX264))install-lib-shared: lib-shared install-lib-dev	$(INSTALL) -d $(DESTDIR)$(libdir)ifneq ($(IMPLIBNAME),)	$(INSTALL) -d $(DESTDIR)$(bindir)	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(bindir)	$(INSTALL) -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)else ifneq ($(SONAME),)	ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(libdir)endifuninstall:	rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(includedir)/x264_config.h $(DESTDIR)$(libdir)/libx264.a	rm -f $(DESTDIR)$(bindir)/x264$(EXE) $(DESTDIR)$(libdir)/pkgconfig/x264.pcifneq ($(IMPLIBNAME),)	rm -f $(DESTDIR)$(bindir)/$(SONAME) $(DESTDIR)$(libdir)/$(IMPLIBNAME)else ifneq ($(SONAME),)	rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)endifetags TAGS:	etags $(SRCS) $(SRCS_X) $(SRCS_8)
 |