Makefile.in: create and install the Makefile and shell-script fragment "paths.mk", containing the paths found by ./configure
/trunk/Makefile.in | 66 39 27 0 +++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 27 deletions(-)
1 # Makefile.in for building crosstool-NG
2 # This file serves as source for the ./configure operation
4 MAKEFLAGS += --no-print-directory --no-builtin-rules
8 ###############################################################################
9 # Configuration variables
19 # Paths found by ./configure
27 ###############################################################################
30 # Check if Makefile is up to date:
32 @echo "$< did changed: you must re-run './configure'"
35 # If installing with DESTDIR, check it's an absolute path
36 ifneq ($(strip $(DESTDIR)),)
37 ifneq ($(DESTDIR),$(abspath /$(DESTDIR)))
38 $(error DESTDIR is not an absolute PATH: '$(DESTDIR)')
42 ###############################################################################
45 TARGETS := bin lib doc man
47 build: $(patsubst %,build-%,$(TARGETS))
49 install: build real-install
51 clean: $(patsubst %,clean-%,$(TARGETS))
54 @echo " RM 'Makefile'"
57 uninstall: real-uninstall
59 ###############################################################################
62 #--------------------------------------
71 build-man: docs/ct-ng.1.gz
73 docs/ct-ng.1.gz: docs/ct-ng.1
79 @$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;' \
80 -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;' \
81 -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;' \
82 -e 's,@@CT_MANDIR@@,$(MANDIR),g;' \
83 -e 's,@@CT_VERSION@@,$(VERSION),g;' \
84 -e 's,@@CT_DATE@@,$(DATE),g;' \
85 -e 's,@@CT_make@@,$(make),g;' \
88 # We create a script fragment that is parseable from inside a Makefile,
89 # but also from inside a shell script, hence the reason why we don't
90 # use := to set varaibles, although that will incur a (very small)
91 # penalty from the Makefile that includes it (due to re-evaluation at
95 @(echo "export install=$(install)"; \
96 echo "export bash=$(bash)"; \
97 echo "export grep=$(grep)"; \
98 echo "export make=$(make)"; \
99 echo "export awk=$(awk)"; \
100 echo "export sed=$(sed)"; \
103 #--------------------------------------
115 @echo " RM 'docs/ct-ng.1'"
117 @echo " RM 'docs/ct-ng.1.gz'"
118 @rm -f docs/ct-ng.1.gz
120 #--------------------------------------
121 # Check for --local setup
123 ifeq ($(strip $(LOCAL)),1)
126 @echo " CHMOD 'ct-ng'"
134 #--------------------------------------
137 real-install: $(patsubst %,install-%,$(TARGETS))
139 install-bin: $(DESTDIR)$(BINDIR)
140 @echo " INST 'ct-ng'"
141 @$(install) -m 755 ct-ng "$(DESTDIR)$(BINDIR)/ct-ng"
143 # If one is hacking crosstool-NG, the patch set might change between any two
144 # installations of the same VERSION, thus the patches must be removed prior
145 # to being installed. It is simpler to remove the whole lib/ directory, as it
146 # is the goal of the install-lib rule to install the lib/ directory...
147 install-lib: uninstall-lib $(DESTDIR)$(LIBDIR) install-lib-main install-lib-samples
149 install-lib-main: $(DESTDIR)$(LIBDIR)
150 @for src_dir in config kconfig patches scripts; do \
151 echo " INST '$${src_dir}/'"; \
152 tar cf - --exclude=.svn $${src_dir} |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -); \
154 @rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
155 @echo " INST 'steps.mk'"
156 @$(install) -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
157 @echo " INST 'paths.mk'"
158 @$(install) -m 644 paths.mk "$(DESTDIR)$(LIBDIR)/paths.mk"
160 # Samples need a little love:
161 # - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
162 install-lib-samples: $(DESTDIR)$(LIBDIR) install-lib-main
163 @echo " INST 'samples/'"
164 @tar cf - --exclude=.svn samples |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
165 @for samp_file in "$(DESTDIR)$(LIBDIR)/samples/"*"/crosstool.config"; do \
166 $(sed) -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
167 $(sed) -r -i -e 's,^(CT_WORK_DIR)=.*,\1="\$${CT_TOP_DIR}/targets",;' $${samp_file}; \
170 install-doc: $(DESTDIR)$(DOCDIR)
171 @for doc_file in docs/CREDITS docs/overview.txt; do \
172 echo " INST '$${doc_file}'"; \
173 $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(DOCDIR)"; \
176 install-man: $(DESTDIR)$(MANDIR)
177 @echo " INST 'ct-ng.1.gz'"
178 @$(install) -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)"
180 $(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)):
182 @$(install) -m 755 -d "$@"
185 #--------------------------------------
188 real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
191 @echo " RM '$(DESTDIR)$(BINDIR)/ct-ng'"
192 @rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
195 @echo " RMDIR '$(DESTDIR)$(LIBDIR)/'"
196 @rm -rf "$(DESTDIR)$(LIBDIR)"
199 @echo " RMDIR '$(DESTDIR)$(DOCDIR)/'"
200 @rm -rf "$(DESTDIR)$(DOCDIR)"
203 @echo " RM '$(DESTDIR)$(MANDIR)/ct-ng.1.gz'"
204 @rm -f "$(DESTDIR)$(MANDIR)/ct-ng.1"{,.gz}