Update : adding --enable / --disable option for configure Makefile.cfg
This commit is contained in:
parent
627c2f9532
commit
b8d53c1590
4
Makefile
4
Makefile
|
@ -114,7 +114,7 @@ endif
|
|||
# Binaries-specific targets #
|
||||
#******************************************************************************#
|
||||
# Make the binaries.
|
||||
all-bins: $(CHECKCFG) $(DEFAULT_BINARIES:%=all-%)
|
||||
all-bins: $(CHECKCFG) $(BINARIES:%=all-%)
|
||||
|
||||
# Make a binary object directory.
|
||||
$(BINARIES:%=$(OBJDIR)/%):
|
||||
|
@ -190,7 +190,7 @@ $(foreach bin,$(BINARIES),\
|
|||
$(eval $(call make-installbinary-rule,$(bin))))
|
||||
|
||||
# Install binaries
|
||||
install-bins: $(DEFAULT_BINARIES:%=install-%)
|
||||
install-bins: $(BINARIES:%=install-%)
|
||||
|
||||
# Uninstall binaries
|
||||
uninstall-bins: $(BINARIES:%=uninstall-%)
|
||||
|
|
|
@ -95,9 +95,6 @@ endif
|
|||
#******************************************************************************#
|
||||
# Binaries and sources #
|
||||
#******************************************************************************#
|
||||
# Look for binaries
|
||||
BINARIES := $(notdir $(shell find $(SRCDIR) -mindepth 1 -maxdepth 1 \
|
||||
-type d | sort))
|
||||
|
||||
# Get their libs
|
||||
define get-binary-libs
|
||||
|
@ -108,10 +105,6 @@ endef
|
|||
$(foreach bin,$(BINARIES), \
|
||||
$(eval $(call get-binary-libs,$(bin))))
|
||||
|
||||
# Get the default binaries
|
||||
DEFAULT_BINARIES := $(foreach bin,$(BINARIES), \
|
||||
$(if $(DISABLE_$(bin)),,$(bin)))
|
||||
|
||||
# Look for their sources
|
||||
define get-binary-sources
|
||||
SRC_$1 := $(basename $(shell find $(SRCDIR)/$1 \
|
||||
|
|
|
@ -17,6 +17,10 @@ target=
|
|||
windows=
|
||||
default_zoom=8
|
||||
default_storage=fls0
|
||||
BUILD_p7=1
|
||||
BUILD_p7screen=1
|
||||
BUILD_p7os=0
|
||||
BUILD_mcsfile=0
|
||||
|
||||
# Installation directories
|
||||
root=''
|
||||
|
@ -27,6 +31,20 @@ mandir='${prefix}/share/man'
|
|||
# Installation options
|
||||
install_manpages=yes
|
||||
|
||||
#
|
||||
# Tool name checking
|
||||
#
|
||||
check()
|
||||
{
|
||||
if [ $1 = "p7" ] ||
|
||||
[ $1 = "p7screen" ] ||
|
||||
[ $1 = "p7os" ] ||
|
||||
[ $1 = "mcsfile" ]; then
|
||||
return 1 # true if there is a tool
|
||||
fi
|
||||
return 0 # false if not a tool
|
||||
}
|
||||
|
||||
#******************************************************************************#
|
||||
# Help message #
|
||||
#******************************************************************************#
|
||||
|
@ -47,6 +65,14 @@ Build options:
|
|||
--target=TARGET the build target [$target]
|
||||
--default-zoom=ZOOM the default zoom for \`p7screen\` [$default_zoom]
|
||||
--default-storage=STOR the default storage device [$default_storage]
|
||||
--enable-<tool> build and install the selected tool
|
||||
--disable-<tool> do not build or install the selected tool
|
||||
|
||||
Tools:
|
||||
p7 enabled (default)
|
||||
p7screen enabled (default)
|
||||
p7os disabled (default)
|
||||
mcsfile disabled (default)
|
||||
|
||||
Installation options:
|
||||
--noinstall-manpages do not install manpages
|
||||
|
@ -121,6 +147,22 @@ for arg ; do case "$arg" in
|
|||
--prefix=*) prefix="${arg#*=}" ;;
|
||||
--bindir=*) bindir="${arg#*=}" ;;
|
||||
--mandir=*) mandir="${arg#*=}" ;;
|
||||
--enable-*)
|
||||
tool="${arg#--enable-}"
|
||||
if check $tool; then
|
||||
echo "error: connot enable $tool: unknown tool"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval BUILD_$tool=1;;
|
||||
--disable-*)
|
||||
tool="${arg#--disable-}"
|
||||
if check $tool; then
|
||||
echo "error: connot disable $tool: unknown tool"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval BUILD_$tool=0;;
|
||||
*) echo "$arg: didn't read" ;;
|
||||
esac; done
|
||||
|
||||
|
@ -152,34 +194,54 @@ done
|
|||
# Clean before.
|
||||
make mrproper MAKE_FULL_LOG=y 1>/dev/null 2>/dev/null
|
||||
|
||||
# Do it!
|
||||
exec 3>&1 1>Makefile.cfg
|
||||
cat <<EOF
|
||||
# gen makefile function
|
||||
gen()
|
||||
{
|
||||
echo "
|
||||
#!/usr/bin/make -f
|
||||
#******************************************************************************#
|
||||
# Makefile configuration generated by ./configure #
|
||||
#******************************************************************************#
|
||||
# Configuration version and messages configuration
|
||||
CONFIG_VERSION := $version
|
||||
MAKE_FULL_LOG := $make_full_log
|
||||
MORE_WARNINGS := $more_warnings
|
||||
CONFIG_VERSION := $version
|
||||
MAKE_FULL_LOG := $make_full_log
|
||||
MORE_WARNINGS := $more_warnings
|
||||
"
|
||||
|
||||
echo -n "BINARIES :="
|
||||
|
||||
if [ $BUILD_p7 = 1 ]; then
|
||||
echo -n " p7"
|
||||
fi
|
||||
if [ $BUILD_p7screen = 1 ]; then
|
||||
echo -n " p7screen"
|
||||
fi
|
||||
if [ $BUILD_p7os = 1 ]; then
|
||||
echo -n " p7os"
|
||||
fi
|
||||
if [ $BUILD_mcsfile = 1 ]; then
|
||||
echo -n " mcsfile"
|
||||
fi
|
||||
|
||||
echo "
|
||||
# Build options
|
||||
TARGET := $target
|
||||
FOR_WINDOWS := $windows
|
||||
DEFAULT_ZOOM := $default_zoom
|
||||
DEFAULT_STORAGE := $default_storage
|
||||
TARGET := $target
|
||||
FOR_WINDOWS := $windows
|
||||
DEFAULT_ZOOM := $default_zoom
|
||||
DEFAULT_STORAGE := $default_storage
|
||||
|
||||
# Installation directories
|
||||
IBINDIR := $bindir
|
||||
IMANDIR := $mandir
|
||||
IBINDIR := $bindir
|
||||
IMANDIR := $mandir
|
||||
|
||||
# Installation options
|
||||
INSTALL_MANPAGES := $install_manpages
|
||||
INSTALL_MANPAGES := $install_manpages
|
||||
|
||||
# End of file.
|
||||
EOF
|
||||
exec 1>&3 3>&-
|
||||
"
|
||||
}
|
||||
|
||||
gen | tee Makefile.cfg
|
||||
chmod +x Makefile.cfg
|
||||
|
||||
#******************************************************************************#
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/make -f
|
||||
disable:
|
||||
libs:
|
||||
@echo libg1m
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/make -f
|
||||
disable:
|
||||
libs:
|
||||
@echo libp7
|
||||
|
|
Loading…
Reference in New Issue