2007-07-02 19:40:54 +00:00
|
|
|
# Makefile.in for building crosstool-NG
|
2007-07-01 19:04:20 +00:00
|
|
|
# This file serves as source for the ./configure operation
|
|
|
|
|
2009-01-26 22:43:08 +00:00
|
|
|
# This series of test is here because GNU make 3.81 will *not* use MAKEFLAGS
|
|
|
|
# to set additional flags in the current Makfile ( see:
|
|
|
|
# http://savannah.gnu.org/bugs/?20501 ), although the make manual says it
|
|
|
|
# should ( see: http://www.gnu.org/software/make/manual/make.html#Options_002fRecursion )
|
|
|
|
# so we have to work it around by calling ourselves back if needed
|
|
|
|
|
|
|
|
# So why do we need not to use the built rules and variables? Because we
|
|
|
|
# need to generate scripts/crosstool-NG.sh from scripts/crosstool-NG.sh.in
|
|
|
|
# and there is a built-in implicit rule '%.sh:' that has neither a pre-requisite
|
|
|
|
# nor a command associated, and that built-in implicit rule takes precedence
|
|
|
|
# over our non-built-in implicit rule '%: %.in', below.
|
|
|
|
|
|
|
|
# CT_MAKEFLAGS will be used later, below...
|
|
|
|
|
|
|
|
# Do not print directories as we descend into them
|
|
|
|
ifeq ($(filter --no-print-directory,$(MAKEFLAGS)),)
|
|
|
|
CT_MAKEFLAGS += --no-print-directory
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Use neither builtin rules, nor builtin variables
|
|
|
|
# Note: dual test, because if -R and -r are given on the command line
|
|
|
|
# (who knows?), MAKEFLAGS contains 'Rr' instead of '-Rr', while adding
|
|
|
|
# '-Rr' to MAKEFLAGS adds it literaly ( and does not add 'Rr' )
|
|
|
|
ifeq ($(filter Rr,$(MAKEFLAGS)),)
|
|
|
|
ifeq ($(filter -Rr,$(MAKEFLAGS)),)
|
|
|
|
CT_MAKEFLAGS += -Rr
|
|
|
|
endif # No -Rr
|
|
|
|
endif # No Rr
|
|
|
|
|
|
|
|
# Remove any suffix rules
|
|
|
|
.SUFFIXES:
|
2008-06-11 21:45:57 +00:00
|
|
|
|
2007-09-14 21:13:04 +00:00
|
|
|
all: Makefile build
|
|
|
|
|
2008-12-28 10:19:50 +00:00
|
|
|
###############################################################################
|
|
|
|
# Configuration variables
|
|
|
|
|
|
|
|
VERSION:= @@VERSION@@
|
|
|
|
BINDIR := @@BINDIR@@
|
|
|
|
LIBDIR := @@LIBDIR@@
|
|
|
|
DOCDIR := @@DOCDIR@@
|
|
|
|
MANDIR := @@MANDIR@@
|
|
|
|
DATE := @@DATE@@
|
|
|
|
LOCAL := @@LOCAL@@
|
2009-01-18 15:40:02 +00:00
|
|
|
|
|
|
|
# Paths found by ./configure
|
2009-01-25 22:58:26 +00:00
|
|
|
install:= @@install@@
|
|
|
|
bash := @@bash@@
|
|
|
|
grep := @@grep@@
|
|
|
|
make := @@make@@
|
|
|
|
sed := @@sed@@
|
2010-05-17 12:11:08 +00:00
|
|
|
libtool:= @@libtool@@
|
|
|
|
objcopy:= @@objcopy@@
|
|
|
|
objdump:= @@objdump@@
|
|
|
|
readelf:= @@readelf@@
|
|
|
|
patch := @@patch@@
|
2008-12-28 10:19:50 +00:00
|
|
|
|
2010-07-15 20:34:31 +00:00
|
|
|
###############################################################################
|
|
|
|
# Non-configure variables
|
|
|
|
MAN_SECTION := 1
|
|
|
|
MAN_SUBDIR := /man$(MAN_SECTION)
|
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
###############################################################################
|
|
|
|
# Sanity checks
|
|
|
|
|
2007-09-14 21:13:04 +00:00
|
|
|
# Check if Makefile is up to date:
|
|
|
|
Makefile: Makefile.in
|
|
|
|
@echo "$< did changed: you must re-run './configure'"
|
|
|
|
@false
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
# 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
|
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
###############################################################################
|
|
|
|
# Global make rules
|
|
|
|
|
2009-01-26 22:43:08 +00:00
|
|
|
# If any extra MAKEFLAGS were added, re-run ourselves
|
|
|
|
# See top of file for an explanation of why this is needed...
|
|
|
|
ifneq ($(strip $(CT_MAKEFLAGS)),)
|
|
|
|
|
|
|
|
MAKEFLAGS += $(CT_MAKEFLAGS)
|
|
|
|
build install clean distclean uninstall:
|
|
|
|
@$(MAKE) $@
|
|
|
|
|
|
|
|
else
|
|
|
|
# There were no additional MAKEFLAGS to add, do the job
|
|
|
|
|
2008-06-11 22:18:06 +00:00
|
|
|
TARGETS := bin lib doc man
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 22:18:06 +00:00
|
|
|
build: $(patsubst %,build-%,$(TARGETS))
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-12-16 18:12:34 +00:00
|
|
|
install: build real-install
|
2008-06-11 22:18:06 +00:00
|
|
|
|
|
|
|
clean: $(patsubst %,clean-%,$(TARGETS))
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
distclean: clean
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " RM 'Makefile'"
|
2007-07-01 19:04:20 +00:00
|
|
|
@rm -f Makefile
|
|
|
|
|
2008-11-16 22:19:57 +00:00
|
|
|
uninstall: real-uninstall
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Specific make rules
|
|
|
|
|
|
|
|
#--------------------------------------
|
|
|
|
# Build rules
|
|
|
|
|
2009-05-13 18:10:47 +00:00
|
|
|
build-bin: ct-ng scripts/crosstool-NG.sh scripts/saveSample.sh scripts/showTuple.sh
|
2009-04-20 19:57:16 +00:00
|
|
|
@chmod 755 $^
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2009-01-25 22:58:26 +00:00
|
|
|
build-lib: paths.mk
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 22:18:06 +00:00
|
|
|
build-doc:
|
|
|
|
|
2007-07-30 21:23:53 +00:00
|
|
|
build-man: docs/ct-ng.1.gz
|
|
|
|
|
|
|
|
docs/ct-ng.1.gz: docs/ct-ng.1
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " GZIP '$@'"
|
2007-08-07 17:10:07 +00:00
|
|
|
@gzip -c9 $< >$@
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-05-01 19:47:25 +00:00
|
|
|
%: %.in Makefile
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " SED '$@'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(sed) -r -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;' \
|
|
|
|
-e 's,@@CT_make@@,$(make),g;' \
|
2009-01-26 22:43:08 +00:00
|
|
|
-e 's,@@CT_bash@@,$(bash),g;' \
|
2009-01-25 22:58:26 +00:00
|
|
|
$@.in >$@
|
|
|
|
|
|
|
|
# We create a script fragment that is parseable from inside a Makefile,
|
|
|
|
# but also from inside a shell script, hence the reason why we don't
|
2009-11-17 18:01:22 +00:00
|
|
|
# use := to set variables, although that will incur a (very small)
|
2009-01-25 22:58:26 +00:00
|
|
|
# penalty from the Makefile that includes it (due to re-evaluation at
|
|
|
|
# each call).
|
|
|
|
paths.mk:
|
|
|
|
@echo " GEN '$@'"
|
|
|
|
@(echo "export install=$(install)"; \
|
|
|
|
echo "export bash=$(bash)"; \
|
|
|
|
echo "export grep=$(grep)"; \
|
|
|
|
echo "export make=$(make)"; \
|
|
|
|
echo "export sed=$(sed)"; \
|
2010-05-17 12:11:08 +00:00
|
|
|
echo "export libtool=$(libtool)"; \
|
|
|
|
echo "export objcopy=$(objcopy)"; \
|
|
|
|
echo "export objdump=$(objdump)"; \
|
|
|
|
echo "export readelf=$(readelf)"; \
|
|
|
|
echo "export patch=$(patch)"; \
|
2009-01-25 22:58:26 +00:00
|
|
|
) >paths.mk
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
#--------------------------------------
|
|
|
|
# Clean rules
|
|
|
|
|
|
|
|
clean-bin:
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " RM 'ct-ng'"
|
2007-07-01 19:04:20 +00:00
|
|
|
@rm -f ct-ng
|
2009-05-13 21:32:48 +00:00
|
|
|
@echo " RM 'scripts/crosstool-NG.sh'"
|
2009-01-27 19:53:44 +00:00
|
|
|
@rm -f scripts/crosstool-NG.sh
|
2009-05-13 21:32:48 +00:00
|
|
|
@echo " RM 'scripts/saveSample.sh'"
|
2009-02-01 17:11:46 +00:00
|
|
|
@rm -f scripts/saveSample.sh
|
2009-05-13 21:32:48 +00:00
|
|
|
@echo " RM 'scripts/showTuple.sh'"
|
2009-05-13 18:10:47 +00:00
|
|
|
@rm -f scripts/showTuple.sh
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
clean-lib:
|
2009-01-25 22:59:55 +00:00
|
|
|
@echo " RM 'paths.mk'"
|
|
|
|
@rm -f paths.mk
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
clean-doc:
|
2008-06-11 22:18:06 +00:00
|
|
|
|
|
|
|
clean-man:
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " RM 'docs/ct-ng.1'"
|
2007-08-07 17:15:27 +00:00
|
|
|
@rm -f docs/ct-ng.1
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " RM 'docs/ct-ng.1.gz'"
|
2007-08-07 17:15:27 +00:00
|
|
|
@rm -f docs/ct-ng.1.gz
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
#--------------------------------------
|
2008-06-11 21:45:57 +00:00
|
|
|
# Check for --local setup
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2009-04-20 19:57:16 +00:00
|
|
|
ifeq ($(strip $(LOCAL)),y)
|
2008-11-16 22:19:57 +00:00
|
|
|
|
2008-12-16 18:12:34 +00:00
|
|
|
real-install:
|
2009-04-20 19:57:16 +00:00
|
|
|
@true
|
2008-11-16 22:19:57 +00:00
|
|
|
|
|
|
|
real-uninstall:
|
|
|
|
@true
|
|
|
|
|
|
|
|
else
|
2007-07-22 17:44:27 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
#--------------------------------------
|
|
|
|
# Install rules
|
|
|
|
|
2010-04-01 22:18:26 +00:00
|
|
|
real-install: $(patsubst %,install-%,$(TARGETS)) install-post
|
2008-11-16 22:19:57 +00:00
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
install-bin: $(DESTDIR)$(BINDIR)
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " INST 'ct-ng'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 755 ct-ng "$(DESTDIR)$(BINDIR)/ct-ng"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 22:18:06 +00:00
|
|
|
# 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...
|
2008-11-16 21:55:46 +00:00
|
|
|
install-lib: uninstall-lib $(DESTDIR)$(LIBDIR) install-lib-main install-lib-samples
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2010-06-27 14:40:21 +00:00
|
|
|
LIB_SUB_DIR := config contrib kconfig patches scripts
|
|
|
|
$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(LIBDIR)
|
|
|
|
@echo " INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'"
|
|
|
|
@tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
|
|
|
|
|(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
|
|
|
|
|
|
|
|
# Huh? It seems we need at least one command to make this rule kick-in.
|
|
|
|
install-lib-%: install-lib-%-copy; @true
|
|
|
|
|
|
|
|
# Huh? that one does not inherit the -opy dependency, above...
|
|
|
|
install-lib-scripts: install-lib-scripts-copy
|
2009-02-01 16:17:53 +00:00
|
|
|
@chmod a+x $(DESTDIR)$(LIBDIR)/scripts/crosstool-NG.sh
|
2009-02-01 17:11:46 +00:00
|
|
|
@chmod a+x $(DESTDIR)$(LIBDIR)/scripts/saveSample.sh
|
2008-12-16 18:12:34 +00:00
|
|
|
@rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
|
2010-06-27 14:40:21 +00:00
|
|
|
|
|
|
|
install-lib-main: $(DESTDIR)$(LIBDIR) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
|
|
|
|
@echo " INST 'steps.mk'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " INST 'paths.mk'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 644 paths.mk "$(DESTDIR)$(LIBDIR)/paths.mk"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
# Samples need a little love:
|
2008-02-14 22:44:34 +00:00
|
|
|
# - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
|
2008-11-16 21:55:46 +00:00
|
|
|
install-lib-samples: $(DESTDIR)$(LIBDIR) install-lib-main
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " INSTDIR 'samples/'"
|
2009-10-10 11:12:28 +00:00
|
|
|
@tar cf - samples |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
|
2009-01-18 15:40:02 +00:00
|
|
|
@for samp_file in "$(DESTDIR)$(LIBDIR)/samples/"*"/crosstool.config"; do \
|
2009-01-25 22:58:26 +00:00
|
|
|
$(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}; \
|
2007-07-01 19:04:20 +00:00
|
|
|
done
|
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
install-doc: $(DESTDIR)$(DOCDIR)
|
2010-08-14 14:37:11 +00:00
|
|
|
@echo " INST 'docs/*.txt'"
|
|
|
|
@for doc_file in docs/*.txt; do \
|
2009-01-25 22:58:26 +00:00
|
|
|
$(install) -m 644 "$${doc_file}" "$(DESTDIR)$(DOCDIR)"; \
|
2007-07-01 19:04:20 +00:00
|
|
|
done
|
2007-07-14 10:19:01 +00:00
|
|
|
|
2010-07-15 20:34:31 +00:00
|
|
|
install-man: $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " INST 'ct-ng.1.gz'"
|
2010-07-15 20:34:31 +00:00
|
|
|
@$(install) -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2010-07-15 20:34:31 +00:00
|
|
|
$(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)):
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " MKDIR '$@/'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 755 -d "$@"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2010-04-01 22:18:26 +00:00
|
|
|
install-post:
|
|
|
|
@echo
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo "For auto-completion, do not forget to install 'ct-ng.comp' into"
|
|
|
|
@echo "your bash completion directory (usually /etc/bash_completion.d)"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
|
|
|
#--------------------------------------
|
|
|
|
# Uninstall rules
|
|
|
|
|
2008-11-16 22:19:57 +00:00
|
|
|
real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
|
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-bin:
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " RM '$(DESTDIR)$(BINDIR)/ct-ng'"
|
2008-11-16 21:55:46 +00:00
|
|
|
@rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-lib:
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " RMDIR '$(DESTDIR)$(LIBDIR)/'"
|
2008-11-16 21:55:46 +00:00
|
|
|
@rm -rf "$(DESTDIR)$(LIBDIR)"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-doc:
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " RMDIR '$(DESTDIR)$(DOCDIR)/'"
|
2008-11-16 21:55:46 +00:00
|
|
|
@rm -rf "$(DESTDIR)$(DOCDIR)"
|
2007-07-28 20:45:24 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-man:
|
2010-06-27 14:40:21 +00:00
|
|
|
@echo " RM '$(DESTDIR)$(MANDIR)/ct-ng.1.gz'"
|
2008-11-16 21:55:46 +00:00
|
|
|
@rm -f "$(DESTDIR)$(MANDIR)/ct-ng.1"{,.gz}
|
2008-11-16 22:19:57 +00:00
|
|
|
|
|
|
|
endif # Not --local
|
2009-01-26 22:43:08 +00:00
|
|
|
|
|
|
|
endif # No extra MAKEFLAGS were added
|