build: rework rules for things in the tools dir
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
451db983
MR
5# first so "all" becomes default target
6all: all-yes
0e32c8c6 7
c5662879
DB
8OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
9
6ccf540f
DB
10OBJS += $(OBJS-yes)
11FFLIBS := $(FFLIBS-yes) $(FFLIBS)
12TESTPROGS += $(TESTPROGS-yes)
8b2121e3 13
deb3ed01
MR
14FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
15FFLDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
8b2121e3 16
deb3ed01
MR
17EXAMPLES := $(EXAMPLES:%=$(SUBDIR)%-example$(EXESUF))
18OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
19TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
20TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
21HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
22HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
28e1c979
MR
23TOOLS += $(TOOLS-yes)
24TOOLOBJS := $(TOOLS:%=tools/%.o)
25TOOLS := $(TOOLS:%=tools/%$(EXESUF))
8b2121e3 26
798b2646 27DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
76ca42a8 28
7b5e8a27 29ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
deb3ed01
MR
30SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
31SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
95f2c769 32checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
8b2121e3 33
28e1c979
MR
34alltools: $(TOOLS)
35
de4070b5
MR
36$(HOSTOBJS): %.o: %.c
37 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
38
39$(HOSTPROGS): %$(HOSTEXESUF): %.o
40 $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
41
5e27ec28
MR
42$(OBJS): | $(dir $(OBJS))
43$(HOSTOBJS): | $(dir $(HOSTOBJS))
44$(TESTOBJS): | $(dir $(TESTOBJS))
28e1c979 45$(TOOLOBJS): | tools
5e27ec28
MR
46
47OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
48
a482e61b 49CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
79de9c83 50DISTCLEANSUFFIXES = *.pc
8e8a67fa 51LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76a448ed 52
2f97b12e 53-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))