]> git.sesse.net Git - x264/blobdiff - Makefile
Bump dates to 2014
[x264] / Makefile
index 67301fcc1867b1263ae15df9c214b54e1b4e106f..a2bc0dc95460967ff617ec38da2b6ae4218cbaa2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,16 @@
 
 include config.mak
 
+vpath %.c $(SRCPATH)
+vpath %.h $(SRCPATH)
+vpath %.S $(SRCPATH)
+vpath %.asm $(SRCPATH)
+vpath %.rc $(SRCPATH)
+
+GENERATED =
+
 all: default
+default:
 
 SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
        common/frame.c common/dct.c common/cpu.c common/cabac.c \
@@ -21,6 +30,11 @@ SRCCLI = x264.c input/input.c input/timecode.c input/raw.c input/y4m.c \
          filters/video/select_every.c filters/video/crop.c filters/video/depth.c
 
 SRCSO =
+OBJS =
+OBJSO =
+OBJCLI =
+
+OBJCHK = tools/checkasm.o
 
 CONFIG := $(shell cat config.h)
 
@@ -55,9 +69,8 @@ ifneq ($(findstring HAVE_GPAC 1, $(CONFIG)),)
 SRCCLI += output/mp4.c
 endif
 
-# Visualization sources
-ifneq ($(findstring HAVE_VISUALIZE 1, $(CONFIG)),)
-SRCS   += common/visualize.c common/display-x11.c
+ifneq ($(findstring HAVE_LSMASH 1, $(CONFIG)),)
+SRCCLI += output/mp4_lsmash.c
 endif
 
 # MMX/SSE optims
@@ -75,20 +88,21 @@ X86SRC = $(X86SRC0:%=common/x86/%)
 ifeq ($(ARCH),X86)
 ARCH_X86 = yes
 ASMSRC   = $(X86SRC) common/x86/pixel-32.asm
+ASFLAGS += -DARCH_X86_64=0
 endif
 
 ifeq ($(ARCH),X86_64)
 ARCH_X86 = yes
-ASMSRC   = $(X86SRC:-32.asm=-64.asm)
-ASFLAGS += -DARCH_X86_64
+ASMSRC   = $(X86SRC:-32.asm=-64.asm) common/x86/trellis-64.asm
+ASFLAGS += -DARCH_X86_64=1
 endif
 
 ifdef ARCH_X86
-ASFLAGS += -Icommon/x86/
+ASFLAGS += -I$(SRCPATH)/common/x86/
 SRCS   += common/x86/mc-c.c common/x86/predict-c.c
 OBJASM  = $(ASMSRC:%.asm=%.o)
 $(OBJASM): common/x86/x86inc.asm common/x86/x86util.asm
-checkasm: tools/checkasm-a.o
+OBJCHK += tools/checkasm-a.o
 endif
 endif
 
@@ -124,33 +138,52 @@ ifneq ($(HAVE_GETOPT_LONG),1)
 SRCCLI += extras/getopt.c
 endif
 
-ifneq ($(SONAME),)
 ifeq ($(SYS),WINDOWS)
-SRCSO += x264dll.c
+OBJCLI += $(if $(RC), x264res.o)
+ifneq ($(SONAME),)
+SRCSO  += x264dll.c
+OBJSO  += $(if $(RC), x264res.dll.o)
 endif
 endif
 
