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@@
|
|
|
|
awk := @@awk@@
|
|
|
|
sed := @@sed@@
|
2008-12-28 10:19:50 +00:00
|
|
|
|
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-01-26 22:43:08 +00:00
|
|
|
build-bin: ct-ng scripts/crosstool-NG.sh
|
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
|
|
|
|
# use := to set varaibles, although that will incur a (very small)
|
|
|
|
# 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 awk=$(awk)"; \
|
|
|
|
echo "export sed=$(sed)"; \
|
|
|
|
) >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
|
|
|
|
|
|
|
|
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
|
|
|
|
2008-11-16 22:19:57 +00:00
|
|
|
ifeq ($(strip $(LOCAL)),1)
|
|
|
|
|
2008-12-16 18:12:34 +00:00
|
|
|
real-install:
|
2008-11-16 22:19:57 +00:00
|
|
|
@echo " CHMOD 'ct-ng'"
|
|
|
|
@chmod a+x ct-ng
|
2009-01-26 22:43:08 +00:00
|
|
|
@echo " CHMOD 'scripts/crosstool-NG.sh'"
|
|
|
|
@chmod a+x scripts/crosstool-NG.sh
|
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
|
|
|
|
|
2008-12-16 18:12:34 +00:00
|
|
|
real-install: $(patsubst %,install-%,$(TARGETS))
|
2008-11-16 22:19:57 +00:00
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
install-bin: $(DESTDIR)$(BINDIR)
|
2008-06-11 21:45:57 +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
|
|
|
|
2008-11-16 22:19:57 +00:00
|
|
|
install-lib-main: $(DESTDIR)$(LIBDIR)
|
2008-12-16 18:12:34 +00:00
|
|
|
@for src_dir in config kconfig patches scripts; do \
|
2008-11-16 21:55:46 +00:00
|
|
|
echo " INST '$${src_dir}/'"; \
|
|
|
|
tar cf - --exclude=.svn $${src_dir} |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -); \
|
2007-07-01 19:04:20 +00:00
|
|
|
done
|
2008-12-16 18:12:34 +00:00
|
|
|
@rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " INST 'steps.mk'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
|
|
|
|
@echo " INST 'paths.mk'"
|
|
|
|
@$(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
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " INST 'samples/'"
|
2008-11-16 21:55:46 +00:00
|
|
|
@tar cf - --exclude=.svn 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)
|
2009-01-18 15:40:02 +00:00
|
|
|
@for doc_file in docs/CREDITS docs/overview.txt; do \
|
|
|
|
echo " INST '$${doc_file}'"; \
|
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
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
install-man: $(DESTDIR)$(MANDIR)
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " INST 'ct-ng.1.gz'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-11-16 21:55:46 +00:00
|
|
|
$(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)):
|
2008-06-11 21:45:57 +00:00
|
|
|
@echo " MKDIR '$@'"
|
2009-01-25 22:58:26 +00:00
|
|
|
@$(install) -m 755 -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:
|
2008-11-16 21:55:46 +00:00
|
|
|
@echo " RM '$(DESTDIR)$(BINDIR)/ct-ng'"
|
|
|
|
@rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-lib:
|
2008-11-16 21:55:46 +00:00
|
|
|
@echo " RMDIR '$(DESTDIR)$(LIBDIR)/'"
|
|
|
|
@rm -rf "$(DESTDIR)$(LIBDIR)"
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-doc:
|
2008-11-16 21:55:46 +00:00
|
|
|
@echo " RMDIR '$(DESTDIR)$(DOCDIR)/'"
|
|
|
|
@rm -rf "$(DESTDIR)$(DOCDIR)"
|
2007-07-28 20:45:24 +00:00
|
|
|
|
2008-06-11 21:45:57 +00:00
|
|
|
uninstall-man:
|
2008-11-16 21:55:46 +00:00
|
|
|
@echo " RM '$(DESTDIR)$(MANDIR)/ct-ng.1.gz'"
|
|
|
|
@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
|