Skip to content

Commit

Permalink
Add HOSTCC configure variable for build host CC to facilitate cross-c…
Browse files Browse the repository at this point in the history
…ompiling.

Required to build man pages via ttman when CROSS is set to different architecture.

Signed-off-by: Sergey Kvachonok <[email protected]>
  • Loading branch information
ravenexp authored and flyingmutant committed Dec 4, 2010
1 parent 9ffc26b commit ae8c67d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ Optional Features: y/n
CONFIG_SUN Sun Audio [auto]
CONFIG_WAVEOUT Windows Wave Out [auto]
Also many standard variables like CC are recognized."
Also many standard variables like CC, LD, CFLAGS, LDFLAGS are recognized.
Cross compiling is supported via CROSS=target-prefix-
optionally set HOSTCC=this-machine-gcc, HOSTLD, HOST_CFLAGS, HOST_LDFLAGS."

parse_command_line "$@"

Expand All @@ -346,6 +348,7 @@ var_default mandir "${datadir}/man"
var_default exampledir "${datadir}/doc/cmus/examples"

check check_cc
check check_host_cc
check check_cflags
check check_cc_depgen
check check_endianness
Expand Down
13 changes: 13 additions & 0 deletions scripts/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,19 @@ check_cc()
return 0
}

# HOSTCC, HOSTLD, HOST_CFLAGS, HOST_LDFLAGS
check_host_cc()
{
var_default HOSTCC gcc
var_default HOSTLD $HOSTCC
var_default HOST_CFLAGS "-g -O2 -Wall"
var_default HOST_LDFLAGS ""
check_program $HOSTCC || return 1
makefile_vars HOSTCC HOSTLD HOST_CFLAGS HOST_LDFLAGS
__check_lang=c
return 0
}

# CXX, CXXLD, CXXFLAGS, CXXLDFLAGS, SOFLAGS, LDSOFLAGS, LDDLFLAGS
check_cxx()
{
Expand Down
8 changes: 8 additions & 0 deletions scripts/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ uninstall:
quiet_cmd_cc = CC $@
cmd_cc = $(CC) -c $(CFLAGS) -o $@ $<

# HOSTCC for program object files (.o)
quiet_cmd_hostcc = HOSTCC $@
cmd_hostcc = $(HOSTCC) -c $(HOST_CFLAGS) -o $@ $<

# CC for shared library and dynamically loadable module objects (.lo)
quiet_cmd_cc_lo = CC $@
cmd_cc_lo = $(CC) -c $(CFLAGS) $(SOFLAGS) -o $@ $<
Expand All @@ -93,6 +97,10 @@ quiet_cmd_cc_lo = CC $@
quiet_cmd_ld = LD $@
cmd_ld = $(LD) $(LDFLAGS) -o $@ $^ $(1)

# HOSTLD for programs, optional parameter: libraries
quiet_cmd_hostld = HOSTLD $@
cmd_hostld = $(HOSTLD) $(HOST_LDFLAGS) -o $@ $^ $(1)

# LD for shared libraries, optional parameter: libraries
quiet_cmd_ld_so = LD $@
cmd_ld_so = $(LD) $(LDSOFLAGS) $(LDFLAGS) -o $@ $^ $(1)
Expand Down

0 comments on commit ae8c67d

Please sign in to comment.