common.mak 1.61 KB
Newer Older
1 2 3 4
#
# common bits used by all libraries
#

5 6
# first so "all" becomes default target
all: all-yes
7

8 9
OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)

Diego Biurrun's avatar
Diego Biurrun committed
10 11 12
OBJS      += $(OBJS-yes)
FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
TESTPROGS += $(TESTPROGS-yes)
13

14 15
FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
FFLDFLAGS   := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
16

17 18 19 20 21 22
EXAMPLES  := $(EXAMPLES:%=$(SUBDIR)%-example$(EXESUF))
OBJS      := $(sort $(OBJS:%=$(SUBDIR)%))
TESTOBJS  := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
HOSTOBJS  := $(HOSTPROGS:%=$(SUBDIR)%.o)
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
23 24 25
TOOLS     += $(TOOLS-yes)
TOOLOBJS  := $(TOOLS:%=tools/%.o)
TOOLS     := $(TOOLS:%=tools/%$(EXESUF))
26

27
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
Måns Rullgård's avatar
Måns Rullgård committed
28

29
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
30 31
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
32
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
33

34 35
alltools: $(TOOLS)

36 37 38 39 40 41
$(HOSTOBJS): %.o: %.c
	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<

$(HOSTPROGS): %$(HOSTEXESUF): %.o
	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)

42 43 44
$(OBJS):     | $(dir $(OBJS))
$(HOSTOBJS): | $(dir $(HOSTOBJS))
$(TESTOBJS): | $(dir $(TESTOBJS))
45
$(TOOLOBJS): | tools
46 47 48

OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))

49
CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
50
DISTCLEANSUFFIXES = *.pc
51
LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
52

53
-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))