From 0643dac88a2bba5743846360e8f5af32c7cf5988 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 29 May 2008 13:35:04 -0500 Subject: [PATCH] makefile: rename make.conf to .config. Handle missing .config gracefully. --- Makefile | 20 ++++++++++---------- scripts/config-funcs | 24 ++++++++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 9f54f39..a1d46f4 100644 --- a/Makefile +++ b/Makefile @@ -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: make.conf FL Timeline +all: .config 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) diff --git a/scripts/config-funcs b/scripts/config-funcs index 77bdb04..5ff1a2c 100644 --- a/scripts/config-funcs +++ b/scripts/config-funcs @@ -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 ()