MAKEFLAGS_CXX="-g -O2 -DNDEBUG"
MAKEFLAGS_CC="-g -O2 -DNDEBUG"
BUILD_TYPE="Relwithdebinfo"
-CMAKE_APPENDFLAG=""
+CMAKE_LINKFLAG=""
+#CMAKE_GENTYPE="\"MinGW Makefiles\""
+#CMAKE_APPENDFLAG=""
+CMAKE_GENTYPE="\"MSYS Makefiles\""
+CMAKE_GENFLAGS="-DCMAKE_MAKE_PROGRAM=mingw32-make"
mkdir -p ./bin-win32/
+
+echo "Make status." > ${MAKE_STATUS_FILE}
+echo "Started at `date --rfc-2822`:" >> ${MAKE_STATUS_FILE}
if [ -e ./buildvars_mingw.dat ] ; then
. ./buildvars_mingw.dat
+else
+ echo "WARN: Config file does not exist." >> ${MAKE_STATUS_FILE}
+ echo "WARN: Read configs from templete." >> ${MAKE_STATUS_FILE}
+ . ./buildvars_mingw.dat.tmpl
fi
MAKEFLAGS_CXX="${MAKEFLAGS_CXX} -DWINVER=0x501"
-MAKEFLAGS_CC="${MAKEFLAGS_CXX} -DWINVER=0x501"
+MAKEFLAGS_CC="${MAKEFLAGS_CC} -DWINVER=0x501"
+MAKEFLAGS_LIB_CXX="${MAKEFLAGS_LIB_CXX} -DWINVER=0x501"
+MAKEFLAGS_LIB_CC="${MAKEFLAGS_LIB_CC} -DWINVER=0x501"
+
+function build_dll() {
+ mkdir -p $1/build-win32
+ cd $1/build-win32
+ echo ${CMAKE_FLAGS1} ${CMAKE_FLAGS2}
+ ${CMAKE} -G "${CMAKE_GENTYPE}" \
+ ${CMAKE_GENFLAGS} \
+ -D CMAKE_C_COMPILER:STRING=${CCMAKE_CC} \
+ -D CMAKE_CXX_COMPILER:STRING=${CCMAKE_CXX} \
+ ${CMAKE_FLAGS1} \
+ "${CMAKE_FLAGS2}=${MAKEFLAGS_LIB_CXX}" \
+ "${CMAKE_FLAGS3}=${MAKEFLAGS_LIB_CC}" \
+ ${CMAKE_APPENDFLAG} \
+ ${CMAKE_LINKFLAG} \
+ .. | tee make.log
+
+ ${CMAKE} -D CMAKE_C_COMPILER:STRING=${CCMAKE_CC} \
+ -D CMAKE_CXX_COMPILER:STRING=${CCMAKE_CXX} \
+ ${CMAKE_FLAGS1} \
+ "${CMAKE_FLAGS2}=${MAKEFLAGS_LIB_CXX}" \
+ "${CMAKE_FLAGS3}=${MAKEFLAGS_LIB_CC}" \
+ ${CMAKE_APPENDFLAG} \
+ ${CMAKE_LINKFLAG} \
+ .. | tee -a make.log
+
+ mingw32-make clean
+ mingw32-make ${MAKEFLAGS_GENERAL} 2>&1 | tee -a ./make.log
+
+ case $? in
+ 0 )
+ # cp ./qt/gui/libqt_gui.a ../../bin-win32/
+ # cp ./qt/gui/*.lib ../../bin-win32/
+ # cp ./qt/gui/*.dll ../../bin-win32/
+ ;;
+ * ) exit $? ;;
+ esac
+ #mingw32-make clean
+ cd ../..
+}
case ${BUILD_TYPE} in
"Debug" | "DEBUG" | "debug" )
exit -1
;;
esac
-#libCSPgui
-mkdir -p libCSPgui/build
-cd libCSPgui/build
-echo ${CMAKE_FLAGS1} ${CMAKE_FLAGS2}
-${CMAKE} -G "MinGW Makefiles" \
- -D CMAKE_C_COMPILER:STRING=${CCMAKE_CC} \
- -D CMAKE_CXX_COMPILER:STRING=${CCMAKE_CXX} \
- ${CMAKE_FLAGS1} \
- "${CMAKE_FLAGS2}=${MAKEFLAGS_CXX}" \
- "${CMAKE_FLAGS3}=${MAKEFLAGS_CC}" \
- ${CMAKE_APPENDFLAG} \
- ${CMAKE_LINKFLAG} \
- .. | tee make.log
-
-${CMAKE} -D CMAKE_C_COMPILER:STRING=${CCMAKE_CC} \
- -D CMAKE_CXX_COMPILER:STRING=${CCMAKE_CXX} \
- ${CMAKE_FLAGS1} \
- "${CMAKE_FLAGS2}=${MAKEFLAGS_CXX}" \
- "${CMAKE_FLAGS3}=${MAKEFLAGS_CC}" \
- ${CMAKE_APPENDFLAG} \
- ${CMAKE_LINKFLAG} \
- .. | tee -a make.log
-
-mingw32-make clean
-mingw32-make ${MAKEFLAGS_GENERAL} 2>&1 | tee -a ./make.log
-
-#case $? in
-# 0 )
-# cp ./qt/gui/libqt_gui.a ../../bin-win32/
-# cp ./qt/gui/*.lib ../../bin-win32/
-# cp ./qt/gui/*.dll ../../bin-win32/
-# ;;
-# * ) exit $? ;;
-#esac
-#make clean
-cd ../..
+
+# libCSPGui
+build_dll libCSPavio
+build_dll libCSPgui
+build_dll libCSPosd
+build_dll libCSPemu_utils
for SRCDATA in $@ ; do\
cd ${SRCDATA}/build
echo ${CMAKE_FLAGS1} ${CMAKE_FLAGS2}
- ${CMAKE} -G "MinGW Makefiles" \
+ ${CMAKE} -G "${CMAKE_GENTYPE}" \
+ ${CMAKE_GENFLAGS} \
-D CMAKE_C_COMPILER:STRING=${CCMAKE_CC} \
-D CMAKE_CXX_COMPILER:STRING=${CCMAKE_CXX} \
${CMAKE_FLAGS1} \
cd ../..
done
-cd libCSPgui/build
-mingw32-make clean
-cd ../..
+for ii in libCSPavio libCSPgui libCSPosd libCSPemu_utils; do
+ cd $ii/build-win32
+ make clean
+ cd ../..
+done
exit 0