Makefile 2.3 KB
Newer Older
1
# Makefile
2

3 4 5 6 7 8 9 10
include config.mak

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/csp.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/eval.c
Laurent Aimar's avatar
Laurent Aimar committed
11

Loren Merritt's avatar
Loren Merritt committed
12 13 14 15 16
# Visualization sources
ifeq ($(VIS),yes)
SRCS   += common/visualize.c common/display-x11.c
endif

17 18
# MMX/SSE optims
ifeq ($(ARCH),X86)
19 20 21 22 23
SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
ASMSRC  = common/i386/dct-a.asm common/i386/cpu-a.asm \
          common/i386/pixel-a.asm common/i386/mc-a.asm \
          common/i386/mc-a2.asm common/i386/predict-a.asm
OBJASM  = $(ASMSRC:%.asm=%.o)
24 25
endif

Loren Merritt's avatar
Loren Merritt committed
26 27
# MMX/SSE optims
ifeq ($(ARCH),X86_64)
Loren Merritt's avatar
Loren Merritt committed
28
SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
Loren Merritt's avatar
Loren Merritt committed
29 30 31 32 33 34
ASMSRC  = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
          common/amd64/pixel-a.asm common/amd64/mc-a.asm \
          common/amd64/mc-a2.asm common/amd64/predict-a.asm
OBJASM  = $(ASMSRC:%.asm=%.o)
endif

35 36
# AltiVec optims
ifeq ($(ARCH),PPC)
37
SRCS += common/ppc/mc.c common/ppc/pixel.c
38 39
endif

Laurent Aimar's avatar
Laurent Aimar committed
40 41 42
OBJS = $(SRCS:%.c=%.o)
DEP  = depend

Loren Merritt's avatar
Loren Merritt committed
43
default: $(DEP) x264$(EXE)
Laurent Aimar's avatar
Laurent Aimar committed
44

Loren Merritt's avatar
Loren Merritt committed
45
libx264.a: .depend $(OBJS) $(OBJASM)
Laurent Aimar's avatar
Laurent Aimar committed
46
	ar rc libx264.a $(OBJS) $(OBJASM)
47
	ranlib libx264.a
Laurent Aimar's avatar
Laurent Aimar committed
48

Loren Merritt's avatar
Loren Merritt committed
49
x264$(EXE): libx264.a x264.o
Loren Merritt's avatar
Loren Merritt committed
50 51 52 53
	$(CC) -o $@ x264.o libx264.a $(LDFLAGS)

x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
	make -C vfw/build/cygwin
Laurent Aimar's avatar
Laurent Aimar committed
54

Eric Petit's avatar
Eric Petit committed
55
checkasm: testing/checkasm.o libx264.a
56
	$(CC) -o $@ $< libx264.a $(LDFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
57 58 59 60

%.o: %.asm
	$(AS) $(ASFLAGS) -o $@ $<

Loren Merritt's avatar
Loren Merritt committed
61
.depend: config.mak config.h
62
	rm -f .depend
63
# Hacky - because gcc 2.9x doesn't have -MT
64
	$(foreach SRC, $(SRCS) x264.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
Laurent Aimar's avatar
Laurent Aimar committed
65

66
config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
67 68
	./version.sh

Laurent Aimar's avatar
Laurent Aimar committed
69 70 71 72 73 74
depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif

clean:
Loren Merritt's avatar
Loren Merritt committed
75 76
	rm -f $(OBJS) $(OBJASM) config.h *.a x264.o x264 x264.exe .depend TAGS
	rm -rf vfw/build/cygwin/bin
Laurent Aimar's avatar
Laurent Aimar committed
77

Måns Rullgård's avatar
Måns Rullgård committed
78
distclean: clean
Loren Merritt's avatar
Loren Merritt committed
79
	rm -f config.mak vfw/build/cygwin/config.mak
Laurent Aimar's avatar
Laurent Aimar committed
80

Loren Merritt's avatar
Loren Merritt committed
81 82 83 84 85 86
DIR_INSTALL="/usr/local"
install: x264
	install x264.h $(DIR_INSTALL)/include/
	install libx264.a $(DIR_INSTALL)/lib/
	install x264 $(DIR_INSTALL)/bin/

Måns Rullgård's avatar
Måns Rullgård committed
87 88 89 90
etags: TAGS

TAGS:
	etags $(SRCS)