2 |
# |
# |
3 |
# - Unified Makefile for XviD for *nix environments - |
# - Unified Makefile for XviD for *nix environments - |
4 |
# |
# |
5 |
# Copyright(C) 2003 Edouard Gomez <ed.gomez@free.fr> |
# Copyright(C) 2003-2004 Edouard Gomez <ed.gomez@free.fr> |
6 |
# |
# |
7 |
# |
# |
8 |
# Description: |
# Description: |
9 |
# This Makefile allows building XviD sources to obtain a shared library |
# This Makefile allows building XviD sources to obtain a shared library |
10 |
# and a static library. This Makefie uses variables defined in the |
# and a static library. This Makefile uses variables defined in the |
11 |
# platform.inc file. This platform.inc file is usually created by the |
# platform.inc file. This platform.inc file is usually created by the |
12 |
# ./configure script whenever a unix shell is available. |
# ./configure script whenever a unix shell is available. |
13 |
# |
# |
14 |
# Nota Bene for mingw32/djgpp users: |
# Makefile functional dependencies: |
15 |
# However if you provide a platform.inc file adapted to your OS, then |
# - echo |
16 |
# change the include platform.inc to include yourfile.inc and it should |
# - rm (with option -r and -f) |
17 |
# work too. |
# - cd |
18 |
# |
# - make VPATH support (eg: GNU make, solaris 8 make) |
19 |
|
# - ar |
20 |
|
# |
21 |
|
# Building output: |
22 |
|
# - C means "_C_ompiling" |
23 |
|
# - A means "_A_ssembling" |
24 |
|
# - I means "_I_nstalling" |
25 |
|
# - D means "creating _D_irectory" |
26 |
|
# - Cl means "_Cl_eaning" |
27 |
|
# |
28 |
|
# NB: (for mingw32/djgpp users) |
29 |
|
# These 2 environments do not provide a shell by default. So it's impossible |
30 |
|
# to use the configure script to generate a platform.inc file suitable for |
31 |
|
# your machine. You have two choices: |
32 |
|
# - install minsys from the mingw project or install cygwin and then use |
33 |
|
# the configure script as on a unix system. |
34 |
|
# - write a platform.inc file by hand. |
35 |
|
# |
36 |
|
# PS: default build directory is "=build", it fits naming conventions that |
37 |
|
# make the arch/tla revision control program ignore files contained in |
38 |
|
# this directory during commits operations. This choice is completly |
39 |
|
# arbitrary, but try not to change it. |
40 |
# |
# |
41 |
############################################################################## |
############################################################################## |
42 |
|
|
51 |
# |
# |
52 |
############################################################################## |
############################################################################## |
53 |
|
|
|
# Our main targets |
|
|
STATIC_LIB=libxvidcore.$(STATIC_EXTENSION) |
|
|
SHARED_LIB=libxvidcore.$(SHARED_EXTENSION) |
|
|
|
|
54 |
# Their Objects |
# Their Objects |
55 |
OBJECTS=$(GENERIC_OBJECTS) |
OBJECTS=$(GENERIC_OBJECTS) |
|
OBJECTS+=$(DIVX4COMPAT_OBJECTS) |
|
56 |
OBJECTS+=$(ASSEMBLY_OBJECTS) |
OBJECTS+=$(ASSEMBLY_OBJECTS) |
57 |
OBJECTS+=$(DCT_IA64_OBJECTS) |
OBJECTS+=$(DCT_IA64_OBJECTS) |
58 |
|
OBJECTS += $(PPC_ALTIVEC_OBJECTS) |
59 |
|
|
60 |
|
# The VPATH mechanism could use a "per target" build directory |
61 |
|
# To keep it simple at the moment, the directory is fixed to "build" |
62 |
|
BUILD_DIR = =build |
63 |
|
VPATH = $(SRC_DIR):$(BUILD_DIR) |
64 |
|
|
65 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
66 |
# The default rule |
# The default rule |
68 |
|
|
69 |
.SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c |
.SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c |
70 |
|
|
71 |
all: platform.inc $(STATIC_LIB) $(SHARED_LIB) |
all: $(STATIC_LIB) $(SHARED_LIB) |
72 |
@echo |
@echo |
73 |
@echo "---------------------------------------------------------------" |
@echo "---------------------------------------------------------------" |
74 |
@echo " XviD has been built, you can now run \"# make install\" as root." |
@echo " XviD has been successfully built." |
75 |
|
@echo |
76 |
|
@echo " * Binaries are currently located in the '$(BUILD_DIR)' directory" |
77 |
|
@echo " * To install them on your system, you can run '# make install'" |
78 |
|
@echo " as root." |
79 |
@echo "---------------------------------------------------------------" |
@echo "---------------------------------------------------------------" |
80 |
@echo |
@echo |
81 |
|
|
82 |
|
$(OBJECTS): platform.inc |
83 |
|
|
84 |
|
$(BUILD_DIR): |
85 |
|
@echo " D: $(BUILD_DIR)" |
86 |
|
@$(INSTALL) -d $(BUILD_DIR) |
87 |
|
|
88 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
89 |
# Generic assembly rule |
# Generic assembly rule |
90 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
91 |
|
|
92 |
.$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION): |
.$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION): |
93 |
@echo -n "Assembling $< ... " |
@echo " A: $(@D)/$(<F)" |
94 |
@$(AS) $(AFLAGS) $< -o $@ |
@$(INSTALL) -d $(BUILD_DIR)/$(@D) |
95 |
@echo "Done" |
@$(AS) $(AFLAGS) $< -o $(BUILD_DIR)/$@ |
96 |
|
|
97 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
98 |
# Generic C rule |
# Generic C rule |
99 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
100 |
|
|
101 |
.c.$(OBJECT_EXTENSION): |
.c.$(OBJECT_EXTENSION): |
102 |
@echo -n "Compiling $< ... " |
@echo " C: $(@D)/$(<F)" |
103 |
@$(CC) -c $(CFLAGS) $< -o $@ |
@$(INSTALL) -d $(BUILD_DIR)/$(@D) |
104 |
@echo "Done" |
@$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $(BUILD_DIR)/$@ |
105 |
|
|
106 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
107 |
# Static Library |
# Static Library |
108 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
109 |
|
|
110 |
$(STATIC_LIB): $(OBJECTS) |
$(STATIC_LIB): $(BUILD_DIR) $(OBJECTS) |
111 |
@echo |
@echo " L: $(@F)" |
112 |
@echo -n "Linking the static library... " |
@cd $(BUILD_DIR) && ar rc $(@F) $(OBJECTS) && $(RANLIB) $(@F) |
|
@ar rc $(STATIC_LIB) $(OBJECTS) |
|
|
@echo "Done" |
|
|
@echo -n "Generating static library's index... " |
|
|
@$(RANLIB) $(STATIC_LIB) |
|
|
@echo "Done" |
|
113 |
|
|
114 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
115 |
# Shared Library |
# Shared Library |
116 |
#----------------------------------------------------------------------------- |
# |
117 |
|
# NB: This rule is used a nasty way by the MacOSX module build process |
118 |
$(SHARED_LIB): $(OBJECTS) |
# In this only case, it uses the SPECIFIC_LDFLAGS to append an additionnal |
119 |
@echo |
# linking step: |
120 |
@echo -n "Linking the shared library... " |
# 1/ it links a pre shared lib (libxvidcore.so-temp.4) |
121 |
@$(CC) $(LDFLAGS) $(OBJECTS) -o $(SHARED_LIB) $(SPECIFIC_LDFLAGS) |
# 2/ it links that pre shared lib outputing the real shared lib (module) |
122 |
@echo "Done" |
# In all other cases this rule is straight forward and simple. |
123 |
|
# PRE_SHARED_LIB == SHARED_LIB and no nasty command appending. |
124 |
|
# |
125 |
|
# NB': we copy the def file for the win32 target, the file is unused on other |
126 |
|
# platforms |
127 |
|
#----------------------------------------------------------------------------- |
128 |
|
|
129 |
|
$(SHARED_LIB): $(BUILD_DIR) $(OBJECTS) |
130 |
|
@echo " L: $(@F)" |
131 |
|
@$(INSTALL) -m 644 libxvidcore.def $(BUILD_DIR)/libxvidcore.def |
132 |
|
@$(INSTALL) -m 644 libxvidcore.ld $(BUILD_DIR)/libxvidcore.ld |
133 |
|
@cd $(BUILD_DIR) && $(CC) $(LDFLAGS) $(OBJECTS) -o $(PRE_SHARED_LIB) $(SPECIFIC_LDFLAGS) |
134 |
|
|
135 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
136 |
# Installation |
# Installation |
137 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
138 |
|
|
139 |
install: all |
install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB) |
140 |
@echo |
@echo " D: $(libdir)" |
141 |
@echo "+---------- Installing XviD libraries in $(libdir) ----------+" |
@$(INSTALL) -d $(DESTDIR)$(libdir) |
142 |
@echo |
@echo " I: $(libdir)/$(SHARED_LIB)" |
143 |
$(INSTALL) -m 755 $(SHARED_LIB) $(libdir)/$(SHARED_LIB) |
@$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB) |
144 |
$(INSTALL) -m 755 $(STATIC_LIB) $(libdir)/$(STATIC_LIB) |
@echo " I: $(libdir)/$(STATIC_LIB)" |
145 |
@echo |
@$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB) |
146 |
@echo "+---------- Installing XviD header in $(includedir) ----------+" |
@echo " D: $(includedir)" |
147 |
@echo |
@$(INSTALL) -d $(DESTDIR)$(includedir) |
148 |
$(INSTALL) -m 644 $(SRCDIR)/xvid.h $(includedir)/xvid.h |
@echo " I: $(includedir)/xvid.h" |
149 |
@echo |
@$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(DESTDIR)$(includedir)/xvid.h |
150 |
|
|
151 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
152 |
# Platorm specific file -- dumb rule for people executing make before |
# Platorm specific file -- dumb rules for people executing make before |
153 |
# ./configure |
# ./configure or even ./bootstrap.sh |
154 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
155 |
|
|
156 |
platform.inc: platform.inc.in |
platform.inc: configure platform.inc.in |
157 |
./configure |
./configure |
158 |
|
|
159 |
|
configure: |
160 |
|
./bootstrap.sh |
161 |
|
|
162 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
163 |
# .PHONY targets |
# .PHONY targets |
164 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
165 |
|
|
166 |
.PHONY: distclean clean info list-objects list-targets list-install-path |
.PHONY: mrproper distclean clean info \ |
167 |
|
list-objects list-targets list-install-path list-cflags |
168 |
|
|
169 |
clean: |
clean: |
170 |
@echo -n "Cleaning objects... " |
@echo " Cl: Build directory" |
171 |
@$(RM) $(OBJECTS) |
@$(RM) $(BUILD_DIR) |
|
@echo "Done" |
|
|
@echo -n "Cleaning static library... " |
|
|
@$(RM) $(STATIC_LIB) |
|
|
@echo "Done" |
|
|
@echo -n "Cleaning shared library... " |
|
|
@$(RM) $(SHARED_LIB) |
|
|
@echo "Done" |
|
|
|
|
172 |
|
|
173 |
distclean: clean |
distclean: clean |
174 |
@echo -n "Cleaning generated files... " |
@echo " Cl: Generated build files" |
|
@$(RM) libxvidcore.def |
|
175 |
@$(RM) platform.inc |
@$(RM) platform.inc |
176 |
@$(RM) config.log |
@$(RM) config.log |
177 |
|
@$(RM) config.status |
178 |
@$(RM) autom4te.cache |
@$(RM) autom4te.cache |
179 |
@echo "Done" |
|
180 |
|
mrproper: distclean |
181 |
|
@echo " Cl: Bootstrapped build files" |
182 |
|
@$(RM) configure |
183 |
|
@$(RM) install-sh |
184 |
|
@$(RM) missing |
185 |
|
@$(RM) config.guess |
186 |
|
@$(RM) mkinstalldirs |
187 |
|
@$(RM) config.sub |
188 |
|
|
189 |
list-objects: |
list-objects: |
190 |
@echo |
@echo |
191 |
|
@echo "---------------------------------------------------------------" |
192 |
@echo "Object files used for this build" |
@echo "Object files used for this build" |
193 |
@echo "---------------------------------------------------------------" |
@echo "---------------------------------------------------------------" |
194 |
@echo |
@echo |
197 |
|
|
198 |
list-targets: |
list-targets: |
199 |
@echo |
@echo |
200 |
|
@echo "---------------------------------------------------------------" |
201 |
@echo "Target Libraries" |
@echo "Target Libraries" |
202 |
@echo "---------------------------------------------------------------" |
@echo "---------------------------------------------------------------" |
203 |
@echo |
@echo |
207 |
|
|
208 |
list-install-path: |
list-install-path: |
209 |
@echo |
@echo |
210 |
|
@echo "---------------------------------------------------------------" |
211 |
@echo "Install Paths" |
@echo "Install Paths" |
212 |
@echo "---------------------------------------------------------------" |
@echo "---------------------------------------------------------------" |
213 |
@echo |
@echo |
214 |
@echo Include: $(includedir) |
@echo Include Directory: $(includedir) |
215 |
@echo Library: $(libdir) |
@echo Library Directory: $(libdir) |
216 |
|
@echo |
217 |
|
|
218 |
|
list-cflags: |
219 |
|
@echo |
220 |
|
@echo "---------------------------------------------------------------" |
221 |
|
@echo "Using CFLAGS" |
222 |
|
@echo "---------------------------------------------------------------" |
223 |
|
@echo |
224 |
|
@echo CFLAGS=$(CFLAGS) |
225 |
@echo |
@echo |
226 |
|
|
227 |
info: list-objects list-targets list-install-path |
info: list-objects list-cflags list-targets list-install-path |