mirror of
https://github.com/videolan/vlc.git
synced 2025-01-11 02:08:36 +08:00
05e3077cc5
name but with different directory names. * ./Makefile: plugins get installed in different directory names. * ALL: additional -ansi -pedantic fixes.
98 lines
3.2 KiB
Makefile
98 lines
3.2 KiB
Makefile
###############################################################################
|
|
# vlc (VideoLAN Client) common module Makefile
|
|
# (c)2001 VideoLAN
|
|
###############################################################################
|
|
# This file should be included by all module Makefiles
|
|
###############################################################################
|
|
|
|
#
|
|
# include the local Makefile
|
|
#
|
|
include Makefile
|
|
|
|
#
|
|
# Analyze the target we are asked to build
|
|
#
|
|
module_name := $(shell echo $(MAKECMDGOALS) | sed 's@\..*@@')
|
|
suff := $(shell echo $(MAKECMDGOALS) | sed 's@.*\.@@' | tr so/a lo/o)
|
|
|
|
#
|
|
# Compiler flags
|
|
#
|
|
SRC_C := $(filter %.c,$($(module_name)_SOURCES))
|
|
SRC_CPP := $(filter %.cpp,$($(module_name)_SOURCES))
|
|
SRC_M := $(filter %.m,$($(module_name)_SOURCES))
|
|
|
|
plugins_CFLAGS += -D__PLUGIN__ -I$(PARENT)/include -I$(PARENT)/extras
|
|
builtins_CFLAGS += -D__BUILTIN__ -I$(PARENT)/include -I$(PARENT)/extras
|
|
|
|
ifeq (lo,$(suff))
|
|
extra_CFLAGS := $(plugins_CFLAGS) $($(module_name)_CFLAGS) \
|
|
-DMODULE_NAME=$(module_name) -DMODULE_NAME_IS_$(module_name) \
|
|
-DMODULE_PATH=$(MODULE_PATH) $($(module_name)_so_CFLAGS)
|
|
OBJ_ALL := $(SRC_C:%.c=%.lo.$(module_name)) $(SRC_CPP:%.cpp=%.lo.$(module_name))
|
|
else
|
|
extra_CFLAGS := $(builtins_CFLAGS) $($(module_name)_CFLAGS) \
|
|
-DMODULE_NAME=$(module_name) -DMODULE_NAME_IS_$(module_name) \
|
|
-DMODULE_PATH=$(MODULE_PATH) $($(module_name)_a_CFLAGS)
|
|
OBJ_ALL := $(SRC_C:%.c=%.o.$(module_name)) $(SRC_CPP:%.cpp=%.o.$(module_name)) \
|
|
$(SRC_M:%.m=%.o.$(module_name))
|
|
endif
|
|
|
|
#
|
|
# Standard dependencies
|
|
#
|
|
C_DEP := $(SRC_C:%.c=.dep/%.d)
|
|
CPP_DEP := $(SRC_CPP:%.cpp=.dep/%.dpp)
|
|
M_DEP := $(SRC_M:%.m=.dep/%.dm)
|
|
|
|
export
|
|
|
|
#
|
|
# Virtual targets
|
|
#
|
|
all:
|
|
|
|
clean:
|
|
# rm -f $(PLUGIN_ALL) $(BUILTIN_ALL)
|
|
rm -f *.a *.so *.o *.o.* *.lo.* *.obj *.moc *.moc.* *.bak
|
|
rm -Rf .dep
|
|
|
|
FORCE:
|
|
|
|
$(OBJ_ALL): $(PARENT)/Makefile.modules $(PARENT)/Makefile.dep $(PARENT)/Makefile $(PARENT)/Makefile.opts Makefile
|
|
$(OBJ_ALL): $(H_DEP:%=$(PARENT)/include/%)
|
|
|
|
$(C_DEP): %.d: FORCE
|
|
@$(MAKE) -s --no-print-directory -f $(PARENT)/Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
|
|
|
|
$(CPP_DEP): %.dpp: FORCE
|
|
@$(MAKE) -s --no-print-directory -f $(PARENT)/Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
|
|
|
|
$(M_DEP): %.dm: FORCE
|
|
@$(MAKE) -s --no-print-directory -f $(PARENT)/Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
|
|
|
|
$(SRC_C:%.c=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.d
|
|
$(SRC_C:%.c=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.c
|
|
$(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
|
|
|
|
$(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dpp
|
|
$(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.cpp
|
|
$(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
|
|
|
|
$(SRC_M:%.m=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dm
|
|
$(SRC_M:%.m=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.m
|
|
$(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
|
|
|
|
# foo_CUSTOM lets us override all target rules for foo.so and foo.a
|
|
ifeq (,$($(module_name)_CUSTOM))
|
|
$(module_name).so: $(EXTRA_DEP) $(OBJ_ALL)
|
|
$(CC) $(OBJ_ALL) $(LDFLAGS) $(plugins_LDFLAGS) $($(module_name)_LDFLAGS) -o $@
|
|
|
|
$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL)
|
|
rm -f $@
|
|
ar rc $@ $(OBJ_ALL)
|
|
$(RANLIB) $@
|
|
endif
|
|
|