1 |
#/************************************************************************** |
############################################################################## |
2 |
# * |
# |
3 |
# * linux makefile |
# - Unified Makefile for XviD for *nix environments - |
4 |
# * |
# |
5 |
# * nasm args: |
# Copyright(C) 2003 Edouard Gomez <ed.gomez@free.fr> |
6 |
# * -f fmt elf (linux), coff (djgpp) |
# |
7 |
# * -DPREFIX add '_' prefix to symbol names |
# |
8 |
# * |
# Description: |
9 |
# * libso: |
# This Makefile allows building XviD sources to obtain a shared library |
10 |
# * (-lm not neccessary if using -ffast-math) |
# and a static library. This Makefie uses variables defined in the |
11 |
# * |
# platform.inc file. This platform.inc file is usually created by the |
12 |
# *************************************************************************/ |
# ./configure script whenever a unix shell is available. |
13 |
|
# |
14 |
|
# Nota Bene for mingw32/djgpp users: |
15 |
include Makefile.inc |
# However if you provide a platform.inc file adapted to your OS, then |
16 |
|
# change the include platform.inc to include yourfile.inc and it should |
17 |
CC = gcc |
# work too. |
18 |
#CC=icc |
# |
19 |
#CC = /opt/experimental/bin/gcc # that's where SuSE installs gcc3 |
# |
20 |
|
############################################################################## |
|
CFLAGS = -DARCH_X86 -DLINUX |
|
|
LIBDIR = /usr/local/lib |
|
|
|
|
|
ifeq ($(CC),icc) |
|
|
CFLAGS+= -O3 -ip -tpp6 -xM # -tpp7 might be faster (P4 optmization)... |
|
|
CFLAGS+= -I/opt/intel/compiler50/ia32/include -I/opt/intel/compiler50/ia32/substitute_headers/ |
|
|
|
|
|
else |
|
|
|
|
|
# CFLAGS += -funroll-loops -ffast-math -fstrict-aliasing -fomit-frame-pointer |
|
|
# CFLAGS += -fPIC |
|
|
# CFLAGS += -m486 |
|
|
# CFLAGS += -march=pentium -mcpu=pentium |
|
|
CFLAGS += -march=pentiumpro -mcpu=pentiumpro |
|
|
# CFLAGS += -march=k6 -mcpu=k6 |
|
|
|
|
|
CFLAGS += -Wall -O3 -funroll-loops -ffast-math |
|
|
CFLAGS += -fstrict-aliasing -fomit-frame-pointer |
|
|
endif |
|
21 |
|
|
22 |
AS = nasm |
include sources.inc |
23 |
AFLAGS = -f elf |
include platform.inc |
|
|
|
|
%.o: %.asm |
|
|
$(AS) $(AFLAGS) $< -o $@ |
|
24 |
|
|
25 |
RM = rm -rf |
RM = rm -rf |
26 |
|
|
27 |
|
############################################################################## |
28 |
|
# |
29 |
|
# Build rules |
30 |
|
# |
31 |
|
############################################################################## |
32 |
|
|
33 |
|
# Our main targets |
34 |
|
STATIC_LIB=libxvidcore.$(STATIC_EXTENSION) |
35 |
|
SHARED_LIB=libxvidcore.$(SHARED_EXTENSION) |
36 |
|
|
37 |
|
# Their Objects |
38 |
|
OBJECTS=$(GENERIC_OBJECTS) |
39 |
|
OBJECTS+=$(DIVX4COMPAT_OBJECTS) |
40 |
|
OBJECTS+=$(ASSEMBLY_OBJECTS) |
41 |
|
|
42 |
|
#----------------------------------------------------------------------------- |
43 |
|
# The default rule |
44 |
|
#----------------------------------------------------------------------------- |
45 |
|
|
46 |
|
.SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c |
47 |
|
|
48 |
|
all: platform.inc $(STATIC_LIB) $(SHARED_LIB) |
49 |
|
|
50 |
|
#----------------------------------------------------------------------------- |
51 |
|
# Generic assembly rule |
52 |
|
#----------------------------------------------------------------------------- |
53 |
|
|
54 |
all: $(LIB) $(LIBSO) |
.$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION): |
55 |
|
$(AS) $(AFLAGS) $< -o $@ |
|
|
|
|
$(LIB): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) |
|
|
ar rcs $@ $^ |
|
|
|
|
56 |
|
|
57 |
$(LIBSO): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) |
#----------------------------------------------------------------------------- |
58 |
$(CC) $(CFLAGS) $^ -shared -lc -lm -o $@ |
# Generic C rule |
59 |
|
#----------------------------------------------------------------------------- |
60 |
|
|
61 |
|
.c.$(OBJECT_EXTENSION): |
62 |
|
$(CC) -c $(CFLAGS) $< -o $@ |
63 |
|
|
64 |
|
#----------------------------------------------------------------------------- |
65 |
|
# Static Library |
66 |
|
#----------------------------------------------------------------------------- |
67 |
|
|
68 |
|
$(STATIC_LIB): $(OBJECTS) |
69 |
|
ar rc $(STATIC_LIB) $(OBJECTS) |
70 |
|
|
71 |
|
#----------------------------------------------------------------------------- |
72 |
|
# Shared Library |
73 |
|
#----------------------------------------------------------------------------- |
74 |
|
|
75 |
|
$(SHARED_LIB): $(OBJECTS) |
76 |
|
$(CC) $(LDFLAGS) $(OBJECTS) -o $(SHARED_LIB) $(OS_LDFLAGS) |
77 |
|
|
78 |
|
#----------------------------------------------------------------------------- |
79 |
|
# Installation |
80 |
|
#----------------------------------------------------------------------------- |
81 |
|
|
82 |
|
install: all |
83 |
|
@echo |
84 |
|
@echo "+---------- Installing XviD libraries in $(libdir) ----------+" |
85 |
|
@echo |
86 |
|
$(INSTALL) -m 755 $(SHARED_LIB) $(libdir)/$(SHARED_LIB) |
87 |
|
$(INSTALL) -m 755 $(STATIC_LIB) $(libdir)/$(STATIC_LIB) |
88 |
|
@echo |
89 |
|
@echo "+---------- Installing XviD header in $(includedir) ----------+" |
90 |
|
@echo |
91 |
|
$(INSTALL) -m 644 $(SRCDIR)/xvid.h $(includedir)/xvid.h |
92 |
|
@echo |
93 |
|
|
94 |
|
#----------------------------------------------------------------------------- |
95 |
|
# Platorm specific file -- dumb rule for people executing make before |
96 |
|
# ./configure |
97 |
|
#----------------------------------------------------------------------------- |
98 |
|
|
99 |
|
platform.inc: platform.inc.in |
100 |
|
./configure |
101 |
|
|
102 |
|
#----------------------------------------------------------------------------- |
103 |
|
# .PHONY targets |
104 |
|
#----------------------------------------------------------------------------- |
105 |
|
|
106 |
|
.PHONY: distclean clean info list-objects list-targets list-install-path |
107 |
|
|
108 |
clean: |
clean: |
109 |
$(RM) `find $(SRCDIR) -name "*.o"` |
$(RM) $(OBJECTS) |
110 |
|
$(RM) $(SHARED_LIB) |
111 |
|
$(RM) $(STATIC_LIB) |
112 |
|
|
113 |
|
distclean: clean |
114 |
|
$(RM) config.log |
115 |
|
$(RM) platform.inc |
116 |
|
$(RM) autom4te.cache |
117 |
|
|
118 |
|
list-objects: |
119 |
|
@echo |
120 |
|
@echo "Object files used for this build" |
121 |
|
@echo "---------------------------------------------------------------" |
122 |
|
@echo |
123 |
|
@echo $(OBJECTS) |
124 |
|
@echo |
125 |
|
|
126 |
|
list-targets: |
127 |
|
@echo |
128 |
|
@echo "Target Libraries" |
129 |
|
@echo "---------------------------------------------------------------" |
130 |
|
@echo |
131 |
|
@echo Shared library: $(SHARED_LIB) |
132 |
|
@echo Static library: $(STATIC_LIB) |
133 |
|
@echo |
134 |
|
|
135 |
|
list-install-path: |
136 |
|
@echo |
137 |
|
@echo "Install Paths" |
138 |
|
@echo "---------------------------------------------------------------" |
139 |
|
@echo |
140 |
|
@echo Include: $(includedir) |
141 |
|
@echo Library: $(libdir) |
142 |
|
@echo |
143 |
|
|
144 |
remove-all: |
info: list-objects list-targets list-install-path |
|
$(RM) $(DIRS) |
|
|
$(RM) $(DIRS_INTEL) |
|
|
$(RM) $(LIB) |
|
|
$(RM) $(LIBSO) |
|
|
|
|
|
|
|
|
install: libxvidcore.so |
|
|
cp libxvidcore.so $(LIBDIR) # you have to bee root for this |
|
|
/sbin/ldconfig |
|
|
|
|
|
install-test: libxvidcore.so # if you don't want to overwrite previous compile |
|
|
cp libxvidcore.so $(LIBDIR)/libtestcore.so |
|
|
/sbin/ldconfig |
|