[cvs] / xvidcore / build / generic / Makefile Repository:
ViewVC logotype

Diff of /xvidcore/build/generic/Makefile

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

revision 1.1, Fri Mar 8 02:44:25 2002 UTC revision 1.13, Mon Apr 5 20:36:36 2004 UTC
# Line 1  Line 1 
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 Makefile 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    # Makefile functionnal dependencies:
15  include Makefile.inc  #  - echo
16    #  - rm (with option -r and -f)
17  CC = gcc  #  - cd
18  #CC=icc  #  - make VPATH support (eg: GNU make, solaris 8 make)
19  #CC = /opt/experimental/bin/gcc         # that's where SuSE installs gcc3  #
20    # Building output:
21  CFLAGS = -DARCH_X86 -DLINUX  #  - C means "_C_ompiling"
22  LIBDIR = /usr/local/lib  #  - A means "_A_ssembling"
23    #  - I means "_I_nstalling"
24  ifeq ($(CC),icc)  #  - D means "creating _D_irectory"
25      CFLAGS+= -O3 -ip -tpp6 -xM                  # -tpp7 might be faster (P4 optmization)...  #  - Cl means "_Cl_eaning"
26      CFLAGS+= -I/opt/intel/compiler50/ia32/include -I/opt/intel/compiler50/ia32/substitute_headers/  #
27    # NB: (for mingw32/djgpp users)
28  else  #   These 2 environments do not provide a shell by default. So it's impossible
29    #   to use the configure script to generate a platform.inc file suitable for
30  # CFLAGS += -funroll-loops -ffast-math -fstrict-aliasing -fomit-frame-pointer  #   your machine. You have two choices:
31  # CFLAGS += -fPIC  #    - install minsys from the mingw project or install cygwin and then use
32  # CFLAGS += -m486  #      the configure script as on a unix system.
33  # CFLAGS += -march=pentium -mcpu=pentium  #    - write a platform.inc file by hand.
34  # CFLAGS += -march=pentiumpro -mcpu=pentiumpro  #
35    # PS: default build directory is "=build", it fits naming conventions that
36      CFLAGS += -Wall -O3 -funroll-loops -ffast-math -march=pentiumpro -mcpu=pentiumpro  #     make the arch/tla revision control program ignore files contained in
37      CFLAGS += -fstrict-aliasing -fomit-frame-pointer  #     this directory during commits operations. This choice is completly
38  endif  #     arbitrary, but try not to change it.
39    #
40    ##############################################################################
41    
42  AS = nasm  include sources.inc
43  AFLAGS = -f elf  include platform.inc
   
 %.o: %.asm  
         $(AS) $(AFLAGS) $< -o $@  
