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 )
69 # $3: library path (optional)
72 echo "EXTLIB += -l$2" >> $1/make.pre
76 if [ ${lib_path:0:1} != "/" ]
78 lib_path="$src/$lib_path"
80 echo "LDFLAGS += -L$lib_path" >> $1/make.pre
84 function append_library {
85 # same as append_dependency. In addition a include statement + a link to the library is added to "main directory"
88 # $2: dependency directory
89 # $3: dependency artefact
92 echo "DEPS += $3" >> $1/make.pre
93 echo "LDLIBS += $3" >> $1/make.pre
94 echo "CXXFLAGS += -I$src/$2" >> $1/make.pre
95 echo "$3:" >> $1/make.post
96 echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
97 echo " ln -sf $src/$2/$3 ." >> $1/make.post
98 echo "" >> $1/make.post