Skip to content

Commit

Permalink
make: export some vars for loader sub-project
Browse files Browse the repository at this point in the history
This allows to correctly pass variables passed to top-level make, like

make CC=$CC CXX=$CXX

If loader includes clang.mak on its own, then they are replaced
with default values, which is not desirable.
  • Loading branch information
stsp committed Dec 22, 2024
1 parent ea73223 commit 66dc4f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fdpp/clang.mak
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ endif
NASM ?= nasm-segelf
PKG_CONFIG ?= pkg-config

# export vars needed for loader sub-project
export CC
export CC_FOR_BUILD
export CC_LD
export PKG_CONFIG

TARGETOPT = -std=c++20 -c -fno-threadsafe-statics -fpic \
-DCLANG_VER=$(CLANG_VER)
# _XTRA should go at the end of cmd line
Expand Down
3 changes: 3 additions & 0 deletions fdpp/loader/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ T = ..
-include $(T)/local.mak
srcdir ?= $(CURDIR)

# if exported from top-level project, then don't include defaults
ifeq ($(PKG_CONFIG),)
include $(srcdir)/$(T)/clang.mak
include $(srcdir)/$(T)/defs.mak
endif

TOP = $(abspath $(srcdir)/$(T)/..)
HDR = $(TOP)/hdr
Expand Down
3 changes: 3 additions & 0 deletions fdpp/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ ALL = $(FDPPLIB) $(FDPPDEVL) $(LDRLIB) $(LDRDEVL) $(TARGET).elf $(TARGET).map \

all: $(ALL)

export CFLAGS
export LDFLAGS

# New makes have a way to avoid parallel invocation with the use of &:
# On old make you would write "%.elf %.map :" which is a bit silly
# given the names are fixed. Also $(TARGET).% won't work that way at all:
Expand Down

0 comments on commit 66dc4f4

Please sign in to comment.