44    
45  RM = rm -rf  RM = rm -rf
46    
47    ##############################################################################
48    #
49    # Build rules
50    #
51    ##############################################################################
52    
53    # Their Objects
54    OBJECTS  = $(GENERIC_OBJECTS)
55    OBJECTS += $(ASSEMBLY_OBJECTS)
56    OBJECTS += $(DCT_IA64_OBJECTS)
57    OBJECTS += $(PPC_ALTIVEC_OBJECTS)
58    
59    # The VPATH mecanism could use a "per target" build directory
60    # To keep it simple at the moment, the directory is fixed to "build"
61    BUILD_DIR = =build
62    VPATH     = $(SRC_DIR):$(BUILD_DIR)
63    
64    #-----------------------------------------------------------------------------
65    # The default rule
66    #-----------------------------------------------------------------------------
67    
68    .SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c
69    
70    all: $(STATIC_LIB) $(SHARED_LIB)
71            @echo
72            @echo "---------------------------------------------------------------"
73            @echo " XviD has been successfully built."
74            @echo
75            @echo " * Binaries are currently located in the '$(BUILD_DIR)' directory"
76            @echo " * To install them on your system, you can run '# make install'"
77            @echo "   as root."
78            @echo "---------------------------------------------------------------"
79            @echo
80    
81    $(OBJECTS): platform.inc
82    
83    $(BUILD_DIR):
84            @echo "  D: $(BUILD_DIR)"
85            @$(INSTALL) -d $(BUILD_DIR)
86    
87    #-----------------------------------------------------------------------------
88    # Generic assembly rule
89    #-----------------------------------------------------------------------------
90    
91    .$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION):
92            @echo "  A: $(@D)/$(<F)"
93            @$(INSTALL) -d $(BUILD_DIR)/$(@D)
94            @$(AS) $(AFLAGS) $< -o $(BUILD_DIR)/$@
95    
96    #-----------------------------------------------------------------------------
97    # Generic C rule
98    #-----------------------------------------------------------------------------
99    
100    .c.$(OBJECT_EXTENSION):
101            @echo "  C: $(@D)/$(<F)"
102            @$(INSTALL) -d $(BUILD_DIR)/$(@D)
103            @$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $(BUILD_DIR)/$@
104    
105    #-----------------------------------------------------------------------------
106    # Static Library
107    #-----------------------------------------------------------------------------
108    
109    $(STATIC_LIB): $(BUILD_DIR) $(OBJECTS)
110            @echo "  L: $(@F)"
111            @cd $(BUILD_DIR) && ar rc $(@F) $(OBJECTS) && $(RANLIB) $(@F)
112    
113    #-----------------------------------------------------------------------------
114    # Shared Library
115    #
116    # NB: This rule is used a nasty way by the MacOSX module build process
117    #     In this only case, it uses the SPECIFIC_LDFLAGS to append an additionnal
118    #     linking step:
119    #      1/ it links a pre shared lib (libxvidcore.so-temp.4)
120    #      2/ it links that pre shared lib outputing the real shared lib (module)
121    #     In all other cases this rule is straight forward and simple.
122    #     PRE_SHARED_LIB == SHARED_LIB and no nasty command appending.
123    #
124    # NB': we copy the def file for the win32 target, the file is unused on other
125    #      platforms
126    #-----------------------------------------------------------------------------
127    
128    $(SHARED_LIB): $(BUILD_DIR) $(OBJECTS)
129            @echo "  L: $(@F)"
130            @$(INSTALL) -m 644 libxvidcore.def $(BUILD_DIR)/libxvidcore.def
131            @cd $(BUILD_DIR) && $(CC) $(LDFLAGS) $(OBJECTS) -o $(PRE_SHARED_LIB) $(SPECIFIC_LDFLAGS)
132    
133    #-----------------------------------------------------------------------------
134    # Installation
135    #-----------------------------------------------------------------------------
136    
137    install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB)
138            @echo "  D: $(libdir)"
139            @$(INSTALL) -d $(libdir)
140            @echo "  I: $(libdir)/$(SHARED_LIB)"
141            @$(INSTALL) -m 755 $(BUILD_DIR)/$(SHARED_LIB) $(libdir)/$(SHARED_LIB)
142            @echo "  I: $(libdir)/$(STATIC_LIB)"
143            @$(INSTALL) -m 755 $(BUILD_DIR)/$(STATIC_LIB) $(libdir)/$(STATIC_LIB)
144            @echo "  D: $(includedir)"
145            @$(INSTALL) -d $(includedir)
146            @echo "  I: $(includedir)/xvid.h"
147            @$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(includedir)/xvid.h
148    
149    #-----------------------------------------------------------------------------
150    # Platorm specific file -- dumb rules for people executing make before
151    # ./configure or even ./bootstrap.sh
152    #-----------------------------------------------------------------------------
153    
154    platform.inc: configure platform.inc.in
155            ./configure
156    
157    configure:
158            ./bootstrap.sh
159    
160    #-----------------------------------------------------------------------------
161    # .PHONY targets
162    #-----------------------------------------------------------------------------
163    
164  all: $(LIB) $(LIBSO)  .PHONY: mrproper distclean clean info \
165            list-objects list-targets list-install-path list-cflags
   
 $(LIB): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o)  
         ar rcs $@ $^  
   
   
 $(LIBSO): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o)  
         $(CC) $(CFLAGS) $^ -shared -lc -lm -o $@  
   
166    
167  clean:  clean:
168          $(RM) `find $(SRCDIR) -name "*.o"`          @echo "  Cl: Build directory"
169            @$(RM) $(BUILD_DIR)
170    
171    distclean: clean
172            @echo "  Cl: Generated build files"
173            @$(RM) platform.inc
174            @$(RM) config.log
175            @$(RM) config.status
176            @$(RM) autom4te.cache
177    
178    mrproper: distclean
179            @echo "  Cl: Boostrapped build files"
180            @$(RM) configure
181            @$(RM) install-sh
182            @$(RM) missing
183            @$(RM) config.guess
184            @$(RM) mkinstalldirs
185            @$(RM) config.sub
186    
187    list-objects:
188            @echo
189            @echo "---------------------------------------------------------------"
190            @echo "Object files used for this build"
191            @echo "---------------------------------------------------------------"
192            @echo
193            @echo $(OBJECTS)
194            @echo
195    
196    list-targets:
197            @echo
198            @echo "---------------------------------------------------------------"
199            @echo "Target Libraries"
200            @echo "---------------------------------------------------------------"
201            @echo
202            @echo Shared library: $(SHARED_LIB)
203            @echo Static library: $(STATIC_LIB)
204            @echo
205    
206    list-install-path:
207            @echo
208            @echo "---------------------------------------------------------------"
209            @echo "Install Paths"
210            @echo "---------------------------------------------------------------"
211            @echo
212            @echo Include Directory: $(includedir)
213            @echo Library Directory: $(libdir)
214            @echo
215    
216    list-cflags:
217            @echo
218            @echo "---------------------------------------------------------------"
219            @echo "Using CFLAGS"
220            @echo "---------------------------------------------------------------"
221            @echo
222            @echo CFLAGS=$(CFLAGS)
223            @echo
224    
225  remove-all:  info: list-objects list-cflags 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  

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.13

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