make makefile generation under unix sane
we now simply call qmake -r, which is also what we do under windows. -fast mode is retained for examples and tests, though with moderately modified semantics (i couldn't be bothered to decipher what the old ones were supposed to be). Change-Id: Id2c2d2bed9c8d52ac42f31b388bffc34f4649650 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
parent
7d8578418d
commit
709cc8800e
237
configure
vendored
237
configure
vendored
@ -6125,225 +6125,48 @@ EXEC=""
|
||||
# build makefiles based on the configuration
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
echo "Finding project files. Please wait..."
|
||||
if [ "$CFG_NOPROCESS" != "yes" ]; then
|
||||
"$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
|
||||
if [ -f "${relpath}/qtbase.pro" ]; then
|
||||
mkfile="${outpath}/Makefile"
|
||||
[ -f "$mkfile" ] && chmod +w "$mkfile"
|
||||
QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
|
||||
fi
|
||||
fi
|
||||
echo "Creating makefiles. Please wait..."
|
||||
"$outpath/bin/qmake" -r ${OPT_FAST+CONFIG+=fast} "$relpath"
|
||||
echo "Done"
|
||||
|
||||
# .projects -> projects to process
|
||||
# .projects.1 -> qt and moc
|
||||
# .projects.2 -> subdirs and libs
|
||||
# .projects.3 -> the rest
|
||||
rm -f .projects .projects.1 .projects.2 .projects.3
|
||||
if [ "$OPT_FAST" = "yes" ]; then
|
||||
PART_ROOTS=
|
||||
for part in $CFG_BUILD_PARTS; do
|
||||
case "$part" in
|
||||
examples|tests) PART_ROOTS="$PART_ROOTS $part" ;;
|
||||
esac
|
||||
done
|
||||
if [ "x$PART_ROOTS" != "x" ]; then
|
||||
echo
|
||||
echo "Creating stub makefiles. Please wait..."
|
||||
QMAKE="$outpath/bin/qmake"
|
||||
[ "$CFG_DEBUG_RELEASE" = "no" ] && first_tgt="first_target: first" || first_tgt=
|
||||
(cd "$relpath" && find $PART_ROOTS -name '*.pro') | grep -v /testdata/ | while read p; do
|
||||
d=${p%/*}
|
||||
test -f "$outpath/$d/Makefile" && continue
|
||||
echo " for $relpath/$p"
|
||||
|
||||
QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
|
||||
if [ -z "$AWK" ]; then
|
||||
for p in `echo $QMAKE_PROJECTS`; do
|
||||
echo "$p" >> .projects
|
||||
done
|
||||
else
|
||||
cat >projects.awk <<EOF
|
||||
BEGIN {
|
||||
files = 0
|
||||
target_file = ""
|
||||
input_file = ""
|
||||
|
||||
first = "./.projects.1.tmp"
|
||||
second = "./.projects.2.tmp"
|
||||
third = "./.projects.3.tmp"
|
||||
}
|
||||
|
||||
FNR == 1 {
|
||||
if ( input_file ) {
|
||||
if ( ! target_file )
|
||||
target_file = third
|
||||
print input_file >target_file
|
||||
}
|
||||
|
||||
matched_target = 0
|
||||
template_lib = 0
|
||||
input_file = FILENAME
|
||||
target_file = ""
|
||||
}
|
||||
|
||||
/^(TARGET.*=)/ {
|
||||
if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
|
||||
target_file = first
|
||||
matched_target = 1
|
||||
} else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
|
||||
target_file = second
|
||||
matched_target = 1
|
||||
}
|
||||
}
|
||||
|
||||
matched_target == 0 && /^(TEMPLATE.*=)/ {
|
||||
if ( \$3 == "subdirs" )
|
||||
target_file = second
|
||||
else if ( \$3 == "lib" )
|
||||
template_lib = 1
|
||||
else
|
||||
target_file = third
|
||||
}
|
||||
|
||||
matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
|
||||
if ( \$0 ~ /plugin/ )
|
||||
target_file = third
|
||||
else
|
||||
target_file = second
|
||||
}
|
||||
|
||||
END {
|
||||
if ( input_file ) {
|
||||
if ( ! target_file )
|
||||
target_file = third
|
||||
print input_file >>target_file
|
||||
}
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
rm -f .projects.all
|
||||
for p in `echo $QMAKE_PROJECTS`; do
|
||||
echo "$p" >> .projects.all
|
||||
done
|
||||
|
||||
# if you get errors about the length of the command line to awk, change the -l arg
|
||||
# to split below
|
||||
split -l 100 .projects.all .projects.all.
|
||||
for p in .projects.all.*; do
|
||||
"$AWK" -f projects.awk `cat $p`
|
||||
[ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
|
||||
[ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
|
||||
[ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
|
||||
rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
|
||||
done
|
||||
rm -f .projects.all* projects.awk
|
||||
|
||||
[ -f .projects.1 ] && cat .projects.1 >>.projects
|
||||
[ -f .projects.2 ] && cat .projects.2 >>.projects
|
||||
rm -f .projects.1 .projects.2
|
||||
if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
|
||||
cat .projects.3 >>.projects
|
||||
rm -f .projects.3
|
||||
fi
|
||||
fi
|
||||
# don't sort Qt and MOC in with the other project files
|
||||
# also work around a segfaulting uniq(1)
|
||||
if [ -f .sorted.projects.2 ]; then
|
||||
sort .sorted.projects.2 > .sorted.projects.2.new
|
||||
mv -f .sorted.projects.2.new .sorted.projects.2
|
||||
cat .sorted.projects.2 >> .sorted.projects.1
|
||||
fi
|
||||
[ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
|
||||
rm -f .sorted.projects.2 .sorted.projects.1
|
||||
|
||||
NORM_PROJECTS=0
|
||||
FAST_PROJECTS=0
|
||||
if [ -f .projects ]; then
|
||||
uniq .projects >.tmp
|
||||
mv -f .tmp .projects
|
||||
NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
|
||||
fi
|
||||
if [ -f .projects.3 ]; then
|
||||
uniq .projects.3 >.tmp
|
||||
mv -f .tmp .projects.3
|
||||
FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
|
||||
fi
|
||||
echo " `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
|
||||
echo
|
||||
|
||||
PART_ROOTS=
|
||||
for part in $CFG_BUILD_PARTS; do
|
||||
case "$part" in
|
||||
tools) PART_ROOTS="$PART_ROOTS tools" ;;
|
||||
libs) PART_ROOTS="$PART_ROOTS src" ;;
|
||||
translations) PART_ROOTS="$PART_ROOTS translations" ;;
|
||||
examples) PART_ROOTS="$PART_ROOTS examples" ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$CFG_DEV" = "yes" ]; then
|
||||
PART_ROOTS="$PART_ROOTS tests"
|
||||
fi
|
||||
|
||||
echo "Creating makefiles. Please wait..."
|
||||
for file in .projects .projects.3; do
|
||||
[ '!' -f "$file" ] && continue
|
||||
for a in `cat $file`; do
|
||||
IN_ROOT=no
|
||||
for r in $PART_ROOTS; do
|
||||
if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
|
||||
IN_ROOT=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$IN_ROOT" = "no" ] && continue
|
||||
|
||||
case $a in
|
||||
*winmain/winmain.pro)
|
||||
if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
*/qmake/qmake.pro) continue ;;
|
||||
*tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*|*tools/qdbusxml2cpp*|*tools/qdbuscpp2xml*) ;;
|
||||
*) if [ "$CFG_NOPROCESS" = "yes" ]; then
|
||||
continue
|
||||
fi;;
|
||||
esac
|
||||
dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
|
||||
test -d "$dir" || mkdir -p "$dir"
|
||||
OUTDIR="$outpath/$dir"
|
||||
if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
|
||||
# fast configure - the makefile exists, skip it
|
||||
# since the makefile exists, it was generated by qmake, which means we
|
||||
# can skip it, since qmake has a rule to regenerate the makefile if the .pro
|
||||
# file changes...
|
||||
[ "$OPT_VERBOSE" = "yes" ] && echo " skipping $a"
|
||||
continue;
|
||||
fi
|
||||
echo $ECHO_N " for $a$ECHO_C"
|
||||
|
||||
QMAKE="$outpath/bin/qmake"
|
||||
if [ "$file" = ".projects.3" ]; then
|
||||
echo " (fast)"
|
||||
|
||||
cat >"${OUTDIR}/Makefile" <<EOF
|
||||
# ${OUTDIR}/Makefile: generated by configure
|
||||
mkdir -p "$outpath/$d" || exit
|
||||
cat > "$outpath/$d/Makefile" <<EOF || exit
|
||||
# $outpath/$d/Makefile: generated by configure
|
||||
#
|
||||
# WARNING: This makefile will be replaced with a real makefile.
|
||||
# All changes made to this file will be lost.
|
||||
EOF
|
||||
[ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
|
||||
|
||||
cat >>"${OUTDIR}/Makefile" <<EOF
|
||||
QMAKE = "$QMAKE"
|
||||
|
||||
$first_tgt
|
||||
all clean install qmake first Makefile: FORCE
|
||||
\$(QMAKE) $QMAKE_SWITCHES -o "$OUTDIR" "$a"
|
||||
cd "$OUTDIR"
|
||||
\$(QMAKE) $QMAKE_SWITCHES "$relpath/$p"
|
||||
\$(MAKE) \$@
|
||||
|
||||
FORCE:
|
||||
|
||||
EOF
|
||||
else
|
||||
echo
|
||||
if [ "$OPT_VERBOSE" = "yes" ]; then
|
||||
echo "$QMAKE" $QMAKE_SWITCHES -o "$OUTDIR" "$a"
|
||||
fi
|
||||
|
||||
[ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
|
||||
QTDIR="$outpath" "$QMAKE" $QMAKE_SWITCHES -o "$OUTDIR" "$a"
|
||||
fi
|
||||
done
|
||||
done
|
||||
rm -f .projects .projects.3
|
||||
done || exit
|
||||
echo "Done"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# check for platforms that we don't yet know about
|
||||
|
@ -25,11 +25,11 @@ contains(PROJECTS, libs) {
|
||||
}
|
||||
contains(PROJECTS, examples) {
|
||||
PROJECTS -= examples
|
||||
SUBDIRS += examples
|
||||
!fast:SUBDIRS += examples
|
||||
}
|
||||
contains(PROJECTS, tests) {
|
||||
PROJECTS -= tests
|
||||
SUBDIRS += module_qtbase_tests
|
||||
!fast:SUBDIRS += module_qtbase_tests
|
||||
}
|
||||
!isEmpty(PROJECTS) {
|
||||
message(Unknown PROJECTS: $$PROJECTS)
|
||||
|
Loading…
Reference in New Issue
Block a user