mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 20:19:55 +00:00
dfd9159f3d
Many compilers need special flags to compile *.h files as regular source code, if they will do so at all. Rather than hoping all compilers will have such a flag and adding mappings for it, create wrapper .c files for test building single headers. This allows using the regular rule for compiling C files without the need for special flags, and it also provides proper dependency tracking for these objects. Signed-off-by: Mans Rullgard <mans@mansr.com>
55 lines
1.6 KiB
Makefile
55 lines
1.6 KiB
Makefile
#
|
|
# common bits used by all libraries
|
|
#
|
|
|
|
# first so "all" becomes default target
|
|
all: all-yes
|
|
|
|
include $(SRC_PATH)/arch.mak
|
|
|
|
OBJS += $(OBJS-yes)
|
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
|
TESTPROGS += $(TESTPROGS-yes)
|
|
|
|
FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
|
|
|
|
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))
|
|
TOOLS += $(TOOLS-yes)
|
|
TOOLOBJS := $(TOOLS:%=tools/%.o)
|
|
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
|
|
|
|
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
|
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
|
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
|
|
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
|
|
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
|
|
checkheaders: $(HOBJS)
|
|
.SECONDARY: $(HOBJS:.o=.c)
|
|
|
|
alltools: $(TOOLS)
|
|
|
|
$(HOSTOBJS): %.o: %.c
|
|
$(call COMPILE,HOSTCC)
|
|
|
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
|
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
|
|
|
|
$(OBJS): | $(sort $(dir $(OBJS)))
|
|
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
|
|
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
|
|
$(TOOLOBJS): | tools
|
|
|
|
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
|
|
|
|
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver
|
|
DISTCLEANSUFFIXES = *.pc
|
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
|
|
|
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))
|