Makefile: introduce PROG_NAME to contain the 'ct-ng' executable name

With the upcomming --program-{prefix,suffix,transform-name} options,
we'll have a need to centralise the actual executable name, that is
now no longer be a constant.

Rather than spread the prefix/suffix through-out the code, just
centralise the name setting in one place. Beside, transform-name
would not be possible without setting the name at a single location.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-08-19 22:53:48 +02:00
parent fd91781fbe
commit d706bf2e6b

View File

@ -66,6 +66,8 @@ KCONFIG:= @@KCONFIG@@
MAN_SECTION := 1
MAN_SUBDIR := /man$(MAN_SECTION)
PROG_NAME := ct-ng
###############################################################################
# Sanity checks
@ -126,16 +128,16 @@ uninstall: real-uninstall
#--------------------------------------
# Build rules
build-bin: ct-ng scripts/crosstool-NG.sh scripts/saveSample.sh scripts/showTuple.sh
build-bin: $(PROG_NAME) scripts/crosstool-NG.sh scripts/saveSample.sh scripts/showTuple.sh
@chmod 755 $^
build-lib: paths.mk config/configure.in
build-doc:
build-man: docs/ct-ng.1.gz
build-man: docs/$(PROG_NAME).1.gz
docs/ct-ng.1.gz: docs/ct-ng.1
docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1
@echo " GZIP '$@'"
@gzip -c9 $< >$@
@ -190,8 +192,8 @@ FORCE:
# Clean rules
clean-bin:
@echo " RM 'ct-ng'"
@rm -f ct-ng
@echo " RM '$(PROG_NAME)'"
@rm -f $(PROG_NAME)
@echo " RM 'scripts/crosstool-NG.sh'"
@rm -f scripts/crosstool-NG.sh
@echo " RM 'scripts/saveSample.sh'"
@ -208,10 +210,10 @@ 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
@echo " RM 'docs/$(PROG_NAME).1'"
@rm -f docs/$(PROG_NAME).1
@echo " RM 'docs/$(PROG_NAME).1.gz'"
@rm -f docs/$(PROG_NAME).1.gz
#--------------------------------------
# Check for --local setup
@ -232,8 +234,8 @@ else
real-install: $(patsubst %,install-%,$(TARGETS)) install-post
install-bin: $(DESTDIR)$(BINDIR)
@echo " INST 'ct-ng'"
@$(install) -m 755 ct-ng "$(DESTDIR)$(BINDIR)/ct-ng"
@echo " INST '$(PROG_NAME)'"
@$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(BINDIR)/$(PROG_NAME)"
# 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
@ -289,8 +291,8 @@ install-doc: $(DESTDIR)$(DOCDIR)
done
install-man: $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)
@echo " INST 'ct-ng.1.gz'"
@$(install) -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)"
@echo " INST '$(PROG_NAME).1.gz'"
@$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)"
$(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)):
@echo " MKDIR '$@/'"
@ -298,7 +300,7 @@ $(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(M
install-post:
@echo
@echo "For auto-completion, do not forget to install 'ct-ng.comp' into"
@echo "For auto-completion, do not forget to install '$(PROG_NAME).comp' into"
@echo "your bash completion directory (usually /etc/bash_completion.d)"
#--------------------------------------
@ -307,8 +309,8 @@ install-post:
real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
uninstall-bin:
@echo " RM '$(DESTDIR)$(BINDIR)/ct-ng'"
@rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
@echo " RM '$(DESTDIR)$(BINDIR)/$(PROG_NAME)'"
@rm -f "$(DESTDIR)$(BINDIR)/$(PROG_NAME)"
uninstall-lib:
@echo " RMDIR '$(DESTDIR)$(LIBDIR)/'"
@ -319,8 +321,8 @@ uninstall-doc:
@rm -rf "$(DESTDIR)$(DOCDIR)"
uninstall-man:
@echo " RM '$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/ct-ng.1.gz'"
@rm -f "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/ct-ng.1"{,.gz}
@echo " RM '$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'"
@rm -f "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz}
endif # Not --local