-OBJS = $(SRCS:%.c=%.o)
-OBJCLI = $(SRCCLI:%.c=%.o)
-OBJSO = $(SRCSO:%.c=%.o)
-DEP  = depend
+ifeq ($(HAVE_OPENCL),yes)
+common/oclobj.h: common/opencl/x264-cl.h $(wildcard $(SRCPATH)/common/opencl/*.cl)
+       cat $^ | perl $(SRCPATH)/tools/cltostr.pl x264_opencl_source > $@
+GENERATED += common/oclobj.h
+SRCS += common/opencl.c encoder/slicetype-cl.c
+endif
+
+OBJS   += $(SRCS:%.c=%.o)
+OBJCLI += $(SRCCLI:%.c=%.o)
+OBJSO  += $(SRCSO:%.c=%.o)
 
-.PHONY: all default fprofiled clean distclean install uninstall dox test testclean
+.PHONY: all default fprofiled clean distclean install uninstall lib-static lib-shared cli install-lib-dev install-lib-static install-lib-shared install-cli
 
-default: $(DEP) x264$(EXE)
+cli: x264$(EXE)
+lib-static: $(LIBX264)
+lib-shared: $(SONAME)
 
-$(LIBX264): .depend $(OBJS) $(OBJASM)
+$(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM)
+       rm -f $(LIBX264)
        $(AR)$@ $(OBJS) $(OBJASM)
        $(if $(RANLIB), $(RANLIB) $@)
 
-$(SONAME): .depend $(OBJS) $(OBJASM) $(OBJSO)
+$(SONAME): $(GENERATED) .depend $(OBJS) $(OBJASM) $(OBJSO)
        $(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
 
-x264$(EXE): $(OBJCLI) $(LIBX264)
-       $(LD)$@ $+ $(LDFLAGSCLI) $(LDFLAGS)
+ifneq ($(EXE),)
+.PHONY: x264 checkasm
+x264: x264$(EXE)
+checkasm: checkasm$(EXE)
+endif
+
+x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264)
+       $(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
+
+checkasm$(EXE): $(GENERATED) .depend $(OBJCHK) $(LIBX264)
+       $(LD)$@ $(OBJCHK) $(LIBX264) $(LDFLAGS)
 
-checkasm: tools/checkasm.o $(LIBX264)
-       $(LD)$@ $+ $(LDFLAGS)
+$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
 
 %.o: %.asm
        $(AS) $(ASFLAGS) -o $@ $<
@@ -160,9 +193,15 @@ checkasm: tools/checkasm.o $(LIBX264)
        $(AS) $(ASFLAGS) -o $@ $<
        -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
 
+%.dll.o: %.rc x264.h
+       $(RC) $(RCFLAGS)$@ -DDLL $<
+
+%.o: %.rc x264.h
+       $(RC) $(RCFLAGS)$@ $<
+
 .depend: config.mak
        @rm -f .depend
-       @$(foreach SRC, $(SRCS) $(SRCCLI) $(SRCSO), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:%.c=%.o) $(DEPMM) 1>> .depend;)
+       @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)
 
 config.mak:
        ./configure
@@ -200,36 +239,46 @@ endif
 
 clean:
        rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe .depend TAGS
-       rm -f checkasm checkasm.exe tools/checkasm.o tools/checkasm-a.o
+       rm -f checkasm checkasm.exe $(OBJCHK) $(GENERATED) x264_lookahead.clbin
        rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
 
 distclean: clean
        rm -f config.mak x264_config.h config.h config.log x264.pc x264.def
-       rm -rf test/
-
-install: x264$(EXE) $(SONAME)
-       install -d $(DESTDIR)$(bindir)
-       install -d $(DESTDIR)$(includedir)
-       install -d $(DESTDIR)$(libdir)
-       install -d $(DESTDIR)$(libdir)/pkgconfig
-       install -m 644 x264.h $(DESTDIR)$(includedir)
-       install -m 644 x264_config.h $(DESTDIR)$(includedir)
-       install -m 644 $(LIBX264) $(DESTDIR)$(libdir)
-       install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
-       install x264$(EXE) $(DESTDIR)$(bindir)
+
+install-cli: cli
+       $(INSTALL) -d $(DESTDIR)$(bindir)
+       $(INSTALL) x264$(EXE) $(DESTDIR)$(bindir)
+
+install-lib-dev:
+       $(INSTALL) -d $(DESTDIR)$(includedir)
+       $(INSTALL) -d $(DESTDIR)$(libdir)
+       $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
+       $(INSTALL) -m 644 $(SRCPATH)/x264.h $(DESTDIR)$(includedir)
+       $(INSTALL) -m 644 x264_config.h $(DESTDIR)$(includedir)
+       $(INSTALL) -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
+
+install-lib-static: lib-static install-lib-dev
+       $(INSTALL) -m 644 $(LIBX264) $(DESTDIR)$(libdir)
        $(if $(RANLIB), $(RANLIB) $(DESTDIR)$(libdir)/$(LIBX264))
-ifeq ($(SYS),WINDOWS)
-       $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(bindir))
-else
-       $(if $(SONAME), ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX))
-       $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir))
+
+install-lib-shared: lib-shared install-lib-dev
+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)
 endif
-       $(if $(IMPLIBNAME), install -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir))
 
 uninstall:
        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.pc
-       $(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX))
+ifneq ($(IMPLIBNAME),)
+       rm -f $(DESTDIR)$(bindir)/$(SONAME) $(DESTDIR)$(libdir)/$(IMPLIBNAME)
+else ifneq ($(SONAME),)
+       rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
+endif
 
 etags: TAGS