Commit 15245f74 authored by Christoffer Ackelman's avatar Christoffer Ackelman

32-bit versions can now be compiled on 64-bit machines.

parent 72de1d67
......@@ -5,4 +5,8 @@
*.wb_load.*
#Ignore build files
*.os_*
*.hw_*
\ No newline at end of file
*.hw_*
rls/
adm/
pwre_db
......@@ -82,6 +82,13 @@ static int check_os( char *str, char *os)
return 0;
}
const char* getenvsafe(const char* name) {
const char* s = getenv(name);
if (s == NULL)
return "";
return s;
}
int main( int argc, char *argv[])
{
pwr_tFileName filespec;
......@@ -288,10 +295,10 @@ int main( int argc, char *argv[])
dcli_translate_filename( incdir, "$pwr_einc");
switch ( mtype) {
case merge_eMtype_WbBase:
snprintf( cmd, sizeof(cmd), "%s -c %s -I%s %s -o %s %s", pwre_cxx, cflags, incdir, dos, ofile, cfile);
snprintf( cmd, sizeof(cmd), "%s -c %s %s -I%s %s -o %s %s", pwre_cxx, getenvsafe("cross_compile"), cflags, incdir, dos, ofile, cfile);
break;
default:
snprintf( cmd, sizeof(cmd), "%s -c %s -I%s %s -o %s %s", pwre_cc, cflags, incdir, dos, ofile, cfile);
snprintf( cmd, sizeof(cmd), "%s -c %s %s -I%s %s -o %s %s", pwre_cc, getenvsafe("cross_compile"), cflags, incdir, dos, ofile, cfile);
}
if ( arg_verbose)
printf( "co_merge: %s\n", cmd);
......
......@@ -80,14 +80,14 @@ then
cc=gcc
cinc="-I$pwr_inc -I$pwrp_rttbld -I-"
cflags="-DOS_LINUX=1 -DOS_POSIX=1 -DOS=linux -DHW_X86=1 -DHW=x86 -O3 -DGNU_SOURCE -DPWR_NDEBUG -D_REENTRANT"
cflags="${cross_compile} -DOS_LINUX=1 -DOS_POSIX=1 -DOS=linux -DHW_X86=1 -DHW=x86 -O3 -DGNU_SOURCE -DPWR_NDEBUG -D_REENTRANT"
${cc} -c -o $pwrp_obj/${menuname}.o \
$pwrp_rttbld/${menuname}.c \
${cinc} ${cflags}
ld=g++
linkflags="-g -L/lib/thread -L$pwrp_lib -L$pwr_lib"
linkflags="${cross_compile} -g -L/lib/thread -L$pwrp_lib -L$pwr_lib"
${ld} ${linkflags} -o $pwrp_exe/${exename} $pwrp_obj/${menuname}.o \
$pwr_obj/dtt_rttsys.o $pwr_obj/rt_io_user.o \
......@@ -102,7 +102,7 @@ then
# echo "Compile"
cc=gcc
cinc="-I$pwr_inc -I$pwrp_rttbld -I$pwrp_inc -I$pwrp_cmn/common/inc -I-"
cflags="-DOS_LINUX=1 -DOS=linux -DHW_X86=1 -DHW=x86 -O3 -DGNU_SOURCE -DPWR_NDEBUG -D_REENTRANT"
cflags="${cross_compile} -DOS_LINUX=1 -DOS=linux -DHW_X86=1 -DHW=x86 -O3 -DGNU_SOURCE -DPWR_NDEBUG -D_REENTRANT"
${cc} -c -o $pwrp_obj/${applname}.o \
$pwrp_rtt/${applname}.c \
......
......@@ -55,7 +55,7 @@ if [ $opsys = "64" ] || [ $opsys == "128" ]; then
cc=gcc
cinc="-I$pwr_inc -I$pwrp_rttbld"
cflags="-DOS_LINUX -DOS_POSIX -DOS=linux -DHW_X86=1 -DPOSIX_SOURCE -DWall"
cflags="${cross_compile} -DOS_LINUX -DOS_POSIX -DOS=linux -DHW_X86=1 -DPOSIX_SOURCE -DWall"
${cc} -c -o $pwrp_obj/${name}.o $pwrp_rttbld/${name}.c ${cinc} ${cflags}
ar rc ${ar_name_pict} $pwrp_obj/${name}.o
else
......@@ -66,7 +66,7 @@ if [ $opsys = "64" ] || [ $opsys == "128" ]; then
cc=gcc
cinc="-I$pwr_inc -I${bld_dir}"
cflags="-DOS_LINUX -DOS_POSIX -DOS=linux -DHW_X86=1 -DPOSIX_SOURCE -DWall"
cflags="${cross_compile} -DOS_LINUX -DOS_POSIX -DOS=linux -DHW_X86=1 -DPOSIX_SOURCE -DWall"
${cc} -c -o ${bld_dir}/${name}.o \
${bld_dir}/${name}.c ${cinc} ${cflags}
ar rc ${ar_name_pict} ${bld_dir}/${name}.o
......
......@@ -9,11 +9,11 @@ cxx := g++
f77 := g77
ld := gcc
ldxx := g++
linkflags := -g -L/usr/local/lib -L$(pwr_obj) -L$(pwrp_obj) -lm -lrt
cflags := -c -g -Wall -D_GNU_SOURCE -D_REENTRANT
linkflags := $(cross_compile) -g -L/usr/local/lib -L$(pwr_obj) -L$(pwrp_obj) -lm -lrt
cflags := $(cross_compile) -c -g -Wall -D_GNU_SOURCE -D_REENTRANT
cxxflags := $(cflags) -Wno-deprecated
f77flags :=
linkflags := -g -L/usr/local/lib -L$(pwr_lib) -L$(pwrp_lib) -lrt
linkflags := $(cross_compile) -g -L/usr/local/lib -L$(pwr_lib) -L$(pwrp_lib) -lrt
csetos := -DOS_LINUX=1 -DOS_POSIX=1 -DOS=linux -DHW_X86=1 -DHW=x86
cinc := -I$(pwr_inc) -I$(pwrp_inc) $(PWR_EXT_INC) -I/usr/local/include -I/usr/X11R6/include -I$(jdk)/include -I$(jdk)/include/linux
f77inc := -I$(pwr_inc) -I$(pwrp_inc)
......
......@@ -196,21 +196,21 @@ mkdir := mkdir
wblflags :=
ifeq ($(pwre_btype),rls)
cflags := -c -O3 -D_GNU_SOURCE -DPWR_NDEBUG -D_REENTRANT -fPIC -Wno-deprecated-declarations -Wno-unused-but-set-variable
cxxflags := $(cflags)
linkflags := -O3 -L$(lib_dir)
elinkflags := -O3 -L$(lib_dir) -L$(elib_dir)
explinkflags := -g -L$(elib_dir)
cflags := $(cross_compile) -c -O3 -D_GNU_SOURCE -DPWR_NDEBUG -D_REENTRANT -fPIC -Wno-deprecated-declarations -Wno-unused-but-set-variable
linkflags := $(cross_compile) -O3 -L$(lib_dir)
elinkflags := $(cross_compile) -O3 -L$(lib_dir) -L$(elib_dir)
explinkflags := $(cross_compile) -g -L$(elib_dir)
cxxflags := $(cflags)
clis = /lis=$(list)
dolist = /lis=$(list)
domap = -Xlinker -Map -Xlinker $(map)
else
cflags := -c -g -Wall -D_GNU_SOURCE -D_REENTRANT -fPIC -Wno-deprecated-declarations -Wno-unused-but-set-variable
cxxflags := $(cflags) -Wno-deprecated
cflags := $(cross_compile) -c -g -Wall -D_GNU_SOURCE -D_REENTRANT -fPIC -Wno-deprecated-declarations -Wno-unused-but-set-variable
mmflags := -Wno-deprecated
linkflags := -g -L$(lib_dir)
elinkflags := -g -L$(lib_dir) -L$(elib_dir)
explinkflags := -g -L$(elib_dir)
linkflags := $(cross_compile) -g -L$(lib_dir)
elinkflags := $(cross_compile) -g -L$(lib_dir) -L$(elib_dir)
explinkflags := $(cross_compile) -g -L$(elib_dir)
cxxflags := $(cflags) -Wno-deprecated
dolist = /lis=$(list)
clis :=
domap = -Xlinker -Map -Xlinker $(map)
......
......@@ -54,6 +54,7 @@ if ($ENV{"pwre_hosttype"} eq "rs6000") {
$hw = "x86";
}
}
$real_hw = $hw;
$desc = $user. "'s environment";
@vars;
......@@ -139,7 +140,6 @@ sub add ()
update_db();
}
untie(%envdb)|| die "++ can't untie $dbname!";
}
#
......@@ -152,6 +152,9 @@ sub configure()
exit 1;
}
if ($hw eq "x86" && $real_hw eq "x86_64") {
$ENV{"cross_compile"} = "-m32";
}
my $fname = $ENV{"pwre_bin"} . "/pwre_configure.sh"." ".$_[0]." ".$_[1]." ".$_[2];
system( $fname);
}
......@@ -1176,6 +1179,9 @@ sub copy ()
system("$cmd");
}
else {
if ($hw eq "x86" && $real_hw eq "x86_64") {
$ENV{"cross_compile"} = "-m32";
}
my($cmd) = "make -f $bindir/import_files.mk" . " " . $_[0];
system("$cmd");
......@@ -1461,6 +1467,9 @@ sub _build () # args: branch, subbranch, flavour, phase
#print("\n$_\n");
chdir($_) || die "cannot cd to $_ ($!)";
$ENV{"PWD"} = $_;
if ($hw eq "x86" && $real_hw eq "x86_64") {
$ENV{"cross_compile"} = "-m32";
}
system("make @_") && exit 1;
}
}
......
......@@ -283,25 +283,13 @@ conf_incdirgst=""
let inc_cnt=0
let lib_cnt=0
let i=0
hwpl=`eval uname -i`
machine=`eval uname -m`
if [ $machine == "i686" ] || [ $machine == "x86_64" ]; then
hwpl=$machine
fi
if [ ${machine:0:3} == "arm" ]; then
hwpl=i386
if [ ${pwre_hw:3} == "arm" ]; then
hwpl=arm
else
ubuntu_ver=`cat /etc/issue | grep Ubuntu | awk '{ print $2 }'`
debian_ver=`cat /etc/issue | grep Debian | awk '{ print $3 }'`
if [ "$ubuntu_ver" == "" ]; then
ubuntu_ver=`cat /etc/issue | grep Mint | awk '{ print $3 }'`
fi
if [ "$ubuntu_ver" != "" ] && [ $hwpl == "i686" ] ; then
hwpl=i386
fi
if [ "$debian_ver" != "" ] && [ "$debian_ver" != "6" ] && [ $hwpl == "i686" ] ; then
hwpl=i386
fi
fi
if [ ${pwre_hw:3} == "x86_64" ]; then
hwpl=x86_64
fi
# Bash
......
......@@ -3,7 +3,8 @@ link_rule_mk := 1
# Link with local wb to avoid profibus wb methods
link = $(ldxx) -L$(release_root)/wb/lib -L$(pwr_lib) -L$(pwr_elib) $(domap) -o $(pwr_exe)/wb_ge_gtk \
link = $(ldxx) $(cross_compile) \
-L$(release_root)/wb/lib -L$(pwr_lib) -L$(pwr_elib) $(domap) -o $(pwr_exe)/wb_ge_gtk \
$(bld_dir)/wb_ge_gtk.o $(wb_msg_eobjs) $(rt_msg_eobjs) $(pwr_eobj)/pwr_msg_glow.o\
$(pwr_eobj)/rt_io_user.o $(pwr_eobj)/wb_provider.o \
$(pwre_conf_libdir) $(pwre_conf_libpwrwbgtk) $(pwre_conf_libpwrxttgtk) $(pwre_conf_libpwrwb) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment