diff --git a/mk/rt.mk b/mk/rt.mk index d8490230675..a7f09e63ce0 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -92,14 +92,7 @@ RUNTIME_CXXS_$(1)_$(2) := \ rt/rust_android_dummy.cpp \ rt/rust_test_helpers.cpp -RUNTIME_CS_$(1)_$(2) := rt/sundown/src/autolink.c \ - rt/sundown/src/buffer.c \ - rt/sundown/src/stack.c \ - rt/sundown/src/markdown.c \ - rt/sundown/html/houdini_href_e.c \ - rt/sundown/html/houdini_html_e.c \ - rt/sundown/html/html_smartypants.c \ - rt/sundown/html/html.c +RUNTIME_CS_$(1)_$(2) := RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \ rt/arch/$$(HOST_$(1))/record_sp.S @@ -109,8 +102,6 @@ RT_BUILD_DIR_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/stage$(2) RUNTIME_DEF_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/rustrt$$(CFG_DEF_SUFFIX_$(1)) RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \ -I $$(S)src/rt/arch/$$(HOST_$(1)) \ - -I $$(S)src/rt/sundown/src \ - -I $$(S)src/rt/sundown/html \ -I $$(S)src/libuv/include RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \ $$(RUNTIME_CS_$(1)_$(2):rt/%.c=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \ @@ -242,6 +233,33 @@ $$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) NO_LOAD="$$(LIBUV_NO_LOAD)" \ V=$$(VERBOSE) endif + +SUNDOWN_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),sundown) +SUNDOWN_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/sundown +SUNDOWN_LIB_$(1) := $$(SUNDOWN_DIR_$(1))/$$(SUNDOWN_NAME_$(1)) + +SUNDOWN_CS_$(1) := rt/sundown/src/autolink.c \ + rt/sundown/src/buffer.c \ + rt/sundown/src/stack.c \ + rt/sundown/src/markdown.c \ + rt/sundown/html/houdini_href_e.c \ + rt/sundown/html/houdini_html_e.c \ + rt/sundown/html/html_smartypants.c \ + rt/sundown/html/html.c + +SUNDOWN_OBJS_$(1) := $$(SUNDOWN_CS_$(1):rt/%.c=$$(SUNDOWN_DIR_$(1))/%.o) + +$$(SUNDOWN_DIR_$(1))/%.o: rt/%.c + @$$(call E, compile: $$@) + @mkdir -p $$(@D) + $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \ + -I $$(S)src/rt/sundown/src -I $$(S)src/rt/sundown/html \ + $$(RUNTIME_CFLAGS_$(1))) $$< + +$$(SUNDOWN_LIB_$(1)): $$(SUNDOWN_OBJS_$(1)) + @$$(call E, link: $$@) + $$(Q)$$(AR_$(1)) rcs $$@ $$^ + endef # Instantiate template for all stages/targets diff --git a/mk/tools.mk b/mk/tools.mk index ed4ae10e3e2..fb2e0b6367c 100644 --- a/mk/tools.mk +++ b/mk/tools.mk @@ -57,10 +57,12 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \ $$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \ $$(SREQ$(1)_T_$(4)_H_$(3)) \ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \ + $$(SUNDOWN_LIB_$(4)) \ | $$(TLIB$(1)_T_$(4)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@ + $$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) \ + -L $$(SUNDOWN_DIR_$(4)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@)) $$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \ diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index f4a61e87993..fbe7a965615 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -69,6 +69,7 @@ struct buf { } // sundown FFI +#[link_args = "-lsundown"] extern { fn sdhtml_renderer(callbacks: *sd_callbacks, options_ptr: *html_renderopt, diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 60e4d3abd7a..01b3c97aa1c 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -183,12 +183,6 @@ rust_uv_pipe_init rust_uv_signal_init rust_uv_signal_start rust_uv_signal_stop -sdhtml_renderer -sd_markdown_new -sd_markdown_render -sd_markdown_free -bufrelease -bufnew rust_take_dlerror_lock rust_drop_dlerror_lock rust_uv_pipe_open