Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TGT_CC and TGT_CXX #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions MANUAL
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,21 @@ TARGET_DIR

Default value: . (make's working directory; aka project root)

TGT_CC
------
Specifies the program to be used for compiling C sources. If this option is
not specified, CC is used.

TGT_CFLAGS
----------
Like SRC_CFLAGS, but applies to all sources belonging to the current target,
not just sources in the current submakefile.

TGT_CXX
-------
Specifies the program to be used for compiling C++ sources. If this option
is not specified, CXX is used.

TGT_CXXFLAGS
------------
Like SRC_CXXFLAGS, but applies to all sources belonging to the current
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ define INCLUDE_SUBMAKEFILE
# Initialize all variables that can be defined by a makefile fragment, then
# include the specified makefile fragment.
TARGET :=
TGT_CC :=
TGT_CFLAGS :=
TGT_CXX :=
TGT_CXXFLAGS :=
TGT_DEFS :=
TGT_INCDIRS :=
Expand Down Expand Up @@ -185,7 +187,9 @@ define INCLUDE_SUBMAKEFILE
# makefile apply to this new target. Initialize the target's variables.
TGT := $$(strip $${TARGET})
ALL_TGTS += $${TGT}
$${TGT}_CC := $${TGT_CC}
$${TGT}_CFLAGS := $${TGT_CFLAGS}
$${TGT}_CXX := $${TGT_CXX}
$${TGT}_CXXFLAGS := $${TGT_CXXFLAGS}
$${TGT}_DEFS := $${TGT_DEFS}
$${TGT}_DEPS :=
Expand Down Expand Up @@ -247,6 +251,8 @@ define INCLUDE_SUBMAKEFILE
# variables that were defined.
$${TGT}_OBJS += $${OBJS}
$${TGT}_DEPS += $${OBJS:%.o=%.P}
$${OBJS}: CC := $$(if $${$${TGT}_CC},$${$${TGT}_CC},$${CC})
$${OBJS}: CXX := $$(if $${$${TGT}_CXX},$${$${TGT}_CXX},$${CXX})
$${OBJS}: SRC_CFLAGS := $${$${TGT}_CFLAGS} $${SRC_CFLAGS}
$${OBJS}: SRC_CXXFLAGS := $${$${TGT}_CXXFLAGS} $${SRC_CXXFLAGS}
$${OBJS}: SRC_DEFS := $$(addprefix -D,$${$${TGT}_DEFS} $${SRC_DEFS})
Expand Down