| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #
- # $Id$
- #
- # module Makefile
- #(to be included from each module)
- #
- # History:
- # --------
- # 2007-03-29 if a module depends on SER_LIBS, it will be rebuilt on install
- # with the proper rpath; libraries will be automatically
- # installed if needed (andrei)
- # 2008-06-23 added the README & man targets (andrei)
- # 2008-06-27 make cfg / config.mak support (andrei)
- # 2009-03-10 replaced DEFS with C_DEFS and INCLUDES with C_INCLUDES (DEFS
- # and INCLUDES are now used only for "temporary" defines/includes
- # inside modules or libs) (andrei)
- #
- MOD_NAME=$(NAME:.so=)
- # allow placing modules in separate directory apart from ser core
- COREPATH ?=../..
- ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
- $(COREPATH)/Makefile.modules $(COREPATH)/config.mak
- #override modules value, a module cannot have submodules
- override modules=
- override static_modules=
- override static_modules_path=
- # should be set in the Makefile of each module
- # INCLUDES += -I$(COREPATH)
- # temporary def (visible only in the module, not exported)
- DEFS += -DMOD_NAME='"$(MOD_NAME)"'
- ifneq ($(makefile_defs_included),1)
- $(error "the local makefile does not include Makefile.defs!")
- endif
- ifeq ($(MAKELEVEL), 0)
- # make called directly in the module dir!
- #$(warning "you should run make from the main ser directory")
- else
- # called by the main Makefile
- ALLDEP+=$(COREPATH)/Makefile
- endif
- include $(COREPATH)/Makefile.sources
- # if config was not loaded (makefile_defs!=1) ignore
- # the rest of makefile and try only to remake the config
- ifeq ($(makefile_defs),1)
- ifeq (,$(filter $(MOD_NAME), $(static_modules)))
- CFLAGS:=$(MOD_CFLAGS)
- LDFLAGS:=$(MOD_LDFLAGS)
- endif
- include $(COREPATH)/Makefile.targets
- include $(COREPATH)/Makefile.rules
- $(modules_prefix)/$(modules_dir):
- mkdir -p $(modules_prefix)/$(modules_dir)
- LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
- .PHONY: install
- .PHONY: install-libs
- install: $(NAME) $(modules_prefix)/$(modules_dir) install-libs
- $(INSTALL_TOUCH) $(modules_prefix)/$(modules_dir)/$(NAME)
- $(INSTALL_MODULES) $(NAME) $(modules_prefix)/$(modules_dir)
- install-libs:
- @for lib in $(dir $(SER_LIBS)); do \
- $(MAKE) -C "$${lib}" install-if-newer ;\
- done
- # README build rules
- ifneq (,$(wildcard doc/Makefile))
- #doc/Makefile present => we can generate README
- README: doc/*.xml
- $(MAKE) -C doc $(MOD_NAME).txt
- cp doc/$(MOD_NAME).txt $@
- else
- # do nothing
- README:
- endif
- #man page build rules
- ifneq (,$(wildcard $(MOD_NAME).xml))
- $(MOD_NAME).7: $(MOD_NAME).xml
- docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl $<
- man: $(MOD_NAME).7
- else
- man:
- endif
- endif # ifeq($(makefile_defs),1)
- include $(COREPATH)/Makefile.cfg
|