Improve the build/configure system.

This commit is contained in:
Jonathan Moore Liles 2008-05-16 14:12:52 -05:00
parent 8af768cb90
commit 8443acf570
5 changed files with 162 additions and 16 deletions

View File

@ -1,27 +1,38 @@
prefix := /usr/local # Makefile for the Non-DAW.
# Copyright 2008 Jonathan Moore Liles
# This file is licencesd under version 2 of the GPL.
#
# Do not edit this file; run `make config` instead.
#
include scripts/colors
VERSION := 0.5.0 VERSION := 0.5.0
FLTK_LIBS := `fltk-config --use-images --ldflags` all: make.conf makedepend FL Timeline Mixer
JACK_LIBS := `pkg-config --libs jack`
SNDFILE_LIBS := `pkg-config --libs sndfile`
LASH_LIBS := `pkg-config --libs lash-1.0`
LASH_CFLAGS := `pkg-config --cflags lash-1.0` make.conf: configure
@ ./configure
CXXFLAGS := $(LASH_CFLAGS) -DINSTALL_PREFIX=\"$(prefix)\" -DVERSION=\"$(VERSION)\" -ggdb -Wextra -Wno-missing-field-initializers -O0 -fno-rtti -fno-exceptions include make.conf
all: makedepend FL Timeline Mixer ifeq (($MAINTAINER_MODE),yes)
CXXFLAGS := -ggdb -Wextra -Wno-missing-field-initializers -O0 -fno-rtti -fno-exceptions
else
CXXFLAGS := -O3 -fno-rtti -fno-exceptions -DNDEBUG
endif
CXXFLAGS += $(LASH_CFLAGS) -DINSTALL_PREFIX=\"$(prefix)\" -DVERSION=\"$(VERSION)\"
.C.o: .C.o:
@ echo -n "Compiling: "; tput bold; tput setaf 3; echo $<; tput sgr0; true @ echo -n "Compiling: "; echo $(BOLD)$(YELLOW)$<$(SGR0); true
@ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
%.C : %.fl %.C : %.fl
@ cd `dirname $<` && fluid -c ../$< @ cd `dirname $<` && fluid -c ../$<
include FL/makefile.inc include FL/makefile.inc
include Timeline/makefile.inc include Timeline/makefile.inc
include Mixer/makefile.inc include Mixer/makefile.inc
@ -35,6 +46,12 @@ makedepend: $(SRCS) Makefile
@ echo -n Checking dependencies... @ echo -n Checking dependencies...
@ makedepend -f- -- $(CXXFLAGS) -- $(SRCS) > makedepend 2>/dev/null && echo done. @ makedepend -f- -- $(CXXFLAGS) -- $(SRCS) > makedepend 2>/dev/null && echo done.
.PHONEY: clean config
clean: FL_clean Timeline_clean Mixer_clean clean: FL_clean Timeline_clean Mixer_clean
config:
@ rm -f make.conf
@ $(MAKE) -s
include makedepend include makedepend

View File

@ -19,9 +19,6 @@
#include "LASH_Client.H" #include "LASH_Client.H"
#include <lash/lash.h>
#define _client (static_cast<lash_client_t*>(_void))
#include "debug.h" #include "debug.h"
@ -35,6 +32,12 @@ LASH_Client::~LASH_Client ( )
/* TODO: anything? */ /* TODO: anything? */
} }
#ifdef USE_LASH
#include <lash/lash.h>
#define _client (static_cast<lash_client_t*>(_void))
bool bool
LASH_Client::init ( const char *jack_name, const char *long_name, int *argc, char ***argv ) LASH_Client::init ( const char *jack_name, const char *long_name, int *argc, char ***argv )
{ {
@ -97,3 +100,24 @@ LASH_Client::poll ( void )
lash_event_destroy( e ); lash_event_destroy( e );
} }
} }
#else
bool
LASH_Client::init ( const char *jack_name, const char *long_name, int *argc, char ***argv )
{
return true;
}
bool
LASH_Client::enabled ( void )
{
return false;
}
void
LASH_Client::poll ( void )
{
}
#endif

View File

