Skip to content

Commit 8a22267

Browse files
committed
add SKIP_LIBRARY_LDFLAGS makefile option.
Used in KhiCAS.
1 parent 91ee5a1 commit 8a22267

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

docs/static/makefile-options.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ Extra libload (``.lib``) libraries to be added at link time.
194194
195195
EXTRA_LIBLOAD_LIBS = <space separated list of libraries>
196196
197+
.. rubric:: SKIP_LIBRARY_LDFLAGS
198+
199+
Completely omit the :code:`-library` flags passed to fasmg when linking.
200+
Default: :code:`NO`.
201+
202+
.. code-block:: makefile
203+
204+
SKIP_LIBRARY_LDFLAGS = YES
205+
197206
Extra command(s) to run when :code:`make clean` is executed.
198207

199208
.. code-block:: makefile

src/makefile.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ HAS_LIBCXX ?= YES
4747
ALLOCATOR ?= STANDARD
4848
PREFER_OS_CRT ?= NO
4949
PREFER_OS_LIBC ?= YES
50+
SKIP_LIBRARY_LDFLAGS ?= NO
5051
LIBLOAD_OPTIONAL ?=
5152
COMPRESSED_MODE ?= zx7
5253
COMMENT ?= $(shell cedev-config --comment)
@@ -169,6 +170,7 @@ LDFILES = $(LDCRT0) $(LINK_CSOURCES) $(LINK_CPPSOURCES) $(LINK_ASMSOURCES)
169170
DEPFILES = $(wildcard $(LINK_CSOURCES:%.src=%.d) $(LINK_CPPSOURCES:%.src=%.d))
170171
endif
171172

173+
ifneq ($(SKIP_LIBRARY_LDFLAGS),YES)
172174
# find all required/optional libload libraries
173175
LIBLOAD_LIBS ?= $(wildcard $(CEDEV_TOOLCHAIN)/lib/libload/*.lib) $(EXTRA_LIBLOAD_LIBS)
174176
LIBLOAD_LIBS := $(filter-out %libload.lib,$(LIBLOAD_LIBS))
@@ -179,6 +181,8 @@ OPT_LIBLOAD := $(call FASMG_LIB,$(OPT_LIBLOAD))
179181
OPT_LIBLOAD := $(foreach lib,$(OPT_LIBLOAD),$(lib)$(space)optional)
180182
LDLIBS := $(subst $(space),$(comma)$(space),$(strip $(REQ_LIBLOAD)$(space)$(OPT_LIBLOAD)))
181183
LDLIBS := $(subst $(comma)$(space)optional,$(space)optional,$(LDLIBS))
184+
LDLIBRARYFLAGS := -i $(call QUOTE_ARG,library $(LDLIBS))
185+
endif
182186

183187
# check if there is an icon present that to convert
184188
ifneq ($(ICONIMG),)
@@ -269,7 +273,7 @@ FASMGFLAGS = \
269273
-i $(call QUOTE_ARG,locate .header at $$$(INIT_LOC)) \
270274
$(LDMAPFLAG) \
271275
-i $(call QUOTE_ARG,source $(LDICON)$(call FASMG_FILES,$(LDFILES))) \
272-
-i $(call QUOTE_ARG,library $(LDLIBS)) \
276+
$(LDLIBRARYFLAGS) \
273277
$(EXTRA_LDFLAGS)
274278

275279
.PHONY: all clean version gfx debug

0 commit comments

Comments
 (0)