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

Split RTS into multiple files #589

Merged
merged 6 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 9 additions & 4 deletions rts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,22 @@ _build/native/tommath_%.o: $(TOMMATHSRC)/bn_%.c | _build/native
# Our part of the RTS, Wasm and native
#

_build/wasm/rts.o: rts.c | _build/wasm
RTSFILES=rts idl bigint

_build/wasm/%.o: %.c | _build/wasm
$(WASM_CLANG) -c $(CLANG_FLAGS) $(WASM_FLAGS) $(TOMMATH_FLAGS) -I$(TOMMATHSRC) --std=c11 $< --output $@

_build/native/rts.o: rts.c | _build/native
_build/native/%.o: %.c | _build/native
$(CLANG) -c $(CLANG_FLAGS) $(TOMMATH_FLAGS) -I$(TOMMATHSRC) --std=c11 $< --output $@

RTS_WASM_O=$(patsubst %,_build/wasm/%.o,$(RTSFILES))
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume you know the shorthand $(var:pattern=replacement) syntax. These are nice candidates.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In Makefiles? (The syntax you write I only know from bash…)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@ggreif ggreif Jul 22, 2019

Choose a reason for hiding this comment

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

nomeata marked this conversation as resolved.
Show resolved Hide resolved
RTS_NATIVE_O=$(patsubst %,_build/native/%.o,$(RTSFILES))
nomeata marked this conversation as resolved.
Show resolved Hide resolved

#
# The actual RTS, a we ship it with the compiler
#

as-rts.wasm: _build/wasm/rts.o $(TOMMATH_WASM_O)
as-rts.wasm: $(RTS_WASM_O) $(TOMMATH_WASM_O)
$(WASM_LD) -o $@ \
--import-memory --shared --no-entry --gc-sections \
--export=__wasm_call_ctors \
Expand All @@ -98,7 +103,7 @@ as-rts.wasm: _build/wasm/rts.o $(TOMMATH_WASM_O)
# A simple program to do simple tests of rts.c, using native compilation
#

test_rts: test_rts.c _build/native/rts.o $(TOMMATH_NATIVE_O)
test_rts: test_rts.c $(RTS_NATIVE_O) $(TOMMATH_NATIVE_O)
nomeata marked this conversation as resolved.
Show resolved Hide resolved
$(CLANG) -o $@ \
$+
clean:
Expand Down
Loading