@ -3,8 +3,6 @@
Timeline_VERSION := 0.5.0 Timeline_VERSION := 0.5.0
Timeline_SRCS= \ Timeline_SRCS= \
Timeline/LASH.C \
Timeline/LASH_Client.C \
Timeline/Annotation_Region.C \ Timeline/Annotation_Region.C \
Timeline/Audio_File.C \ Timeline/Audio_File.C \
Timeline/Audio_File_SF.C \ Timeline/Audio_File_SF.C \
@ -15,6 +13,8 @@ Timeline/Control_Sequence.C \
Timeline/Disk_Stream.C \ Timeline/Disk_Stream.C \
Timeline/Engine.C \ Timeline/Engine.C \
Timeline/Fl_Menu_Settings.C \ Timeline/Fl_Menu_Settings.C \
Timeline/LASH.C \
Timeline/LASH_Client.C \
Timeline/Loggable.C \ Timeline/Loggable.C \
Timeline/Peaks.C \ Timeline/Peaks.C \
Timeline/Playback_DS.C \ Timeline/Playback_DS.C \
@ -36,7 +36,7 @@ Timeline/Transport.C \
Timeline/Waveform.C \ Timeline/Waveform.C \
Timeline/dsp.C \ Timeline/dsp.C \
Timeline/main.C \ Timeline/main.C \
debug.C \ debug.C
Timeline_OBJS:=$(Timeline_SRCS:.C=.o) Timeline_OBJS:=$(Timeline_SRCS:.C=.o)

80
configure vendored Executable file
View File

@ -0,0 +1,80 @@
#!/bin/sh
#
# Copyright (C) 2008 Jonathan Moore Liles
#
. scripts/colors
fatal ()
{
echo "$BOLD$RED$*$SGR0"
exit 255
}
ask ()
{
echo -n "$1 [$BOLD$GREEN$3$SGR0] "
read R
echo "$2 := ${R:-$3}" >> make.conf
}
ok ()
{
echo "$BOLD${GREEN}ok$SGR0."
}
failed ()
{
echo "$BOLD${RED}failed!$SGR0"
}
echo "# This is a generated file. Any changes may be lost!" > make.conf
ask "Install prefix?" prefix /usr/local
ask "Use LASH?" USE_LASH yes
ask "Build for debugging?" MAINTAINER_MODE no
# tests
echo -n "Checking for ${BOLD}FLTK${SGR0}..."
FLTK_VERSION=`fltk-config --version`
FLTK_VERSION_MAJOR=`echo $FLTK_VERSION | cut -d'.' -f1`
FLTK_VERSION_MINOR=`echo $FLTK_VERSION | cut -d'.' -f2`
FLTK_VERSION_PATCH=`echo $FLTK_VERSION | cut -d'.' -f3`
if ! ( [ $FLTK_VERSION_MAJOR -ge 1 ] && [ $FLTK_VERSION_MINOR -ge 1 ] && [ $FLTK_VERSION_PATCH -ge 8 ] )
then
failed
fatal "The installed FLTK version ($FLTK_VERSION) is too old."
else
ok
fi
echo "FLTK_LIBS := `fltk-config --use-images --ldflags`" >> make.conf
#
check ()
{
echo -n "Checking for $BOLD$1$SGR0..."
if ! pkg-config --atleast-version $2 $3
then
failed
fatal "$1 not installed or too old."
fi
ok
return 0
}
check JACK 0.103.0 jack && echo "JACK_LIBS := `pkg-config --libs jack`" >> make.conf
check libSNDFILE 1.0.17 sndfile && echo "SNDFILE_LIBS := `pkg-config --libs sndfile`" >> make.conf
grep -q 'USE_LASH := yes' make.conf &&
check LASH 0.5.4 lash-1.0 &&
( echo "LASH_LIBS := `pkg-config --libs lash-1.0`" >> make.conf
echo "LASH_CFLAGS := -DUSE_LASH `pkg-config --cflags lash-1.0`" >> make.conf )
echo "-- Configuration complete."

25
scripts/colors Normal file
View File

@ -0,0 +1,25 @@
# Include this file to use terminal colors from shell scripts and
# makefiles.
# john moore liles - 12/30/2002
BLACK=`tput setaf 0`
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
BLUE=`tput setaf 4`
MAGENTA=`tput setaf 5`
CYAN=`tput setaf 6`
WHITE=`tput setaf 7`
BG_BLACK=`tput setab 0`
BG_RED=`tput setab 1`
BG_GREEN=`tput setab 2`
BG_YELLOW=`tput setab 3`
BG_BLUE=`tput setab 4`
BG_MAGENTA=`tput setab 5`
BG_CYAN=`tput setab 6`
BG_WHITE=`tput setab 7`
BOLD=`tput bold`
SGR0=`tput sgr0`