crosstool-ng/Makefile.in
Yann E. MORIN" f15b8ade72 Get rid of the local-test in Makefile.
/trunk/Makefile.in       |   30    19    11     0 +++++++++++++++++++-----------
 /trunk/docs/overview.txt |   25    13    12     0 +++++++++++++------------
 2 files changed, 32 insertions(+), 23 deletions(-)
2008-11-16 22:19:57 +00:00

183 lines
4.8 KiB
Makefile

# Makefile.in for building crosstool-NG
# This file serves as source for the ./configure operation
MAKEFLAGS += --no-print-directory --no-builtin-rules
all: Makefile build
###############################################################################
# Sanity checks
# Check if Makefile is up to date:
Makefile: Makefile.in
@echo "$< did changed: you must re-run './configure'"
@false
# If installing with DESTDIR, check it's an absolute path
ifneq ($(strip $(DESTDIR)),)
ifneq ($(DESTDIR),$(abspath /$(DESTDIR)))
$(error DESTDIR is not an absolute PATH: '$(DESTDIR)')
endif
endif
###############################################################################
# Configuration variables
VERSION:= @@VERSION@@
BINDIR := @@BINDIR@@
LIBDIR := @@LIBDIR@@
DOCDIR := @@DOCDIR@@
MANDIR := @@MANDIR@@
DATE := @@DATE@@
LOCAL := @@LOCAL@@
MAKE := $(shell which $(MAKE) || type -p $(MAKE) || echo /usr/bin/make)
###############################################################################
# Global make rules
TARGETS := bin lib doc man
build: $(patsubst %,build-%,$(TARGETS))
install: real-install
clean: $(patsubst %,clean-%,$(TARGETS))
distclean: clean
@echo " RM 'Makefile'"
@rm -f Makefile
uninstall: real-uninstall
###############################################################################
# Specific make rules
#--------------------------------------
# Build rules
build-bin: ct-ng
build-lib:
build-doc:
build-man: docs/ct-ng.1.gz
docs/ct-ng.1.gz: docs/ct-ng.1
@echo " GZIP '$@'"
@gzip -c9 $< >$@
%: %.in Makefile
@echo " SED '$@'"
@sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;' \
-e 's,@@CT_BINDIR@@,$(BINDIR),g;' \
-e 's,@@CT_LIBDIR@@,$(LIBDIR),g;' \
-e 's,@@CT_DOCDIR@@,$(DOCDIR),g;' \
-e 's,@@CT_MANDIR@@,$(MANDIR),g;' \
-e 's,@@CT_VERSION@@,$(VERSION),g;' \
-e 's,@@CT_DATE@@,$(DATE),g;' \
$@.in >$@
#--------------------------------------
# Clean rules
clean-bin:
@echo " RM 'ct-ng'"
@rm -f ct-ng
clean-lib:
clean-doc:
clean-man:
@echo " RM 'docs/ct-ng.1'"
@rm -f docs/ct-ng.1
@echo " RM 'docs/ct-ng.1.gz'"
@rm -f docs/ct-ng.1.gz
#--------------------------------------
# Check for --local setup
ifeq ($(strip $(LOCAL)),1)
real-install: build
@echo " CHMOD 'ct-ng'"
@chmod a+x ct-ng
real-uninstall:
@true
else
#--------------------------------------
# Install rules
real-install: build $(patsubst %,install-%,$(TARGETS))
install-bin: $(DESTDIR)$(BINDIR)
@echo " INST 'ct-ng'"
@install -m 755 ct-ng "$(DESTDIR)$(BINDIR)/ct-ng"
# If one is hacking crosstool-NG, the patch set might change between any two
# installations of the same VERSION, thus the patches must be removed prior
# to being installed. It is simpler to remove the whole lib/ directory, as it
# is the goal of the install-lib rule to install the lib/ directory...
install-lib: uninstall-lib $(DESTDIR)$(LIBDIR) install-lib-main install-lib-samples
install-lib-main: $(DESTDIR)$(LIBDIR)
@for src_dir in config kconfig patches scripts tools; do \
echo " INST '$${src_dir}/'"; \
tar cf - --exclude=.svn $${src_dir} |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -); \
done
@rm -f "$(DESTDIR)$(LIBDIR)/tools/addToolVersion.sh"
@echo " INST 'steps.mk'"
@install -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
# Samples need a little love:
# - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
install-lib-samples: $(DESTDIR)$(LIBDIR) install-lib-main
@echo " INST 'samples/'"
@tar cf - --exclude=.svn samples |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
@for samp_file in "$(DESTDIR)$(LIBDIR)/samples/"*"/crosstool.config"; do \
sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
sed -r -i -e 's,^(CT_WORK_DIR)=.*,\1="\$${CT_TOP_DIR}/targets",;' $${samp_file}; \
done
install-doc: $(DESTDIR)$(DOCDIR)
@for doc_file in docs/CREDITS docs/overview.txt; do \
echo " INST '$${doc_file}'"; \
install -m 644 "$${doc_file}" "$(DESTDIR)$(DOCDIR)"; \
done
install-man: $(DESTDIR)$(MANDIR)
@echo " INST 'ct-ng.1.gz'"
@install -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)"
$(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)):
@echo " MKDIR '$@'"
@install -m 755 -d "$@"
#--------------------------------------
# Uninstall rules
real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
uninstall-bin:
@echo " RM '$(DESTDIR)$(BINDIR)/ct-ng'"
@rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
uninstall-lib:
@echo " RMDIR '$(DESTDIR)$(LIBDIR)/'"
@rm -rf "$(DESTDIR)$(LIBDIR)"
uninstall-doc:
@echo " RMDIR '$(DESTDIR)$(DOCDIR)/'"
@rm -rf "$(DESTDIR)$(DOCDIR)"
uninstall-man:
@echo " RM '$(DESTDIR)$(MANDIR)/ct-ng.1.gz'"
@rm -f "$(DESTDIR)$(MANDIR)/ct-ng.1"{,.gz}
endif # Not --local