Skip to content

Commit

Permalink
Add and use WITH_{DBG,PIC}_RUNTIME in runtime/Makefile
Browse files Browse the repository at this point in the history
On Win32/Win64 platforms, set `WITH_PIC_RUNTIME` to false to avoid
redundantly building `%-pic.a` libraries that are identical to `%.a`
libraries.

Setting `WITH_DBG_RUNTIME` to false avoids building debugging
libraries.
  • Loading branch information
MatthewFluet committed Jan 17, 2020
1 parent 7e0a65e commit 18c6f0c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ GCC_VERSION := $(GCC_MAJOR_VERSION).$(GCC_MINOR_VERSION)

EXE :=

WITH_DBG_RUNTIME := true
WITH_PIC_RUNTIME := true

# These flags can be overridden by the user
CCFLAGS :=
MFLAGS :=
Expand All @@ -41,7 +44,7 @@ XCPPFLAGS :=
XCFLAGS := -fno-common -pedantic -Wall -Wextra
OPTXCFLAGS := -Wdisabled-optimization -O2
DBGXCFLAGS := -DASSERT=1 -Wno-uninitialized -O0 -g
PICXCFLAGS :=
PICXCFLAGS := -fPIC
XLDFLAGS :=

ifneq ($(WITH_GMP_INC_DIR),)
Expand All @@ -51,8 +54,8 @@ endif
XCPPFLAGS += -I. -Iplatform

# Win32&64 don't use PIC code, all other platforms do
ifeq ($(findstring $(TARGET_OS), mingw cygwin),)
PICXCFLAGS += -fPIC
ifeq ($(findstring $(TARGET_OS), mingw cygwin),$(TARGET_OS))
WITH_PIC_RUNTIME := false
endif

# Make mlton library symbols private (win32&64 use another technique)
Expand Down Expand Up @@ -151,9 +154,14 @@ endef

### all ###

ALL := libgdtoa.a libgdtoa-dbg.a libgdtoa-pic.a libgdtoa-dbg-pic.a \
libmlton.a libmlton-dbg.a libmlton-pic.a libmlton-dbg-pic.a
ALL += gen/c-types.sml gen/basis-ffi.sml gen/sizes
LIBS := libgdtoa.a libmlton.a
ifeq ($(WITH_DBG_RUNTIME),true)
LIBS += $(patsubst %.a,%-dbg.a,$(LIBS))
endif
ifeq ($(WITH_PIC_RUNTIME),true)
LIBS += $(patsubst %.a,%-pic.a,$(LIBS))
endif
ALL += $(LIBS) gen/c-types.sml gen/basis-ffi.sml gen/sizes

.PHONY: all
all: $(ALL)
Expand Down Expand Up @@ -227,7 +235,6 @@ libgdtoa-dbg.a: $(patsubst %.o,%-dbg.o,$(GDTOA_OBJS))
libgdtoa-pic.a: $(patsubst %.o,%-pic.o,$(GDTOA_OBJS))
libgdtoa-dbg-pic.a: $(patsubst %.o,%-dbg-pic.o,$(GDTOA_OBJS))


gdtoa/gdtoa.h $(GDTOACFILES): gdtoa/README
@touch $@

Expand Down Expand Up @@ -293,7 +300,9 @@ endif

######

SHOW_VARS += TARGET TARGET_ARCH TARGET_OS GCC_VERSION XCCFLAGS XMFLAGS XCPPFLAGS XCFLAGS OPTXCFLAGS DBGXCFLAGS PICXCFLAGS
SHOW_VARS += TARGET TARGET_ARCH TARGET_OS GCC_VERSION
SHOW_VARS += XCCFLAGS XMFLAGS XCPPFLAGS XCFLAGS OPTXCFLAGS DBGXCFLAGS PICXCFLAGS XLDFLAGS
SHOW_VARS += LIBS

$(eval $(MK_SHOW_CONFIG))

Expand Down

0 comments on commit 18c6f0c

Please sign in to comment.