Bring build system improvements over from Non-DAW.
This commit is contained in:
parent
257aeb116d
commit
e78b3f14e7
65
Makefile
65
Makefile
|
@ -3,31 +3,38 @@
|
|||
# Copyright 2007-2008 Jonathan Moore Liles
|
||||
# This file is licencesd under version 2 of the GPL.
|
||||
|
||||
# config
|
||||
prefix=/usr/local/
|
||||
VERSION := 1.9.1
|
||||
|
||||
all: make.conf non
|
||||
|
||||
make.conf: configure
|
||||
@ ./configure
|
||||
|
||||
config:
|
||||
@ ./configure
|
||||
|
||||
-include make.conf
|
||||
|
||||
SYSTEM_PATH=$(prefix)/share/non-sequencer/
|
||||
DOCUMENT_PATH=$(prefix)/share/doc/non-sequencer/
|
||||
USE_LASH=1
|
||||
|
||||
VERSION=1.9.1
|
||||
|
||||
# Debugging
|
||||
CFLAGS:=-O0 -ggdb -fno-omit-frame-pointer -Wall
|
||||
# Production
|
||||
# CFLAGS:=-O3 -fomit-frame-pointer -DNDEBUG
|
||||
ifeq ($(USE_DEBUG),yes)
|
||||
CXXFLAGS := -pipe -ggdb -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -O0 -fno-rtti -fno-exceptions
|
||||
else
|
||||
CXXFLAGS := -pipe -O3 -fno-rtti -fno-exceptions -DNDEBUG
|
||||
endif
|
||||
|
||||
CFLAGS+=-DVERSION=\"$(VERSION)\" \
|
||||
-DINSTALL_PREFIX=\"$(prefix)\" \
|
||||
-DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \
|
||||
-DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\"
|
||||
|
||||
CXXFLAGS:=$(CFLAGS) -fno-exceptions -fno-rtti `fltk-config --cxxflags` `pkg-config jack --atleast-version 0.105 || echo -DJACK_MIDI_PROTO_API` `pkg-config jack --cflags` `pkg-config --cflags sigc++-2.0`
|
||||
LIBS=`pkg-config --libs jack` `fltk-config --use-images --ldflags` `pkg-config --libs sigc++-2.0`
|
||||
CXXFLAGS:=$(CFLAGS) $(CXXFLAGS) $(FLTK_CFLAGS) $(sigcpp_CFLAGS) $(LASH_CFLAGS)
|
||||
|
||||
ifeq ($(USE_LASH),1)
|
||||
LIBS+=-llash
|
||||
CXXFLAGS+=-DUSE_LASH `pkg-config --cflags lash-1.0`
|
||||
LIBS:=$(FLTK_LIBS) $(JACK_LIBS) $(LASH_LIBS) $(sigcpp_LIBS)
|
||||
|
||||
ifeq ($(JACK_MIDI_PROTO_API),yes)
|
||||
CXXFLAGS+=-DJACK_MIDI_PROTO_API
|
||||
endif
|
||||
|
||||
# uncomment this line to print each playback event to the console (not RT safe)
|
||||
|
@ -59,31 +66,33 @@ SRCS= \
|
|||
|
||||
OBJS=$(SRCS:.C=.o)
|
||||
|
||||
.PHONEY: all clean install dist valgrind
|
||||
|
||||
all: non makedepend
|
||||
.PHONEY: all clean install dist valgrind config
|
||||
|
||||
clean:
|
||||
rm -f non makedepend $(OBJS)
|
||||
@ echo Done
|
||||
@ echo "$(DONE)"
|
||||
|
||||
valgrind:
|
||||
valgrind ./non
|
||||
|
||||
include scripts/colors
|
||||
|
||||
.C.o:
|
||||
@ echo -n "Compiling: "; tput bold; tput setaf 3; echo $<; tput sgr0; true
|
||||
@ echo "Compiling: $(BOLD)$(YELLOW)$<$(SGR0)"
|
||||
@ $(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
%.C : %.fl
|
||||
@ cd gui && fluid -c ../$<
|
||||
@ cd `dirname $<` && fluid -c ../$<
|
||||
|
||||
$(OBJS): Makefile
|
||||
$(OBJS): make.conf
|
||||
|
||||
DONE:=$(BOLD)$(GREEN)done$(SGR0)
|
||||
|
||||
non: $(OBJS)
|
||||
@ echo -n "Linking..."
|
||||
@ rm -f $@
|
||||
@ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ || (tput bold; tput setaf 1; echo Error!; tput sgr0)
|
||||
@ if test -x $@; then tput bold; tput setaf 2; echo done; tput sgr0; test -x "$(prefix)/bin/$@" || echo "You must now run 'make install' (as the appropriate user) to install the executable, documentation and other support files in order for the program to function properly."; fi
|
||||
@ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ || echo "$(BOLD)$(RED)Error!$(SGR0)"
|
||||
@ if test -x $@; then echo "$(DONE)"; test -x "$(prefix)/bin/$@" || echo "You must now run 'make install' (as the appropriate user) to install the executable, documentation and other support files in order for the program to function properly."; fi
|
||||
|
||||
install: all
|
||||
@ echo -n "Installing..."
|
||||
|
@ -92,8 +101,7 @@ install: all
|
|||
@ cp -r instruments "$(SYSTEM_PATH)"
|
||||
@ mkdir -p "$(DOCUMENT_PATH)"
|
||||
@ cp doc/*.html doc/*.png "$(DOCUMENT_PATH)"
|
||||
@ tput bold; tput setaf 2; echo done; tput sgr0
|
||||
# make -C doc install
|
||||
@ echo "$(DONE)"
|
||||
|
||||
dist:
|
||||
git archive --prefix=non-sequencer-$(VERSION)/ v$(VERSION) | bzip2 > non-sequencer-$(VERSION).tar.bz2
|
||||
|
@ -101,9 +109,8 @@ dist:
|
|||
TAGS: $(SRCS)
|
||||
etags $(SRCS)
|
||||
|
||||
makedepend: $(SRCS)
|
||||
makedepend: make.conf $(SRCS)
|
||||
@ echo -n Checking dependencies...
|
||||
@ makedepend -f- -- $(CXXFLAGS) -- $(SRCS) > makedepend 2>/dev/null && echo done.
|
||||
@ makedepend -f- -- $(CXXFLAGS) -- $(SRCS) > makedepend 2>/dev/null && echo "$(DONE)"
|
||||
|
||||
|
||||
include makedepend
|
||||
-include makedepend
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2008 Jonathan Moore Liles
|
||||
# This file is licensed under version 2 of the GPL.
|
||||
|
||||
. scripts/config-funcs
|
||||
|
||||
begin
|
||||
|
||||
begin_options
|
||||
|
||||
ask "Install prefix?" prefix /usr/local
|
||||
ask "Require LASH?" USE_LASH yes
|
||||
ask "Build for debugging?" USE_DEBUG no
|
||||
|
||||
begin_tests
|
||||
|
||||
require_FLTK 1.1.7 images
|
||||
require_command FLUID fluid
|
||||
require_package JACK 0.103.0 jack
|
||||
test_version `version_of jack` -ge 0.105.0 || append "JACK_MIDI_PROTO_API=yes"
|
||||
|
||||
require_package sigcpp 2.0.0 sigc++-2.0
|
||||
|
||||
using LASH && require_package LASH 0.5.4 lash-1.0
|
||||
|
||||
end
|
2
lash.C
2
lash.C
|
@ -24,7 +24,7 @@
|
|||
|
||||
// TODO: produce Save_Project events...
|
||||
|
||||
#ifndef USE_LASH
|
||||
#ifndef HAVE_LASH
|
||||
|
||||
Lash::Lash ( ) {}
|
||||
bool Lash::init ( int *argc, char ***argv ) { return true; }
|
||||
|
|
4
lash.H
4
lash.H
|
@ -21,14 +21,14 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_LASH
|
||||
#ifdef HAVE_LASH
|
||||
#include <lash/lash.h>
|
||||
#endif
|
||||
|
||||
class Lash
|
||||
{
|
||||
|
||||
#ifdef USE_LASH
|
||||
#ifdef HAVE_LASH
|
||||
lash_client_t *_client;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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`
|
|
@ -0,0 +1,203 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2008 Jonathan Moore Liles
|
||||
# This file is licensed under version 2 of the GPL.
|
||||
|
||||
. scripts/colors
|
||||
|
||||
# support functions for 'configure' scripts.
|
||||
|
||||
|
||||
fatal ()
|
||||
{
|
||||
echo "$BOLD$RED$*$SGR0" > /dev/stderr
|
||||
exit 255
|
||||
}
|
||||
|
||||
[ $# -gt 0 ] && fatal "This is not an autoconf script. Run it without any options and you will be prompted."
|
||||
|
||||
ask ()
|
||||
{
|
||||
local A D
|
||||
|
||||
D="`eval echo \\$$2`"
|
||||
D=${D:-$3}
|
||||
|
||||
echo -n "$BLACK$BOLD::$SGR0 $1 [$BOLD${D}$SGR0] "
|
||||
read A
|
||||
A=${A:-$D}
|
||||
|
||||
if [ "$3" = yes ] || [ "$3" = no ]
|
||||
then
|
||||
case "$A" in
|
||||
no | n | N) A=no ;;
|
||||
yes | y | Y) A=yes ;;
|
||||
* ) fatal "Invalid response. Must be 'yes' or 'no'" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
append "${2}=${A:-$D}"
|
||||
}
|
||||
|
||||
ok ()
|
||||
{
|
||||
echo "$BOLD${GREEN}ok${SGR0}"
|
||||
}
|
||||
|
||||
failed ()
|
||||
{
|
||||
echo "$BOLD${RED}failed!${SGR0}" > /dev/stderr
|
||||
rm -f make.conf
|
||||
}
|
||||
|
||||
using ()
|
||||
{
|
||||
[ "`eval echo \\$USE_$1`" = yes ]
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
extract_options ()
|
||||
{
|
||||
local line;
|
||||
|
||||
if [ -f make.conf ]
|
||||
then
|
||||
{
|
||||
while read line
|
||||
do
|
||||
[ "$line" = "## options" ] && break
|
||||
done
|
||||
|
||||
while read line
|
||||
do
|
||||
if [ "$line" = "## libs" ]
|
||||
then
|
||||
break
|
||||
else
|
||||
eval "$line"
|
||||
fi
|
||||
done
|
||||
} < make.conf
|
||||
fi
|
||||
}
|
||||
|
||||
begin ()
|
||||
{
|
||||
echo -n "Checking sanity..."
|
||||
require_command pkg-config pkg-config > /dev/null
|
||||
ok
|
||||
}
|
||||
|
||||
begin_options ()
|
||||
{
|
||||
# get the old values
|
||||
extract_options
|
||||
|
||||
echo > make.conf
|
||||
append "# This file was automatically generated on `date`. Any changes may be lost!"
|
||||
append "## options"
|
||||
|
||||
echo "--- Configuration required ---"
|
||||
}
|
||||
|
||||
begin_tests ()
|
||||
{
|
||||
append "## libs"
|
||||
extract_options
|
||||
}
|
||||
|
||||
append ()
|
||||
{
|
||||
echo "$1" >> make.conf
|
||||
}
|
||||
|
||||
end ()
|
||||
{
|
||||
echo "--- Configuration complete ---"
|
||||
touch make.conf
|
||||
}
|
||||
|
||||
require_command ()
|
||||
{
|
||||
echo -n "Checking for ${BOLD}$1${SGR0}..."
|
||||
|
||||
if ! [ -x "`which $2`" ]
|
||||
then
|
||||
failed
|
||||
fatal "Command $1 not found."
|
||||
else
|
||||
ok
|
||||
fi
|
||||
}
|
||||
|
||||
require_package ()
|
||||
{
|
||||
echo -n "Checking for $BOLD$1$SGR0..."
|
||||
if ! pkg-config --exists $3
|
||||
then
|
||||
failed
|
||||
fatal "Required package $1 doesn't appear to be installed."
|
||||
elif ! pkg-config --atleast-version $2 $3
|
||||
then
|
||||
failed
|
||||
fatal "The installed version of $1 (`pkg-config --mod-version $3`) is too old."
|
||||
fi
|
||||
|
||||
append "${1}_LIBS=`pkg-config --libs $3`"
|
||||
append "${1}_CFLAGS=-DHAVE_${1} `pkg-config --cflags $3`"
|
||||
|
||||
ok
|
||||
return 0
|
||||
}
|
||||
|
||||
_test_version ()
|
||||
{
|
||||
[ $1 $4 $5 ] && [ $2 $4 $6 ] && [ $3 $4 $7 ]
|
||||
}
|
||||
|
||||
test_version ()
|
||||
{
|
||||
local IFS
|
||||
IFS='.'
|
||||
|
||||
if [ $2 != -ge ] && [ $2 != -le ]
|
||||
then
|
||||
fatal "Syntax error"
|
||||
fi
|
||||
|
||||
_test_version $1 $2 $3
|
||||
}
|
||||
|
||||
version_of ()
|
||||
{
|
||||
echo `pkg-config --modversion $1`
|
||||
}
|
||||
|
||||
require_FLTK ()
|
||||
{
|
||||
local use
|
||||
|
||||
echo -n "Checking for ${BOLD}FLTK${SGR0}..."
|
||||
|
||||
FLTK_VERSION=`fltk-config --version`
|
||||
|
||||
if ! test_version $FLTK_VERSION -ge $1
|
||||
then
|
||||
failed
|
||||
fatal "The installed FLTK version ($FLTK_VERSION) is too old."
|
||||
else
|
||||
ok
|
||||
fi
|
||||
|
||||
use=
|
||||
|
||||
while [ $# -gt 1 ]
|
||||
do
|
||||
shift 1
|
||||
use="$use --use-$1"
|
||||
done
|
||||
|
||||
append "FLTK_LIBS=`fltk-config $use --ldflags`"
|
||||
append "FLTK_CFLAGS=`fltk-config $use --cflags`"
|
||||
}
|
Loading…
Reference in New Issue