1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#!/usr/bin/make -f
#
# This makefile needs GNU make.
#
inst_msg = echo Installing $(msg) from $< to $$\(prefix\)$$\($(thisdir)\)/$<.
strip_comment_space = $(TOPDIR)/utils/shell-stripper
this_dir := $(patsubst $(shell cd $(TOPDIR); /bin/pwd)/%,%,$(CURDIR))
unexport clean_files clean_dirs
install:\
installshowconfig\
install.subdirs\
installmodules.real\
installbins.real\
installdocs.real\
installexamples.real\
%.subdirs:
ifdef SUBDIRS
set -e;\
for a in $(SUBDIRS); do\
$(MAKE) -C $$a $*;\
done
else
endif
$(patsubst %,install%,modules bins docs examples dirs): %: %.real %.subdirs
installmodules.real : $(patsubst %, $(prefix)$(moddir)/%,$(MODULES))
installbins.real : $(patsubst %, $(prefix)$(bindir)/%,$(BINS))
installdocs.real : $(patsubst %, $(prefix)$(docdir)/%,$(DOCS))
installexamples.real : $(patsubst %, $(prefix)$(empdir)/%,$(EXAMPLES))
installdirs.real : $(patsubst %,$(prefix)%,$(DIRS))
installshowconfig:
ifdef VERBOSE
echo "prefix is: $(prefix)"
echo "bindir is: $(bindir)"
echo "moddir is: $(moddir)"
echo
else
endif
$(patsubst %, $(prefix)$(moddir)/%,$(MODULES)) : msg=$(MODULES_MSG)
$(patsubst %, $(prefix)$(bindir)/%,$(BINS)) : msg=$(BINS_MSG)
$(patsubst %, $(prefix)$(docdir)/%,$(DOCS)) : msg=$(DOCS_MSG)
$(patsubst %, $(prefix)$(empdir)/%,$(EXAMPLES)) : msg=$(EXAMPLES_MSG)
$(patsubst %, $(prefix)$(moddir)/%,$(MODULES)) : thisdir=moddir
$(patsubst %, $(prefix)$(bindir)/%,$(BINS)) : thisdir=bindir
$(patsubst %, $(prefix)$(docdir)/%,$(DOCS)) : thisdir=docdir
$(patsubst %, $(prefix)$(empdir)/%,$(EXAMPLES)) : thisdir=empdir
$(patsubst %, $(prefix)$(moddir)/%,$(MODULES)): $(prefix)$(moddir)/%: % $(prefix)$(moddir) $(strip_comment_space)
$(inst_msg)
$(strip_comment_space) < $< > $@
$(patsubst %, $(prefix)$(bindir)/%,$(BINS)): $(prefix)$(bindir)/%: % $(prefix)$(bindir) $(strip_comment_space)
$(inst_msg)
$(strip_comment_space) < $< > $@
chmod +x $@
$(patsubst %, $(prefix)$(docdir)/%,$(DOCS)): $(prefix)$(docdir)/%: % $(prefix)$(docdir)
$(inst_msg)
install -m 644 $< $@
$(patsubst %, $(prefix)$(empdir)/%,$(EXAMPLES)): $(prefix)$(empdir)/%: % $(prefix)$(empdir)
$(inst_msg)
install -m 644 $< $@
$(patsubst %,$(prefix)%,$(DIRS)): $(prefix)%:
echo Making dir $$\(prefix\)$*
mkdir -p $@
.PHONY: installshowconfig installdirs installdocs installbins installshare ChangeLog
clean: clean.subdirs
echo Cleaning in $(this_dir)
if [ "$(clean_files)" ];then rm -f $(clean_files); fi
if [ "$(clean_dirs)" ];then rm -rf $(clean_dirs); fi
modules_tmp: modules_tmp.subdirs
modules="$(patsubst %,$(this_dir)/%,$(MODULES))";\
if [ "$$modules" ]; then\
echo $$modules;\
fi >> $(TOPDIR)/$@
ifndef NOISY
.SILENT:
endif
include $(TOPDIR)/Makefile.vars
|