remove Makefile.cygwin because build/cygwin/Makefile is more up to date.
[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= common/mc.c common/predict.c common/pixel.c common/macroblock.c \
9              common/frame.c common/dct.c common/cpu.c common/cabac.c \
10              common/common.c common/mdate.c common/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) common/ppc/mc.c common/ppc/pixel.c
18 else
19 PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2 -DHAVE_MALLOC_H
20 SRCS= $(SRCS_COMMON) common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
21 ASMSRC= common/i386/dct-a.asm common/i386/cpu-a.asm common/i386/pixel-a.asm common/i386/mc-a.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         rm -f .depend
54         $(foreach SRC, $(SRCS) x264.c, $(CC) $(CFLAGS) $(SRC) -MM -MT $(SRC:%.c=%.o) 1>> .depend;)
55
56 depend: .depend
57 ifneq ($(wildcard .depend),)
58 include .depend
59 endif
60
61 clean:
62         rm -f $(OBJS) $(OBJASM) *.a x264.o .depend x264 TAGS
63
64 distclean: clean
65
66 etags: TAGS
67
68 TAGS:
69         etags $(SRCS)