aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-06-06 11:52:20 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-06-06 11:52:20 +0000
commit81dd6aadefa06530e4faf804c8ca4352c86232c9 (patch)
treef393e81d39bf292bb37a22ba2a0e25635cdc014f /src
parentc741b3433355b4c8a73975bc06f6caac6b2c4440 (diff)
added build (and configure) target for compilation as single externals (as opposed to 1 big library)
svn path=/trunk/externals/zexy/; revision=5174
Diffstat (limited to 'src')
-rw-r--r--src/Make.config.in9
-rw-r--r--src/Makefile17
-rw-r--r--src/configure.ac24
3 files changed, 37 insertions, 13 deletions
diff --git a/src/Make.config.in b/src/Make.config.in
index 2d4797e..6839fcf 100644
--- a/src/Make.config.in
+++ b/src/Make.config.in
@@ -1,5 +1,10 @@
LIBNAME =@LIBNAME@
+# when build as a library this holds a pre-processor define
+# (e.g. "-DZEXY_LIBRARY")
+# when build as single externals this is empty
+BUILDLIBRARY =@BUILDLIBRARY@
+
PREFIX =@prefix@@PDLIBDIR@
INSTALL_BIN=$(PREFIX)/extra
@@ -18,10 +23,10 @@ AFLAGS =
LFLAGS = @LFLAGS@
WFLAGS =
-TARNAME = $(LIBNAME)-@ZEXY_VERSION@.tgz
+TARNAME = $(LIBNAME)-@LIBRARY_VERSION@.tgz
# ICCFLAGS=-march=pentiumiii -axK
-Z_CFLAGS = $(IFLAGS) $(DEFS) -DPD $(WFLAGS) @CFLAGS@ $(CFLAGS)
+Z_CFLAGS = $(IFLAGS) $(DEFS) $(BUILDLIBRARY) -DPD $(WFLAGS) @CFLAGS@ $(CFLAGS)
MAKEDEP_FLAGS = @MAKEDEP_FLAGS@
diff --git a/src/Makefile b/src/Makefile
index e0b3c25..60dd75f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -44,17 +44,30 @@ endif
TARGETS = $(SOURCES:.c=.o)
+OBJECTS = $(SOURCES:.c=)
+## if $(BUILDLIBRARY) is defined, we build everything as a single library
+## else we build separate externals
+ifneq "$(BUILDLIBRARY)" ""
all: $(LIBNAME)
cp $(LIBNAME).$(EXT) ..
+else
+all: externals
+endif
+
+
+$(OBJECTS): $(TARGETS)
+ $(LD) $(LFLAGS) -o $@.$(EXT) $@.o $(LIBS)
+ $(STRIP) $(STRIPFLAGS) $@.$(EXT)
$(LIBNAME): $(TARGETS) z_zexy.c z_zexy.h
- $(LD) $(LFLAGS) -o $(LIBNAME).$(EXT) *.o $(LIBS)
- $(STRIP) $(STRIPFLAGS) $(LIBNAME).$(EXT)
+ $(LD) $(LFLAGS) -o $@.$(EXT) *.o $(LIBS)
+ $(STRIP) $(STRIPFLAGS) $@.$(EXT)
$(TARGETS): %.o : %.c
$(CC) $(Z_CFLAGS) -c -o $@ $*.c
+externals: $(OBJECTS)
clean:
-rm -f *.$(EXT) *.o
diff --git a/src/configure.ac b/src/configure.ac
index 42b5b9a..e53e6e6 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -16,7 +16,8 @@ AC_SUBST(EXT)
AC_SUBST(LD)
AC_SUBST(STRIP)
AC_SUBST(STRIPFLAGS)
-AC_SUBST(ZEXY_VERSION)
+AC_SUBST(LIBRARY_VERSION)
+AC_SUBST(BUILDLIBRARY)
AC_SUBST(REFERENCEPATH)
AC_SUBST(PDLIBDIR)
AC_SUBST(INCLUDES)
@@ -35,6 +36,8 @@ then
AC_ARG_ENABLE(bundle, [ --enable-bundleloader use bundle_loader (default: autodetect)])
fi
+AC_ARG_ENABLE(library,[ --disable-library split the library into single externals])
+
if test "x" = "x${enable_PIC}" ; then
enable_PIC="${with_PIC}"
fi
@@ -51,6 +54,12 @@ if test "x" = "x${enable_bundle}" ; then
enable_bundle="${with_bundle}"
fi
+if test "xno" != "x${enable_library}" ; then
+dnl LATER: find a more generic way to generate the .._LIBRARY define
+ BUILDLIBRARY="-DZEXY_LIBRARY"
+fi
+
+
dnl Checks for libraries.
dnl Replace `main' with a function in -lc:
AC_CHECK_LIB(c, main)
@@ -184,9 +193,6 @@ fi
dnl STRIP=${STRIP:=strip}
-DFLAGS="-DZEXY_LIBRARY"
-
-
dnl Checks for pd-version, to set the correct help-path
AC_MSG_CHECKING("pd\>=0.37")
@@ -237,7 +243,7 @@ AC_MSG_CHECKING("zexy-version")
if test "$with_version" != ""
then
echo -n "($with_version)...forced "
- ZEXY_VERSION="$with_version"
+ LIBRARY_VERSION="$with_version"
else
if test "x$cross_compiling" = "xno"
then
@@ -252,14 +258,14 @@ EOF
if $CC $INCLUDES $DFLAGS -o conftest.o conftest.c > /dev/null 2>&1
then
- ZEXY_VERSION=`./conftest.o`
- echo "$ZEXY_VERSION"
+ LIBRARY_VERSION=`./conftest.o`
+ echo "$LIBRARY_VERSION"
else
- ZEXY_VERSION="X"
+ LIBRARY_VERSION="X"
echo "(unknown)"
fi
else
- ZEXY_VERSION="X"
+ LIBRARY_VERSION="X"
echo "(X)"
fi
fi