]> git.sesse.net Git - x264/blobdiff - Makefile
asm cosmetics: INIT_MMX/XMM/YMM now support a cpuflags argument
[x264] / Makefile
index ec7a7a3aa6b096e3ac808f5c0d7a260367637297..58310913b95b630a0f5d1ebbd499d7562e9875cc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ all: 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 \
-       common/common.c common/mdate.c common/rectangle.c \
+       common/common.c common/osdep.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 \
@@ -34,11 +34,15 @@ ifneq ($(findstring HAVE_AVS 1, $(CONFIG)),)
 SRCCLI += input/avs.c
 endif
 
-ifneq ($(findstring HAVE_PTHREAD 1, $(CONFIG)),)
+ifneq ($(findstring HAVE_THREAD 1, $(CONFIG)),)
 SRCCLI += input/thread.c
 SRCS   += common/threadpool.c
 endif
 
+ifneq ($(findstring HAVE_WIN32THREAD 1, $(CONFIG)),)
+SRCS += common/win32thread.c
+endif
+
 ifneq ($(findstring HAVE_LAVF 1, $(CONFIG)),)
 SRCCLI += input/lavf.c
 endif
@@ -121,7 +125,7 @@ SRCCLI += extras/getopt.c
 endif
 
 ifneq ($(SONAME),)
-ifeq ($(SYS),MINGW)
+ifeq ($(SYS),WINDOWS)
 SRCSO += x264dll.c
 endif
 endif
@@ -131,34 +135,38 @@ OBJCLI = $(SRCCLI:%.c=%.o)
 OBJSO = $(SRCSO:%.c=%.o)
 DEP  = depend
 
-.PHONY: all default fprofiled clean distclean install uninstall dox test testclean
+.PHONY: all default fprofiled clean distclean install uninstall dox test testclean lib-static lib-shared cli install-lib-dev install-lib-static install-lib-shared install-cli
 
-default: $(DEP) x264$(EXE)
+default: $(DEP)
 
-libx264.a: .depend $(OBJS) $(OBJASM)
-       $(AR) rc libx264.a $(OBJS) $(OBJASM)
-       $(RANLIB) libx264.a
+cli: x264$(EXE)
+lib-static: $(LIBX264)
+lib-shared: $(SONAME)
+
+$(LIBX264): .depend $(OBJS) $(OBJASM)
+       $(AR)$@ $(OBJS) $(OBJASM)
+       $(if $(RANLIB), $(RANLIB) $@)
 
 $(SONAME): .depend $(OBJS) $(OBJASM) $(OBJSO)
-       $(CC) -shared -o $@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
+       $(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
 
-x264$(EXE): $(OBJCLI) libx264.a
-       $(CC) -o $@ $+ $(LDFLAGSCLI) $(LDFLAGS)
+x264$(EXE): .depend $(OBJCLI) $(CLI_LIBX264)
+       $(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
 
-checkasm: tools/checkasm.o libx264.a
-       $(CC) -o $@ $+ $(LDFLAGS)
+checkasm: tools/checkasm.o $(LIBX264)
+       $(LD)$@ $+ $(LDFLAGS)
 
 %.o: %.asm
        $(AS) $(ASFLAGS) -o $@ $<
-       -@ $(STRIP) -x $@ # delete local/anonymous symbols, so they don't show up in oprofile
+       -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
 
 %.o: %.S
        $(AS) $(ASFLAGS) -o $@ $<
-       -@ $(STRIP) -x $@ # delete local/anonymous symbols, so they don't show up in oprofile
+       -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
 
 .depend: config.mak
        @rm -f .depend
-       @$(foreach SRC, $(SRCS) $(SRCCLI) $(SRCSO), $(CC) $(CFLAGS) $(SRC) -MT $(SRC:%.c=%.o) -MM -g0 1>> .depend;)
+       @$(foreach SRC, $(SRCS) $(SRCCLI) $(SRCSO), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:%.c=%.o) $(DEPMM) 1>> .depend;)
 
 config.mak:
        ./configure
@@ -187,38 +195,40 @@ fprofiled:
 else
 fprofiled:
        $(MAKE) clean
-       mv config.mak config.mak2
-       sed -e 's/CFLAGS.*/& -fprofile-generate/; s/LDFLAGS.*/& -fprofile-generate/' config.mak2 > config.mak
-       $(MAKE) x264$(EXE)
+       $(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) ;))
        rm -f $(SRC2:%.c=%.o)
-       sed -e 's/CFLAGS.*/& -fprofile-use/; s/LDFLAGS.*/& -fprofile-use/' config.mak2 > config.mak
-       $(MAKE)
-       rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
-       mv config.mak2 config.mak
+       $(MAKE) CFLAGS="$(CFLAGS) $(PROF_USE_CC)" LDFLAGS="$(LDFLAGS) $(PROF_USE_LD)"
+       rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
 endif
 
 clean:
-       rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a x264 x264.exe .depend TAGS
+       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 $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
-       - sed -e 's/ *-fprofile-\(generate\|use\)//g' config.mak > config.mak2 && mv config.mak2 config.mak
+       rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock
 
 distclean: clean
-       rm -f config.mak config.h config.log x264.pc
+       rm -f config.mak x264_config.h config.h config.log x264.pc x264.def
        rm -rf test/
 
-install: x264$(EXE) $(SONAME)
+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 x264.h $(DESTDIR)$(includedir)
-       install -m 644 libx264.a $(DESTDIR)$(libdir)
+       install -m 644 x264_config.h $(DESTDIR)$(includedir)
        install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
-       install x264$(EXE) $(DESTDIR)$(bindir)
-       $(RANLIB) $(DESTDIR)$(libdir)/libx264.a
-ifeq ($(SYS),MINGW)
+
+install-lib-static: lib-static install-lib-dev
+       install -m 644 $(LIBX264) $(DESTDIR)$(libdir)
+       $(if $(RANLIB), $(RANLIB) $(DESTDIR)$(libdir)/$(LIBX264))
+
+install-lib-shared: lib-shared install-lib-dev
+ifeq ($(SYS),WINDOWS)
        $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(bindir))
 else
        $(if $(SONAME), ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX))
@@ -227,7 +237,7 @@ endif
        $(if $(IMPLIBNAME), install -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir))
 
 uninstall:
-       rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a
+       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))