makefile: rename make.conf to .config. Handle missing .config gracefully.
This commit is contained in:
parent
edb665ebc3
commit
0643dac88a
20
Makefile
20
Makefile
|
@ -9,20 +9,20 @@
|
||||||
|
|
||||||
VERSION := 0.5.0
|
VERSION := 0.5.0
|
||||||
|
|
||||||
# a bit of a hack to make sure this runs before any rules
|
all: .config FL Timeline
|
||||||
ifneq ($(CALCULATING),yes)
|
|
||||||
TOTAL := $(shell $(MAKE) CALCULATING=yes -n | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files )
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: make.conf FL Timeline
|
.config: configure
|
||||||
|
|
||||||
make.conf: configure
|
|
||||||
@ ./configure
|
@ ./configure
|
||||||
|
|
||||||
config:
|
config:
|
||||||
@ ./configure
|
@ ./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)
|
ifeq ($(USE_DEBUG),yes)
|
||||||
CXXFLAGS := -pipe -ggdb -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -O0 -fno-rtti -fno-exceptions
|
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)
|
OBJS:=$(FL_OBJS) $(Timeline_OBJS)
|
||||||
|
|
||||||
# FIXME: isn't there a better way?
|
# FIXME: isn't there a better way?
|
||||||
$(OBJS): make.conf
|
$(OBJS): .config
|
||||||
|
|
||||||
TAGS: $(SRCS)
|
TAGS: $(SRCS)
|
||||||
etags $(SRCS)
|
etags $(SRCS)
|
||||||
|
|
||||||
.deps: make.conf $(SRCS)
|
.deps: .config $(SRCS)
|
||||||
@ echo -n Calculating dependencies...
|
@ echo -n Calculating dependencies...
|
||||||
@ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) > .deps 2>/dev/null && echo $(DONE)
|
@ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) > .deps 2>/dev/null && echo $(DONE)
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ then
|
||||||
|
|
||||||
if [ $# -gt 0 ]
|
if [ $# -gt 0 ]
|
||||||
then
|
then
|
||||||
echo "## options" > make.conf
|
echo "## options" > .config
|
||||||
|
|
||||||
split "$@" | sed '
|
split "$@" | sed '
|
||||||
s/--\(enable\|disable\)-\([^ =]\+\)/--\1-\U\2/g;
|
s/--\(enable\|disable\)-\([^ =]\+\)/--\1-\U\2/g;
|
||||||
|
@ -51,11 +51,19 @@ s/--enable-\([^ =]\+\)=\(.*\)/USE_\1=\2/g;
|
||||||
s/--enable-\([^ =]\+\)/USE_\1=yes/g;
|
s/--enable-\([^ =]\+\)/USE_\1=yes/g;
|
||||||
s/--disable-\([^ =]\+\)/USE_\1=no/g;
|
s/--disable-\([^ =]\+\)/USE_\1=no/g;
|
||||||
s/--\([^ =]\+\)/\1/g;
|
s/--\([^ =]\+\)/\1/g;
|
||||||
' | sed -n '/^[^ =]\+=./p' >> make.conf
|
' | sed -n '/^[^ =]\+=./p' >> .config
|
||||||
UPDATE=yes;
|
UPDATE=yes;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $HELP != yes ] && [ $UPDATE != yes ]
|
||||||
|
then
|
||||||
|
if ! ( [ -t 0 ] && [ -t 1 ] )
|
||||||
|
then
|
||||||
|
fatal "not a terminal!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ask ()
|
ask ()
|
||||||
{
|
{
|
||||||
local A D O
|
local A D O
|
||||||
|
@ -108,7 +116,7 @@ ok ()
|
||||||
failed ()
|
failed ()
|
||||||
{
|
{
|
||||||
echo "$BOLD${RED}failed!${SGR0}" > /dev/stderr
|
echo "$BOLD${RED}failed!${SGR0}" > /dev/stderr
|
||||||
rm -f make.conf
|
rm -f .config
|
||||||
}
|
}
|
||||||
|
|
||||||
using ()
|
using ()
|
||||||
|
@ -127,7 +135,7 @@ extract_options ()
|
||||||
{
|
{
|
||||||
local line name value
|
local line name value
|
||||||
|
|
||||||
if [ -f make.conf ]
|
if [ -f .config ]
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
while read line
|
while read line
|
||||||
|
@ -146,7 +154,7 @@ extract_options ()
|
||||||
eval "$name='$value'"
|
eval "$name='$value'"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
} < make.conf
|
} < .config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +191,7 @@ begin_options ()
|
||||||
echo " Available options:"
|
echo " Available options:"
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
echo > make.conf
|
echo > .config
|
||||||
append "# This file was automatically generated on `date`. Any changes may be lost!"
|
append "# This file was automatically generated on `date`. Any changes may be lost!"
|
||||||
append "## options"
|
append "## options"
|
||||||
|
|
||||||
|
@ -210,13 +218,13 @@ begin_tests ()
|
||||||
|
|
||||||
append ()
|
append ()
|
||||||
{
|
{
|
||||||
echo "$1" >> make.conf
|
echo "$1" >> .config
|
||||||
}
|
}
|
||||||
|
|
||||||
end ()
|
end ()
|
||||||
{
|
{
|
||||||
info "Configuration complete"
|
info "Configuration complete"
|
||||||
touch make.conf
|
touch .config
|
||||||
}
|
}
|
||||||
|
|
||||||
require_command ()
|
require_command ()
|
||||||
|
|
Loading…
Reference in New Issue