[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.2, Sat May 11 15:41:48 2002 UTC revision 1.16, Mon May 23 09:29:43 2005 UTC
# Line 1  Line 1 
1  #/**************************************************************************  ##############################################################################
2  # *  #
3  # * linux makefile  # - Unified Makefile for XviD for *nix environments -
4  # *  #
5  # * nasm args:  # Copyright(C) 2003-2004 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 functional 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  #  - ar
20    #
21  CFLAGS = -DARCH_X86 -DLINUX  # Building output:
22  LIBDIR = /usr/local/lib  #  - C means "_C_ompiling"
23    #  - A means "_A_ssembling"
24  ifeq ($(CC),icc)  #  - I means "_I_nstalling"
25      CFLAGS+= -O3 -ip -tpp6 -xM                  # -tpp7 might be faster (P4 optmization)...  #  - D means "creating _D_irectory"
26      CFLAGS+= -I/opt/intel/compiler50/ia32/include -I/opt/intel/compiler50/ia32/substitute_headers/  #  - Cl means "_Cl_eaning"
27    #
28  else  # NB: (for mingw32/djgpp users)
29    #   These 2 environments do not provide a shell by default. So it's impossible
30  # CFLAGS += -funroll-loops -ffast-math -fstrict-aliasing -fomit-frame-pointer  #   to use the configure script to generate a platform.inc file suitable for
31  # CFLAGS += -fPIC  #   your machine. You have two choices:
32  # CFLAGS += -m486  #    - install minsys from the mingw project or install cygwin and then use
33  # CFLAGS += -march=pentium -mcpu=pentium  #      the configure script as on a unix system.
34   CFLAGS += -march=pentiumpro -mcpu=pentiumpro  #    - write a platform.inc file by hand.
35  # CFLAGS += -march=k6 -mcpu=k6  #
36    # PS: default build directory is "=build", it fits naming conventions that
37      CFLAGS += -Wall -O3 -funroll-loops -ffast-math  #     make the arch/tla revision control program ignore files contained in
38      CFLAGS += -fstrict-aliasing -fomit-frame-pointer  #     this directory during commits operations. This choice is completly
39  endif  #     arbitrary, but try not to change it.
40    #
41    ##############################################################################
42    
43  AS = nasm  include sources.inc
44  AFLAGS = -f elf  include platform.inc
   
 %.o: %.asm  
         $(AS) $(AFLAGS) $< -o $@  
45    
46  RM = rm -rf  RM = rm -rf
47    
48    ##############################################################################
49    #
50    # Build rules
51    #
52    ##############################################################################
53    
54    # Their Objects
55    OBJECTS  = $(GENERIC_OBJECTS)
56    OBJECTS += $(ASSEMBLY_OBJECTS)
57    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
67    #-----------------------------------------------------------------------------
68    
69    .SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c
70    
71    all: $(STATIC_LIB) $(SHARED_LIB)
72            @echo
73            @echo "---------------------------------------------------------------"
74            @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 "---------------------------------------------------------------"
80            @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
90    #-----------------------------------------------------------------------------
91    
92    .$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION):
93            @echo "  A: $(@D)/$(<F)"
94            @$(INSTALL) -d $(BUILD_DIR)/$(@D)
95            @$(AS) $(AFLAGS) $< -o $(BUILD_DIR)/$@
96    
97    #-----------------------------------------------------------------------------
98    # Generic C rule
99    #-----------------------------------------------------------------------------
100    
101    .c.$(OBJECT_EXTENSION):
102            @echo "  C: $(@D)/$(<F)"
103            @$(INSTALL) -d $(BUILD_DIR)/$(@D)
104            @$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $(BUILD_DIR)/$@
105    
106    #-----------------------------------------------------------------------------
107    # Static Library
108    #-----------------------------------------------------------------------------
109    
110    $(STATIC_LIB): $(BUILD_DIR) $(OBJECTS)
111            @echo "  L: $(@F)"
112            @cd $(BUILD_DIR) && ar rc $(@F) $(OBJECTS) && $(RANLIB) $(@F)
113    
114    #-----------------------------------------------------------------------------
115    # Shared Library
116    #
117    # NB: This rule is used a nasty way by the MacOSX module build process
118    #     In this only case, it uses the SPECIFIC_LDFLAGS to append an additionnal
119    #     linking step:
120    #      1/ it links a pre shared lib (libxvidcore.so-temp.4)
121    #      2/ it links that pre shared lib outputing the real shared lib (module)
122    #     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
137    #-----------------------------------------------------------------------------
138    
139    install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB)
140            @echo "  D: $(libdir)"
141            @$(INSTALL) -d $(DESTDIR)$(libdir)
142            @echo "  I: $(libdir)/$(SHARED_LIB)"
143            @$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB)
144            @echo "  I: $(libdir)/$(STATIC_LIB)"
145            @$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB)
146            @echo "  D: $(includedir)"
147            @$(INSTALL) -d $(DESTDIR)$(includedir)
148            @echo "  I: $(includedir)/xvid.h"
149            @$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(DESTDIR)$(includedir)/xvid.h
150    
151    #-----------------------------------------------------------------------------
152    # Platorm specific file -- dumb rules for people executing make before
153    # ./configure or even ./bootstrap.sh
154    #-----------------------------------------------------------------------------
155    
156    platform.inc: configure platform.inc.in
157            ./configure
158    
159    configure:
160            ./bootstrap.sh
161    
162    #-----------------------------------------------------------------------------
163    # .PHONY targets
164    #-----------------------------------------------------------------------------
165    
166  all: $(LIB) $(LIBSO)  .PHONY: mrproper distclean clean info \
167            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 $@  
   
168    
169  clean:  clean:
170          $(RM) `find $(SRCDIR) -name "*.o"`          @echo "  Cl: Build directory"
171            @$(RM) $(BUILD_DIR)
172    
173    distclean: clean
174            @echo "  Cl: Generated build files"
175            @$(RM) platform.inc
176            @$(RM) config.log
177            @$(RM) config.status
178            @$(RM) autom4te.cache
179    
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:
190            @echo
191            @echo "---------------------------------------------------------------"
192            @echo "Object files used for this build"
193            @echo "---------------------------------------------------------------"
194            @echo
195            @echo $(OBJECTS)
196            @echo
197    
198    list-targets:
199            @echo
200            @echo "---------------------------------------------------------------"
201            @echo "Target Libraries"
202            @echo "---------------------------------------------------------------"
203            @echo
204            @echo Shared library: $(SHARED_LIB)
205            @echo Static library: $(STATIC_LIB)
206            @echo
207    
208    list-install-path:
209            @echo
210            @echo "---------------------------------------------------------------"
211            @echo "Install Paths"
212            @echo "---------------------------------------------------------------"
213            @echo
214            @echo Include Directory: $(includedir)
215            @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
226    
227  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.2  
changed lines
  Added in v.1.16

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