[svn] / trunk / xvidcore / build / generic / Makefile Repository:
ViewVC logotype

Diff of /trunk/xvidcore/build/generic/Makefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 851, Sat Feb 15 15:22:19 2003 UTC revision 2042, Mon Sep 19 09:30:21 2011 UTC
# Line 1  Line 1 
1  ##############################################################################  ##############################################################################
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    
43  include sources.inc  include sources.inc
44    ifeq ($(findstring $(MAKECMDGOALS), clean distclean mrproper),)
45  include platform.inc  include platform.inc
46    endif
47    
48  RM = rm -rf  RM = rm -rf
49    
# Line 30  Line 53 
53  #  #
54  ##############################################################################  ##############################################################################
55    
 # Our main targets  
 STATIC_LIB=libxvidcore.$(STATIC_EXTENSION).3.0  
 SHARED_LIB=libxvidcore.$(SHARED_EXTENSION).3.0  
   
56  # Their Objects  # Their Objects
57  OBJECTS=$(GENERIC_OBJECTS)  OBJECTS=$(GENERIC_OBJECTS)
 OBJECTS+=$(DIVX4COMPAT_OBJECTS)  
58  OBJECTS+=$(ASSEMBLY_OBJECTS)  OBJECTS+=$(ASSEMBLY_OBJECTS)
59  OBJECTS+=$(DCT_IA64_OBJECTS)  OBJECTS+=$(DCT_IA64_OBJECTS)
60    OBJECTS += $(PPC_ALTIVEC_OBJECTS)
61    
62    # The VPATH mechanism could use a "per target" build directory
63    # To keep it simple at the moment, the directory is fixed to "build"
64    BUILD_DIR = =build
65    VPATH     = $(SRC_DIR):$(BUILD_DIR)
66    
67  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
68  # The default rule  # The default rule
# Line 46  Line 70 
70    
71  .SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c  .SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c
72    
73  all: platform.inc $(STATIC_LIB) $(SHARED_LIB)  all: info $(STATIC_LIB) $(SHARED_LIB)
74          @echo          @echo
75          @echo "---------------------------------------------------------------"          @echo "---------------------------------------------------------------"
76          @echo " XviD has been built, you can now run \"# make install\" as root."          @echo " Xvid has been successfully built."
77            @echo
78            @echo " * Binaries are currently located in the '$(BUILD_DIR)' directory"
79            @echo " * To install them on your system, you can run '# make install'"
80            @echo "   as root."
81          @echo "---------------------------------------------------------------"          @echo "---------------------------------------------------------------"
82          @echo          @echo
83    
84    $(OBJECTS): platform.inc
85    
86    $(BUILD_DIR):
87            @echo "  D: $(BUILD_DIR)"
88            @$(INSTALL) -d $(BUILD_DIR)
89    
90  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
91  # Generic assembly rule  # Generic assembly rule
92  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
93    
94  .$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION):  .$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION):
95          @echo -n "Assembling $< ... "          @echo "  A: $(@D)/$(<F)"
96          @$(AS) $(AFLAGS) $< -o $@          @$(INSTALL) -d $(BUILD_DIR)/$(@D)
97          @echo "Done"          @$(AS) $(AFLAGS) $< -o $(BUILD_DIR)/$@
98    
99  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
100  # Generic C rule  # Generic C rule
101  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
102    
103    $(PPC_ALTIVEC_OBJECTS): CFLAGS+= $(ALTIVEC_CFLAGS)
104    
105  .c.$(OBJECT_EXTENSION):  .c.$(OBJECT_EXTENSION):
106          @echo -n "Compiling $< ... "          @echo "  C: $(@D)/$(<F)"
107          @$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $@          @$(INSTALL) -d $(BUILD_DIR)/$(@D)
108          @echo "Done"          @$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $(BUILD_DIR)/$@
109    
110  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
111  # Static Library  # Static Library
112  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
113    
114  $(STATIC_LIB): $(OBJECTS)  $(STATIC_LIB): $(BUILD_DIR) $(OBJECTS)
115          @echo          @echo "  L: $(@F)"
116          @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"  
117    
118  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
119  # Shared Library  # Shared Library
120  #-----------------------------------------------------------------------------  #
121    # NB: This rule is used a nasty way by the MacOSX module build process
122  $(SHARED_LIB): $(OBJECTS)  #     In this only case, it uses the SPECIFIC_LDFLAGS to append an additionnal
123          @echo  #     linking step:
124          @echo -n "Linking the shared library... "  #      1/ it links a pre shared lib (libxvidcore.so-temp.4)
125          @$(CC) $(LDFLAGS) $(OBJECTS) -o $(SHARED_LIB) $(SPECIFIC_LDFLAGS)  #      2/ it links that pre shared lib outputing the real shared lib (module)
126          @echo "Done"  #     In all other cases this rule is straight forward and simple.
127    #     PRE_SHARED_LIB == SHARED_LIB and no nasty command appending.
128    #
129    # NB': we copy the def file for the win32 target, the file is unused on other
130    #      platforms
131    #-----------------------------------------------------------------------------
132    
133    $(SHARED_LIB): $(BUILD_DIR) $(OBJECTS)
134            @echo "  L: $(@F)"
135            @$(INSTALL) -m 644 libxvidcore.def $(BUILD_DIR)/libxvidcore.def
136            @$(INSTALL) -m 644 libxvidcore.ld $(BUILD_DIR)/libxvidcore.ld
137            @cd $(BUILD_DIR) && $(CC) $(LDFLAGS) $(OBJECTS) -o $(PRE_SHARED_LIB) $(SPECIFIC_LDFLAGS)
138    
139  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
140  # Installation  # Installation
141  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
142    
143  install: all  install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB)
144          @echo          @echo "  D: $(includedir)"
145          @echo "+---------- Installing XviD libraries in $(libdir) ----------+"          @$(INSTALL) -d $(DESTDIR)$(includedir)
146          @echo          @echo "  I: $(includedir)/xvid.h"
147          $(INSTALL) -m 755 $(SHARED_LIB) $(libdir)/$(SHARED_LIB)          @$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(DESTDIR)$(includedir)/xvid.h
148          $(INSTALL) -m 755 $(STATIC_LIB) $(libdir)/$(STATIC_LIB)          @echo "  D: $(libdir)"
149          @echo          @$(INSTALL) -d $(DESTDIR)$(libdir)
150          @echo "+---------- Installing XviD header in $(includedir) ----------+"          @echo "  I: $(libdir)/$(STATIC_LIB)"
151          @echo          @$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB)
152          $(INSTALL) -m 644 $(SRCDIR)/xvid.h $(includedir)/xvid.h  ifeq ($(SHARED_EXTENSION),dll)
153          @echo          @echo "  I: $(libdir)/$(SHARED_LIB).a"
154            @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB).a $(DESTDIR)$(libdir)/$(SHARED_LIB).a
155            @echo "  D: $(bindir)"
156            @$(INSTALL) -d $(DESTDIR)$(bindir)
157            @echo "  I: $(bindir)/$(SHARED_LIB)"
158            @$(INSTALL) -m 755 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(bindir)/$(SHARED_LIB)
159    else
160            @echo "  I: $(libdir)/$(SHARED_LIB)"
161            @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB)
162            @test -z "$(SO_API_MAJOR_LINK)" || \
163                    $(LN_S) $(SHARED_LIB) $(DESTDIR)$(libdir)/$(SO_API_MAJOR_LINK)
164            @test -z "$(SO_LINK)" || \
165                    $(LN_S) $(SHARED_LIB) $(DESTDIR)$(libdir)/$(SO_LINK)
166    endif
167    
168  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
169  # Platorm specific file -- dumb rule for people executing make before  # Platorm specific file -- dumb rules for people executing make before
170  # ./configure  # ./configure or even ./bootstrap.sh
171  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
172    
173  platform.inc: platform.inc.in  platform.inc: configure platform.inc.in
174          ./configure          ./configure
175    
176    configure:
177            ./bootstrap.sh
178    
179  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
180  # .PHONY targets  # .PHONY targets
181  #-----------------------------------------------------------------------------  #-----------------------------------------------------------------------------
182    
183  .PHONY: distclean clean info list-objects list-targets list-install-path list-cflags  .PHONY: mrproper distclean clean info \
184            list-objects list-targets list-install-path list-cflags
185    
186  clean:  clean:
187          @echo -n "Cleaning objects... "          @echo "  Cl: Build directory"
188          @$(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"  
   
189    
190  distclean: clean  distclean: clean
191          @echo -n "Cleaning generated files... "          @echo "  Cl: Generated build files"
         @$(RM) libxvidcore.def  
192          @$(RM) platform.inc          @$(RM) platform.inc
193          @$(RM) config.log          @$(RM) config.log
194            @$(RM) config.status
195          @$(RM) autom4te.cache          @$(RM) autom4te.cache
196          @echo "Done"  
197    mrproper: distclean
198            @echo "  Cl: Bootstrapped build files"
199            @$(RM) configure
200            @$(RM) install-sh
201            @$(RM) missing
202            @$(RM) config.guess
203            @$(RM) mkinstalldirs
204            @$(RM) config.sub
205    
206  list-objects:  list-objects:
207          @echo          @echo
208            @echo "---------------------------------------------------------------"
209          @echo "Object files used for this build"          @echo "Object files used for this build"
210          @echo "---------------------------------------------------------------"          @echo "---------------------------------------------------------------"
211          @echo          @echo
# Line 154  Line 214 
214    
215  list-targets:  list-targets:
216          @echo          @echo
217            @echo "---------------------------------------------------------------"
218          @echo "Target Libraries"          @echo "Target Libraries"
219          @echo "---------------------------------------------------------------"          @echo "---------------------------------------------------------------"
220          @echo          @echo
# Line 163  Line 224 
224    
225  list-install-path:  list-install-path:
226          @echo          @echo
227            @echo "---------------------------------------------------------------"
228          @echo "Install Paths"          @echo "Install Paths"
229          @echo "---------------------------------------------------------------"          @echo "---------------------------------------------------------------"
230          @echo          @echo
231          @echo Include: $(includedir)          @echo Include Directory: $(includedir)
232          @echo Library: $(libdir)          @echo Library Directory: $(libdir)
233          @echo          @echo
234    
235  list-cflags:  list-cflags:
236          @echo          @echo
237            @echo "---------------------------------------------------------------"
238          @echo "Using CFLAGS"          @echo "Using CFLAGS"
239          @echo "---------------------------------------------------------------"          @echo "---------------------------------------------------------------"
240          @echo          @echo

Legend:
Removed from v.851  
changed lines
  Added in v.2042

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4