Permalink
Browse files

Made Makefile more configurable.

Moved user configurable vars to Makefile.conf.template. User can
overwrite configuration variables by setting them in Makefile.conf.
Added printconf target to show build config.
Setting defaults based on current platform (uname -s).
Checking if command can be executed using 'command -v X'. "test -x CMD"
checks only whether a filepath is executable, but doesn't work for
simple commands.

Conflicts:
	Makefile
  • Loading branch information...
1 parent 69a25b3 commit f6cf0b4f8b30772eccc36c792862f43e74e6be5e @pwojnowski pwojnowski committed Nov 8, 2013
Showing with 139 additions and 95 deletions.
  1. +1 −0 .gitignore
  2. +60 −95 Makefile
  3. +78 −0 Makefile.conf.template
View
@@ -4,3 +4,4 @@
/html-help/
/info-help/
/ecb-autoloads.el
+Makefile.conf
View
@@ -25,100 +25,45 @@
# $Id$
+SHELL = /bin/bash
-# ========================================================================
-# User configurable section
-
-# ------------------------------------------------------------------------
-# Byte-compiling ECB:
-# ------------------------------------------------------------------------
-
-# Define here the correct path to your Emacs or XEmacs binary. Ensure you
-# have set this variable to 'xemacs' if you want byte-compile with XEmacs!
-EMACS=emacs
-
-# In the following path-settings of this section use always FORWARD-SLASHES
-# as directory-separator even with MS Windows systems.
-
-# -------- Compiling ECB with the cedet-library ----------------------
-
-# cedet >= 1.0pre6 (contains a.o. semantic >= 2.0, eieio >= 0.18 and
-# speedbar >= 0.15).
#
-# + If you use Emacs >= 23.2 and you want to use the integrated CEDET:
-# Set this to empty (CEDET=)
+# Override vars in Makefile.conf if needed
#
-# + If you use Emacs < 23.2 or if you want to use the author version of CEDET:
-# Set this to the full path of your CEDET-installation.
-
-CEDET=
-#CEDET=~/projects/cedet-bzr
-
-# You can set here more load-paths to arbitrary packages if you want. But
-# this is really not necessary!
-LOADPATH=
-
-# Two ways to build ECB:
-# - Call "make" to byte-compile the ECB. You can savely ignore the messages.
-# - Or call
-#
-# make [EMACS="path/to/emacs"] [CEDET="path/to/cedet" or empty]
-#
-# if you want to set either different load-paths or Emacs-binary and
-# you do not want edit the Makefile. Do not forget quoting the arguments
-# if they contain spaces!
-#
-# If there are any warning messages during byte-compilation (normally there
-# are not any) you can savely ignore them!
-
-
-# ------------------------------------------------------------------------
-# Generating different online-help formats
-# ------------------------------------------------------------------------
-
-# If you want to generate all formats of online-help from the texi-source
-# you must set here the FULL paths to the required tools. The Makefile
-# tests if the tools are available on these locations, so if a tool x is
-# not available let the related setting X empty! NOTE: For generating the
-# PDF-format you will need an installed TeX and Ghostscript!
-MAKEINFO=/usr/bin/makeinfo
-TEXI2DVI=/C/Programme/texmf/miktex/bin/texi2dvi
-# You need either the dvipdfm-tool
-#DVIPDFM=/C/Programme/texmf/miktex/bin/dvipdfm
-DVIPDFM=
-# or the tools dvips and ps2pdf. If dvipdfm is available the Makefile uses
-# this one!
-DVIPS=/C/Programme/texmf/miktex/bin/dvips
-PS2PDF=/C/home/bin/ps2pdf
-
-# To generate the online-formats just call "make online-help" for info- and
-# HTML-format and "make pdf" for PDF-format.
-
-# ------------------------------------------------------------------------
-# Installing the info online-help in the Top-directory of (X)Emacs-info
-# ------------------------------------------------------------------------
-
-# Set here the path of the info subdirectory of your (X)Emacs installation
-# which contains the dir file.
-EMACSINFOPATH=/C/Programme/emacs-22.3/info
-
-# If you want to install the info-format of the online-help in the
-# Top-directory of the info-directory of (X)Emacs (see above EMACSINFOPATH)
-# then you must specify the full path of the tool install-info.
-INSTALLINFO=/usr/bin/install-info
-
-# To install the online-help just call "make install-help"
-
-# end of user configurable section
-# ========================================================================
-
-
-# ========================================================================
-# !!!!!!!!!!!!!!!!!!!!! Do not change anything below !!!!!!!!!!!!!!!!!!!!!
-# ========================================================================
-
-
-# $Id$
+-include Makefile.conf
+
+# When run inside Emacs, the variable contains 't', so correct it
+ifeq ($(origin EMACS),environment)
+ EMACS = emacs
+endif
+
+PLATFORM=$(shell uname -s)
+
+ifeq ($(PLATFORM),Linux)
+ EMACS ?= emacs
+ CEDET ?=
+ LOADPATH ?=
+ MAKEINFO = makeinfo
+ TEXI2PDF ?= texi2pdf
+ TEXI2DVI ?= texi2dvi
+ DVIPDFM ?= dvipdf
+ DVIPS ?= dvips
+ PS2PDF ?= ps2pdf
+ EMACSINFOPATH ?=
+ INSTALLINFO ?= install-info
+else #TODO add defaults for other platforms
+ EMACS ?= emacs
+ CEDET ?= c:/Programme/emacs-23.1/site-lisp/package-development/cedet
+ LOADPATH ?=
+ MAKEINFO ?= /usr/bin/makeinfo
+ TEXI2PDF ?= /C/Programme/texmf/miktex/bin/texi2pdf
+ TEXI2DVI ?= /C/Programme/texmf/miktex/bin/texi2dvi
+ DVIPDFM ?= /C/Programme/texmf/miktex/bin/dvipdfm
+ DVIPS ?= /C/Programme/texmf/miktex/bin/dvips
+ PS2PDF ?= /C/home/bin/ps2pdf
+ EMACSINFOPATH ?= /C/Programme/emacs-22.3/info
+ INSTALLINFO ?= /usr/bin/install-info
+endif
# For the ECB-maintainers: Change the version-number here and not
# elsewhere!
@@ -153,7 +98,7 @@ ecb: $(ecb_LISP_EL)
@$(RM) ecb-compile-script
online-help: $(ecb_TEXI)
- @if test -x "$(MAKEINFO)"; then\
+ @if command -v "$(MAKEINFO)" >/dev/null 2>&1 ; then\
$(RM) -R $(ecb_INFO_DIR) $(ecb_HTML_DIR); \
$(MKDIR) $(ecb_INFO_DIR) $(ecb_HTML_DIR); \
echo Generating info-format...; \
@@ -174,13 +119,17 @@ online-help: $(ecb_TEXI)
fi
pdf: $(ecb_TEXI)
- @if test -x "$(TEXI2DVI)" -a -x "$(DVIPDFM)"; then\
+ @if command -v "$(TEXI2PDF)" >/dev/null 2>&1; then\
+ $(RM) $(ecb_PDF); \
+ echo Generating pdf-format with texi2pdf ...; \
+ $(TEXI2PDF) --clean $<; \
+ elif command -v "$(TEXI2DVI)" >/dev/null 2>&1 -a command -v "$(DVIPDFM)" >/dev/null 2>&1; then\
$(RM) $(ecb_DVI) $(ecb_PDF); \
echo Generating pdf-format with dvipdfm ...; \
$(TEXI2DVI) --clean $<; \
$(DVIPDFM) $(ecb_DVI); \
$(RM) $(ecb_DVI); \
- elif test -x "$(TEXI2DVI)" -a -x "$(DVIPS)" -a -x "$(PS2PDF)"; then\
+ elif command -v "$(TEXI2DVI)" >/dev/null 2>&1 -a command -v "$(DVIPS)" >/dev/null 2>&1 -a command -v "$(PS2PDF)" >/dev/null 2>&1; then\
$(RM) $(ecb_DVI) $(ecb_PS) $(ecb_PDF); \
echo Generating pdf-format with dvips and ps2pdf ...; \
$(TEXI2DVI) --quiet --clean $<; \
@@ -189,6 +138,7 @@ pdf: $(ecb_TEXI)
$(RM) $(ecb_DVI) $(ecb_PS); \
else \
echo No pdf-format generating because at least one of the tools; \
+ echo - texi2pdf in $(TEXI2PDF); \
echo - texi2dvi in $(TEXI2DVI); \
echo - dvips in $(DVIPS); \
echo - ps2pdf in $(PS2PDF); \
@@ -197,7 +147,7 @@ pdf: $(ecb_TEXI)
install-help: $(ecb_INFO_DIR)/$(ecb_INFO)
- @if test -x "$(INSTALLINFO)" -a -f "$(EMACSINFOPATH)/dir"; then\
+ @if command -v "$(INSTALLINFO)" >/dev/null 2>&1 -a -f "$(EMACSINFOPATH)/dir"; then\
echo Installing the Online-help in $(EMACSINFOPATH)...; \
$(CP) $(ecb_INFO_DIR)/*info* $(EMACSINFOPATH); \
$(INSTALLINFO) $< $(EMACSINFOPATH)/dir; \
@@ -258,4 +208,19 @@ distrib: $(ecb_INFO_DIR)/$(ecb_INFO) prepversion autoloads ecb
@tar -cvzf ecb-$(ecb_VERSION).tar.gz ecb-$(ecb_VERSION)
@$(RM) -R ecb-$(ecb_VERSION)
+printconf:
+ @echo Platform: $(PLATFORM)
+ @echo ECB version: $(ecb_VERSION)
+ @echo Emacs: $(EMACS)
+ @if test -n "${CEDET}"; then echo "CEDET: ${CEDET}"; else echo "CEDET: Emacs-builtin"; fi
+ @echo Load path: $(LOADPATH)
+ @echo Emacs info path: $(EMACSINFOPATH)
+ @echo command -v "${INSTALLINFO}" >/dev/null 2>&1 && echo "install-info: ${INSTALLINFO}" || echo "install-info: cannot execute ${INSTALLINFO}"
+ @echo command -v "${MAKEINFO}" >/dev/null 2>&1 && echo "makeinfo: ${MAKEINFO}" || echo "makeinfo: cannot execute ${MAKEINFO}"
+ @echo command -v "${TEXI2PDF}" >/dev/null 2>&1 && echo "texi2pdf: ${TEXI2PDF}" || echo "texi2pdf: cannot execute ${TEXI2PDF}"
+ @echo command -v "${TEXI2DVI}" >/dev/null 2>&1 && echo "texi2dvi: ${TEXI2DVI}" || echo "texi2dvi: cannot execute ${TEXI2DVI}"
+ @echo command -v "${DVIPDFM}" >/dev/null 2>&1 && echo "dvipdfm: ${DVIPDFM}" || echo "dvipdfm: cannot execute ${DVIPDFM}"
+ @echo command -v "${DVIPS}" >/dev/null 2>&1 && echo "dvips: ${DVIPS}" || echo "dvips: cannot execute ${DVIPS}"
+ @echo command -v "${PS2PDF}" >/dev/null 2>&1 && echo "ps2pdf: ${PS2PDF}" || echo "ps2pdf: cannot execute ${PS2PDF}"
+
# End of Makefile
@@ -0,0 +1,78 @@
+#
+# Use 'make printconf' to print configuration variables.
+#
+
+# Define here the correct path to your Emacs or XEmacs binary. Ensure you
+# have set this variable to 'xemacs' if you want byte-compile with XEmacs!
+#EMACS =
+
+# In the following path-settings of this section use always FORWARD-SLASHES
+# as directory-separator even with MS Windows systems.
+
+# -------- Compiling ECB with the cedet-library ----------------------
+
+# cedet >= 1.0pre6 (contains a.o. semantic >= 2.0, eieio >= 0.18 and
+# speedbar >= 0.15).
+#
+# + If you use Emacs >= 23.2 and you want to use the integrated CEDET:
+# Set this to empty (CEDET=)
+#
+# + If you use Emacs < 23.2 or if you want to use the author version of CEDET:
+# Set this to the full path of your CEDET-installation.
+#CEDET =
+
+# You can set here more load-paths to arbitrary packages if you want. But
+# this is really not necessary!
+#LOADPATH =
+
+# Two ways to build ECB:
+# - Call "make" to byte-compile the ECB. You can savely ignore the messages.
+# - Or call
+#
+# make [EMACS="path/to/emacs"] [CEDET="path/to/cedet" or empty]
+#
+# if you want to set either different load-paths or Emacs-binary and
+# you do not want edit the Makefile. Do not forget quoting the arguments
+# if they contain spaces!
+#
+# If there are any warning messages during byte-compilation (normally there
+# are not any) you can savely ignore them!
+
+
+# ------------------------------------------------------------------------
+# Generating different online-help formats
+# ------------------------------------------------------------------------
+
+# If you want to generate all formats of online-help from the texi-source
+# you must set here the FULL paths to the required tools. The Makefile
+# tests if the tools are available on these locations, so if a tool x is
+# not available let the related setting X empty! NOTE: For generating the
+# PDF-format you will need an installed TeX and Ghostscript!
+#MAKEINFO =
+#TEXI2DVI =
+
+# You need either the dvipdfm-tool
+#DVIPDFM =
+
+# or the tools dvips and ps2pdf. If dvipdfm is available the Makefile uses
+# this one!
+#DVIPS =
+#PS2PDF =
+
+# To generate the online-formats just call "make online-help" for info- and
+# HTML-format and "make pdf" for PDF-format.
+
+# ------------------------------------------------------------------------
+# Installing the info online-help in the Top-directory of (X)Emacs-info
+# ------------------------------------------------------------------------
+
+# Set here the path of the info subdirectory of your (X)Emacs installation
+# which contains the dir file.
+#EMACSINFOPATH =
+
+# If you want to install the info-format of the online-help in the
+# Top-directory of the info-directory of (X)Emacs (see above EMACSINFOPATH)
+# then you must specify the full path of the tool install-info.
+#INSTALLINFO =
+
+# To install the online-help just call "make install-help"

0 comments on commit f6cf0b4

Please sign in to comment.