]> git.sesse.net Git - ffmpeg/blob - libavutil/Makefile
4308cd09fd2f61350d1b5173e2bc3629666d9c70
[ffmpeg] / libavutil / Makefile
1 #
2 # libavutil Makefile
3 #
4 include ../config.mak
5
6 VPATH=$(SRC_PATH)/libavutil
7
8 # NOTE: -I.. is needed to include config.h
9 CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
10
11 OBJS= mathematics.o \
12       integer.o \
13       rational.o \
14       intfloat_readwrite.o \
15
16
17 ifeq ($(TARGET_ARCH_SPARC64),yes)
18 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
19 endif
20
21 SRCS := $(OBJS:.o=.c)
22
23 LIB= $(LIBPREF)avutil$(LIBSUF)
24 ifeq ($(BUILD_SHARED),yes)
25 SLIBNAME= $(SLIBPREF)avutil$(SLIBSUF)
26 ifeq ($(CONFIG_DARWIN),yes)
27 SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
28 endif
29 endif
30
31 all: $(LIB) $(SLIBNAME)
32
33 $(LIB): $(OBJS)
34         rm -f $@
35         $(AR) rc $@ $(OBJS)
36         $(RANLIB) $@
37
38 $(SLIBNAME): $(OBJS)
39 ifeq ($(CONFIG_WIN32),yes)
40         $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
41         -lib /machine:i386 /def:$(@:.dll=.def)
42 else
43         $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
44 endif
45
46 %.o: %.c
47         $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< 
48
49 depend: $(SRCS)
50         $(CC) -MM $(CFLAGS) $^ 1>.depend
51
52 dep:    depend
53
54 clean:
55         rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF)
56
57 distclean: clean
58         rm -f Makefile.bak .depend
59
60
61 ifeq ($(BUILD_SHARED),yes)
62 install: all install-headers
63 ifeq ($(CONFIG_WIN32),yes)
64         install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
65 else
66         install -d $(libdir)
67         install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavutil-$(VERSION)$(SLIBSUF)
68         ln -sf libavutil-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
69         $(LDCONFIG) || true
70 endif
71 else
72 install:
73 endif
74
75 installlib: all install-headers
76         install -m 644 $(LIB) "$(libdir)"
77
78 install-headers:
79         mkdir -p "$(prefix)/include/ffmpeg"
80         install -m 644 $(SRC_PATH)/libavutil/avutil.h \
81                        $(SRC_PATH)/libavutil/common.h \
82                        $(SRC_PATH)/libavutil/mathematics.h \
83                        $(SRC_PATH)/libavutil/integer.h \
84                        $(SRC_PATH)/libavutil/rational.h \
85                        $(SRC_PATH)/libavutil/intfloat_readwrite.h \
86                 "$(prefix)/include/ffmpeg"
87         install -d "$(libdir)/pkgconfig"
88         install -m 644 ../libavutil.pc "$(libdir)/pkgconfig"
89
90 #
91 # include dependency files if they exist
92 #
93 ifneq ($(wildcard .depend),)
94 include .depend
95 endif