--- /dev/null
+#!/bin/bash
+
+# util routines for a C/C++ - build
+
+function check_arch {
+ case $1 in
+ armel) ;;
+ i386) ;;
+ *) echo "unknown architecture $1"
+ exit 1
+ esac
+}
+
+function install_cpp_make {
+# $1: dir to install
+ src=$(pwd);
+ pushd $1
+ if [ -f makefile ]; then rm makefile; fi
+ if [ -f make.post ]; then rm make.post; fi
+ ln -s $cwd/Make/cpp.make makefile
+ echo "SOURCE = \\" > make.pre
+ for file in $(ls *.cpp)
+ do
+ echo " $file \\" >> make.pre
+ done
+ echo >> make.pre
+ if [ "$ARCH" = "armel" ]
+ then
+ echo "CXX = arm-linux-gnueabi-g++" >> make.pre
+ echo "CC = arm-linux-gnueabi-g++" >> make.pre
+ echo "CXXFLAGS += -D_ARMEL" >> make.pre
+ echo 'export PATH := /opt/eldk-5.0/armv5te/sysroots/i686-oesdk-linux/usr/bin/armv5te-linux-gnueabi/:/opt/eldk-5.0/armv5te/sysroots/i686-oesdk-linux/bin/armv5te-linux-gnueabi/:$(PATH)' >> make.pre
+ fi
+ echo "CXXFLAGS += -std=c++0x -I$src/util" >> make.pre
+ popd
+}
+
+function append_dependency {
+# parameter:
+# $1: main directory
+# $2: dependency directory
+# $3: dependency artefact
+
+ src=$(pwd)
+ echo "DEPS += $3" >> $1/make.pre
+ echo "$3:" >> $1/make.post
+ echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
+ echo "" >> $1/make.post
+}
+
+function append_library {
+# parameter:
+# $1: main directory
+# $2: dependency directory
+# $3: dependency artefact
+
+ src=$(pwd)
+ echo "DEPS += $3" >> $1/make.pre
+ echo "LDLIBS += $3" >> $1/make.pre
+ echo "$3:" >> $1/make.post
+ echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
+ echo " ln -sf $src/$2/$3 ." >> $1/make.post
+ echo "" >> $1/make.post
+}
+
# to build a package you need ...
# <package>.co: checkout commands
# <package>.cp (optional): copy step for package production
-# <package>.cpp (optional): commands to setup the C++ compile environment
+# <package>.cpp.sh (optional): commands to setup the C++ compile environment
if [ $# -lt 2 ]
then
echo " this file is necessary for any package production."
fi
-# load util functions for C/C++ - build
-if [ -f $paket.cpp ]
-then
- cpp_build=1
- . Make/c_configure.sh
-fi
-
# clean dirs and check out
if [ -e $paket ]
then
rm -rf $paket
fi
rm *.stamp || true
+rm make.pre || true
mkdir -p src
cwd=$(pwd)
../$paket.co $build
popd >/dev/null
+# load util functions for C/C++ - build
+if [ -f $paket.cpp.sh ]
+then
+ cpp_build=1
+ . projects/tools/make/c_configure.sh
+ . $paket.cpp.sh
+fi
+
# copy package control
control=$(find src -name $paket.control)
if [ -z "$control" ]
echo "warning: control file not found"
echo " this file is necessary for any package production."
else
- sed "s/%BUILD%/$build/" $control >$paket.control
+ sed "s/%BUILD%/$build/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control
echo "$paket.control written."
# extract version
version=$(grep Version $paket.control |sed "s/Version: //")
fi
+
# check for postinst
postinst=$(find src -name $paket.postinst)
if [ -n "$postinst" ]
cat >>make.pre <<MAKE_PRE
# mBuild make.pre script (auto generated)
project = $paket
-version = $version
COPY = ./$paket.cp
MAKE_PRE
echo "make.pre written."
fi
+# append version to make.pre
+echo "version = $version" >> make.pre
+
--- /dev/null
+# Generic cpp makefile for mBuild build process
+
+# default parameters
+CC = g++
+
+include make.pre
+
+# All Target
+all: $(DEPS) $(SOURCE:%.cpp=%.o) $(TARGET)
+
+# Other Targets
+clean:
+ -rm *.o
+ -rm $(TARGET)
+
+.PHONY: all make.post
+
+%.a: $(SOURCE:%.cpp=%.o)
+ ar r $(TARGET) *.o
+
+%.so: $(SOURCE:%.cpp=%.o) $(LDLIBS)
+ $(CXX) -shared -o $(TARGET) *.o $(LDLIBS)
+-include make.post
project = default
SOURCES =
COPY_PRE =
-TEX = pdflatex
# Load project specification
include make.pre
$(project).deb: copy.stamp control.stamp
$(DEB)
- cp $(project).deb $(project)_$(version).deb
+ cp $(project).deb $(project)_$(version)$(_arch).deb
#-----------------------------------------------------------------
# utilities
if [ -e $(project).zip ]; then rm $(project).zip; fi
if [ -e $(project) ]; then rm -rf $(project); fi
-#-----------------------------------------------------------------
-# generische Regeln
-#-----------------------------------------------------------------
-%.pdf:%.tex
- $(TEX) $<
-
--include make.post