Skip to content
Merged
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CFLAGS := -g -O2 -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion
JAVA_WASM_CFLAGS := -g -Oz -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion -Wno-missing-braces -fPIC -fvisibility=hidden -Wimplicit-fallthrough $(JAVA_WASM_CFLAGS)
CC ?= cc
AR ?= ar
ARFLAGS ?= -r$(V0:1=v)
Comment on lines 16 to +18

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to #2716, the original ?=s were once a workaround for #2716.
That issue’s root cause’s separately fixed and 7c2461f purged its related extconf.rb code. Like this PR, I wonder if those lines are still necessary?

WASI_SDK_PATH := /opt/wasi-sdk

MAKEDIRS ?= mkdir -p
Expand All @@ -38,7 +39,7 @@ build/libprism.$(SOEXT): $(SHARED_OBJECTS)

build/libprism.a: $(STATIC_OBJECTS)
$(ECHO) "building $@ with $(AR)"
$(Q) $(AR) $(ARFLAGS) $@ $(STATIC_OBJECTS) $(Q1:0=>/dev/null)
$(Q) $(AR) $(ARFLAGS) $@ $(STATIC_OBJECTS)

@ParadoxV5 ParadoxV5 Apr 18, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick text find shows that this was the only recipe where Q1 is used, and the only other use of Q1 is

Q = $(Q1:0=@)
, which may now be flattenend.
(I’m a novice in C-land; if the entire set of Vs and Qs is a convention, introduce them to me.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this matter, ba82ce9 introduces an acutal use for V0:

prism/Makefile

Line 17 in ba82ce9

ARFLAGS ?= -r$(V0:1=v)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing to Null has always been questionable as we could simply not supply -v to ar.
As stated in OP, this workaround exists because ARFLAGS defaults to -rv, unless forcefully replaced.

Alternate approaches include:

  • use RbConfig::CONFIG for those (i.e., all rbconfig.rb cases) as well
    • tricking create_makefile also counts
  • Do those still need a separate .a and ar steps?
    Most C projects (mkmf or not) builds .cs to .os and .os to .so/.dll; there’s no .a step after .os.


javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS)
$(ECHO) "building $@"
Expand Down
Loading