You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sems/core/plug-in/Makefile.app_module

96 lines
2.3 KiB

COREPATH ?=../..
.DEFAULT_GOAL := all
include $(COREPATH)/../Makefile.defs
ldflags = $(LIB_LD_FLAGS) $(module_ldflags)
cflags = -I $(COREPATH) $(C_FLAGS) $(module_cflags)
cxxflags = -I $(COREPATH) $(CXX_FLAGS) $(module_cflags)
app_module_dir = $(COREPATH)/lib
lib_name = $(plug_in_name).so
lib_full_name = $(app_module_dir)/$(lib_name)
module_conf_files = $(wildcard etc/*.conf)
AUDIO_FILES=$(notdir $(wildcard wav/*.wav))
srcs = $(wildcard *.cpp)
hrds = $(wildcard *.h)
objs = $(srcs:.cpp=.o)
depends = $(srcs:.cpp=.d)
.PHONY: all
all: $(extra_target)
-@$(MAKE) deps && \
$(MAKE) $(lib_full_name)
.PHONY: module_package
module_package: $(extra_target)
-@$(MAKE) deps && \
$(MAKE) $(lib_name)
.PHONY: clean
clean: $(extra_clean)
-@rm -f $(objs) $(depends) $(lib_name)
.PHONY: deps
deps: $(depends) $(extra_depends)
.PHONY: install
install: all $(extra_install)
mkdir -p $(modules-prefix)/$(modules-dir)
$(INSTALL-TOUCH) $(modules-prefix)/$(modules-dir)/$(lib_name) ; \
$(INSTALL-MODULES) $(lib_name) $(modules-prefix)/$(modules-dir)
.PHONY: install-cfg
install-cfg:
mkdir -p $(cfg-prefix)/$(cfg-dir)etc
-@for r in $(module_conf_files); do \
echo installing $$r ; \
$(INSTALL-TOUCH) $(cfg-prefix)/$(cfg-dir)$$r ; \
$(INSTALL-CFG) $$r $(cfg-prefix)/$(cfg-dir)$$r; \
done
(audio-prefix)/$(audio-dir):
mkdir -p $(audio-prefix)/$(audio-dir)
.PHONY: $(plug_in_name)_audio
$(plug_in_name)_audio: $(audio-prefix)/$(audio-dir)
mkdir -p $(audio-prefix)/$(audio-dir)$(plug_in_name)
-@for f in $(AUDIO_FILES) ; do \
if [ -n "wav/$$f" ]; then \
$(INSTALL-TOUCH) $(audio-prefix)/$(audio-dir)$(plug_in_name)/$$f; \
$(INSTALL-AUDIO) wav/$$f $(audio-prefix)/$(audio-dir)$(plug_in_name)/$$f; \
fi ; \
done
%.d: %.cpp Makefile $(COREPATH)/plug-in/Makefile.app_module
$(GPP) -MM $< $(cxxflags) > $@
%.d: %.c Makefile $(COREPATH)/plug-in/Makefile.app_module
$(GCC) -MM $< $(cflags) > $@
%.o: %.cpp %.d
$(GPP) $(cxxflags) -c $< -o $@
%.o: %.c %.d
$(GCC) $(cflags) -c $< -o $@
$(lib_full_name): $(lib_name)
cp $(lib_name) $(lib_full_name)
$(lib_name): $(objs) $(module_extra_objs) Makefile
$(GPP) -o $(lib_name) $(objs) $(module_extra_objs) $(ldflags)
ifeq ($(lib_full_name),$(MAKECMDGOALS))
include $(depends)
endif
ifeq (,$(MAKECMDGOALS))
include $(depends)
endif