3 # util routines for a C/C++ - build
9 *) echo "unknown architecture $1"
14 function install_cpp_make {
18 if [ -f makefile ]; then rm makefile; fi
19 if [ -L makefile ]; then rm makefile; fi
20 if [ -f make.post ]; then rm make.post; fi
21 ln -s $cwd/projects/tools/make/cpp.make makefile
22 echo "SOURCE = \\" > make.pre
23 for file in $(ls *.cpp)
25 echo " $file \\" >> make.pre
28 if [ "$ARCH" = "armel" ]
30 echo "CXX = arm-linux-gnueabi-g++" >> make.pre
31 echo "CC = arm-linux-gnueabi-g++" >> make.pre
32 echo "CXXFLAGS += -D_ARMEL" >> make.pre
33 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
35 echo "CXXFLAGS += -std=c++0x" >> make.pre
40 function append_dependency {
41 # adds another drectory, where a c++ compile is performed
44 # $2: dependency directory
45 # $3: dependency artefact
48 echo "DEPS += $3" >> $1/make.pre
49 echo "$3:" >> $1/make.post
50 echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
51 echo "" >> $1/make.post
54 function add_include {
55 # adds a include directory
61 echo "CXXFLAGS += -I$src/$2" >> $1/make.pre
64 function add_library {
65 # adds a extern library
68 # $2: library name (without l or lib )
71 echo "EXTLIB += -l$2" >> $1/make.pre
74 function append_library {
75 # same as append_dependency. In addition a include statement + a link to the library is added to "main directory"
78 # $2: dependency directory
79 # $3: dependency artefact
82 echo "DEPS += $3" >> $1/make.pre
83 echo "LDLIBS += $3" >> $1/make.pre
84 echo "CXXFLAGS += -I$src/$2" >> $1/make.pre
85 echo "$3:" >> $1/make.post
86 echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
87 echo " ln -sf $src/$2/$3 ." >> $1/make.post
88 echo "" >> $1/make.post