Include the correct video4linux2 header
[ffmpeg-lucabe.git] / common.mak
blob36e5fe83764b6cfffb3a7431fcb36c18fa21c1b3
2 # common bits used by all libraries
5 SRC_DIR = $(SRC_PATH)/$(SUBDIR)
6 VPATH = $(SRC_DIR)
8 #FIXME: This should be in configure/config.mak
9 ifeq ($(CONFIG_WIN32),yes)
10 LDFLAGS = -Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
11 endif
13 ifeq ($(TARGET_GPROF),yes)
14 CFLAGS+=-p
15 LDFLAGS+=-p
16 endif
18 #FIXME: This should be in configure/config.mak
19 ifeq ($(TARGET_ARCH_SPARC64),yes)
20 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
21 endif
23 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
24 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
25 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
26 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
28 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
30 $(LIB): $(STATIC_OBJS)
31 rm -f $@
32 $(AR) rc $@ $^ $(EXTRAOBJS)
33 $(RANLIB) $@
35 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
36 ln -sf $^ $@
38 $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
39 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
40 ifeq ($(CONFIG_WIN32),yes)
41 -lib /machine:i386 /def:$(@:.dll=.def)
42 endif
44 %.o: %.c
45 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
47 %.o: %.S
48 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
50 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
51 %.o: %.cpp
52 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
54 depend: $(SRCS)
55 $(CC) -MM $(CFLAGS) $^ 1>.depend
57 dep: depend
59 clean::
60 rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
61 *.lib *.def *.dll.a *.exp
63 distclean: clean
64 rm -f .depend
66 ifeq ($(BUILD_SHARED),yes)
67 INSTLIBTARGETS += install-lib-shared
68 endif
69 ifeq ($(BUILD_STATIC),yes)
70 INSTLIBTARGETS += install-lib-static
71 endif
73 install: install-libs install-headers
75 install-libs: $(INSTLIBTARGETS)
77 install-lib-shared: $(SLIBNAME)
78 install -d "$(libdir)"
79 ifeq ($(CONFIG_WIN32),yes)
80 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
81 else
82 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
83 $(libdir)/$(SLIBNAME_WITH_VERSION)
84 ln -sf $(SLIBNAME_WITH_VERSION) \
85 $(libdir)/$(SLIBNAME_WITH_MAJOR)
86 ln -sf $(SLIBNAME_WITH_VERSION) \
87 $(libdir)/$(SLIBNAME)
88 endif
90 install-lib-static: $(LIB)
91 install -d "$(libdir)"
92 install -m 644 $(LIB) "$(libdir)"
94 install-headers:
95 install -d "$(incdir)"
96 install -d "$(libdir)/pkgconfig"
97 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
98 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
100 uninstall: uninstall-libs uninstall-headers
102 uninstall-libs:
103 ifeq ($(CONFIG_WIN32),yes)
104 -rm -f $(prefix)/$(SLIBNAME)
105 else
106 -rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
107 $(libdir)/$(SLIBNAME) \
108 $(libdir)/$(SLIBNAME_WITH_VERSION)
109 endif
110 -rm -f $(libdir)/$(LIB)
112 uninstall-headers:
113 rm -f $(addprefix $(incdir)/,$(HEADERS))
114 rm -f $(libdir)/pkgconfig/lib$(NAME).pc
117 # include dependency files if they exist
119 ifneq ($(wildcard .depend),)
120 include .depend
121 endif