Makefile 1.72 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

12 13
# MMX/SSE optims
ifeq ($(ARCH),X86)
14 15 16 17 18
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)
19 20 21 22
endif

# AltiVec optims
ifeq ($(ARCH),PPC)
23
SRCS += common/ppc/mc.c common/ppc/pixel.c
24 25
endif

Laurent Aimar's avatar
Laurent Aimar committed
26 27 28 29 30 31 32
OBJS = $(SRCS:%.c=%.o)
DEP  = depend

default: $(DEP) x264

libx264.a: $(OBJS) $(OBJASM)
	ar rc libx264.a $(OBJS) $(OBJASM)
33
	ranlib libx264.a
Laurent Aimar's avatar
Laurent Aimar committed
34 35

x264: libx264.a x264.o
36
	$(CC) -o $@ x264.o libx264.a $(LDFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
37 38

checkasm: testing/checkasm.c libx264.a
39
	$(CC) -o $@ $< libx264.a $(LDFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
40 41 42 43

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

44
.depend: $(SRCS) x264.c config.h
45
	rm -f .depend
46
# Hacky - because gcc 2.9x doesn't have -MT
47
	$(foreach SRC, $(SRCS) x264.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
Laurent Aimar's avatar
Laurent Aimar committed
48

49
config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
50 51
	./version.sh

Laurent Aimar's avatar
Laurent Aimar committed
52 53 54 55 56 57
depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif

clean:
58
	rm -f $(OBJS) $(OBJASM) config.h *.a x264.o .depend x264 TAGS
Laurent Aimar's avatar
Laurent Aimar committed
59

Måns Rullgård's avatar
Måns Rullgård committed
60
distclean: clean
Laurent Aimar's avatar
Laurent Aimar committed
61

Loren Merritt's avatar
Loren Merritt committed
62 63 64 65 66 67
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
68 69 70 71
etags: TAGS

TAGS:
	etags $(SRCS)