makefile: rename make.conf to .config. Handle missing .config gracefully.

This commit is contained in:
Jonathan Moore Liles 2008-05-29 13:35:04 -05:00
parent edb665ebc3
commit 0643dac88a
2 changed files with 26 additions and 18 deletions

View File

@ -9,20 +9,20 @@
VERSION := 0.5.0
# a bit of a hack to make sure this runs before any rules
ifneq ($(CALCULATING),yes)
TOTAL := $(shell $(MAKE) CALCULATING=yes -n | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files )
endif
all: .config FL Timeline
all: make.conf FL Timeline
make.conf: configure
.config: configure
@ ./configure
config:
@ ./configure
-include make.conf
-include .config
# a bit of a hack to make sure this runs before any rules
ifneq ($(CALCULATING),yes)
TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files )
endif
ifeq ($(USE_DEBUG),yes)
CXXFLAGS := -pipe -ggdb -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -O0 -fno-rtti -fno-exceptions
@ -57,12 +57,12 @@ SRCS:=$(Timeline_SRCS) $(FL_SRCS)
OBJS:=$(FL_OBJS) $(Timeline_OBJS)
# FIXME: isn't there a better way?
$(OBJS): make.conf
$(OBJS): .config
TAGS: $(SRCS)
etags $(SRCS)
.deps: make.conf $(SRCS)
.deps: .config $(SRCS)
@ echo -n Calculating dependencies...
@ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) > .deps 2>/dev/null && echo $(DONE)

View File

@ -43,7 +43,7 @@ then
if [ $# -gt 0 ]
then
echo "## options" > make.conf
echo "## options" > .config
split "$@" | sed '
s/--\(enable\|disable\)-\([^ =]\+\)/--\1-\U\2/g;
@ -51,11 +51,19 @@ s/--enable-\([^ =]\+\)=\(.*\)/USE_\1=\2/g;
s/--enable-\([^ =]\+\)/USE_\1=yes/g;
s/--disable-\([^ =]\+\)/USE_\1=no/g;
s/--\([^ =]\+\)/\1/g;
' | sed -n '/^[^ =]\+=./p' >> make.conf
' | sed -n '/^[^ =]\+=./p' >> .config
UPDATE=yes;
fi
fi
if [ $HELP != yes ] && [ $UPDATE != yes ]
then
if ! ( [ -t 0 ] && [ -t 1 ] )
then
fatal "not a terminal!"
fi
fi
ask ()
{
local A D O
@ -108,7 +116,7 @@ ok ()
failed ()
{
echo "$BOLD${RED}failed!${SGR0}" > /dev/stderr
rm -f make.conf
rm -f .config
}
using ()
@ -127,7 +135,7 @@ extract_options ()
{
local line name value
if [ -f make.conf ]
if [ -f .config ]
then
{
while read line
@ -146,7 +154,7 @@ extract_options ()
eval "$name='$value'"
fi
done
} < make.conf
} < .config
fi
}
@ -183,7 +191,7 @@ begin_options ()
echo " Available options:"
echo
else
echo > make.conf
echo > .config
append "# This file was automatically generated on `date`. Any changes may be lost!"
append "## options"
@ -210,13 +218,13 @@ begin_tests ()
append ()
{
echo "$1" >> make.conf
echo "$1" >> .config
}
end ()
{
info "Configuration complete"
touch make.conf
touch .config
}
require_command ()