Cross-Compiling on GNU/Linux

Makefiles are setup for cross-compilation using custom toolchains. File make.def, in the main toolkit folder, defines cross-comilation symbols referenced in lower-level makefiles. Lower-level makefiles include make.def before building their targets. The following is an example make.def file used when cross-compiling for the ADM5120 MIPSEL-based gateway.

Example 3.3.  Cross-compiling with make.def

# file: make.def

# ====================================================================
# Edimax Hardware;
# --------------------------------------------------------------------

PLATFORM=-D_ADM5120_
MODEL=-D_6104KP_
ENDIAN=-D_LITTLE_ENDIAN_
GATEWAY=y

# ====================================================================
# AMiLDA Software; uncomment these lines when cross-compiling;
# --------------------------------------------------------------------

# CROSS=/export/tools/mipsel-linux-uclibc/bin/mipsel-uclibc-
# CROSS_LINUX=/export/tools/bin/mipsel-linux-

# ====================================================================
# toolchain;
# --------------------------------------------------------------------

CC=$(CROSS)gcc
STRIP=$(CROSS)strip
LD=$(CROSS)ld
AR=$(CROSS)ar
RANLIB=$(CROSS)ranlib
CAS=$(CROSS)gcc -c
CPP=$(CROSS)gcc -E

# ====================================================================
# folders;
# --------------------------------------------------------------------

BIN=/usr/local/bin
MAN=/usr/share/man/man7
WWW=/home/www
DOC=/home/www/software/plc-utils/

# ====================================================================
# permissions;
# --------------------------------------------------------------------

OWNER=0
GROUP=0


Developers are encouraged to make changes in this file rather than adding additional variables to the lower-level makefiles. For example, you can edit variable BIN to install toolkit programs in some location other than /usr/local/bin or variable WWW to install HTML documentation on your local website.