+ No need to emulate memalign on OS X
[x264/x264-sandbox.git] / Makefile
1 # Makefile: tuned for i386/MMX system only
2
3 # For FreeBSD, remove -DHAVE_MALLOC_H and add -DSYS_FREEBSD
4
5 # Uncomment this for Mac OS X
6 #SYS_MACOSX=1
7
8 SRCS_COMMON= core/mc.c core/predict.c core/pixel.c core/macroblock.c \
9              core/frame.c core/dct.c core/cpu.c core/cabac.c \
10                  core/common.c core/mdate.c core/csp.c \
11                  encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
12                  encoder/set.c encoder/macroblock.c encoder/cabac.c \
13                          encoder/cavlc.c encoder/encoder.c encoder/eval.c x264.c
14
15 ifdef SYS_MACOSX
16 PFLAGS=-DARCH_PPC -DSYS_MACOSX -faltivec
17 SRCS= $(SRCS_COMMON) core/ppc/mc.c core/ppc/pixel.c
18 else
19 PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2 -DHAVE_MALLOC_H
20 SRCS= $(SRCS_COMMON) core/i386/mc-c.c core/i386/dct-c.c core/i386/predict.c
21 ASMSRC= core/i386/dct.asm core/i386/cpu.asm core/i386/pixel.asm  core/i386/mc.asm
22 OBJASM= $(ASMSRC:%.asm=%.o)
23 endif
24
25 CC=gcc
26 CFLAGS=-g -Wall -I. -DDEBUG -O4 -funroll-loops -D__X264__ $(PFLAGS)
27
28 AS= nasm
29 # for linux
30 ASFLAGS=-f elf $(PFLAGS)
31 # for cygwin
32 #ASFLAGS=-f gnuwin32 -DPREFIX
33
34 OBJS = $(SRCS:%.c=%.o)
35 DEP  = depend
36
37 default: $(DEP) x264
38
39 libx264.a: $(OBJS) $(OBJASM)
40         ar rc libx264.a $(OBJS) $(OBJASM)
41         ranlib libx264.a
42
43 x264: libx264.a x264.o
44         $(CC) $(CFLAGS) -o x264 x264.o libx264.a -lm
45
46 checkasm: testing/checkasm.c libx264.a
47         $(CC) $(CFLAGS) -o checkasm $< libx264.a -lm
48
49 %.o: %.asm
50         $(AS) $(ASFLAGS) -o $@ $<
51
52 .depend: $(SRCS) x264.c
53         $(CC) -MM $(CFLAGS) $(SRCS) x264.c 1> .depend
54
55 depend: .depend
56 ifneq ($(wildcard .depend),)
57 include .depend
58 endif
59
60 clean:
61         rm -f $(OBJS) $(OBJASM) *.a x264.o .depend x264 TAGS
62
63 distclean: clean
64
65 etags: TAGS
66
67 TAGS:
68         etags $(SRCS)