134
134
# before actually running Ddoc.
135
135
# Currently this is used for:
136
136
# - TOC
137
+ # - dynamic TOC generation
138
+ # - GRAMMAR overview generation
139
+ # - CHANGELOG menu generation
137
140
# - assert -> writeln magic
138
141
PWD =$(shell pwd)
139
142
MAKEFILE =$(firstword $(MAKEFILE_LIST ) )
@@ -282,7 +285,7 @@ DDOC_VARS_PRERELEASE_VERBATIM=$(DDOC_VARS_PRERELEASE) \
282
285
# Ddoc binaries
283
286
# ###############################################################################
284
287
285
- DDOC_BIN: =$G/ddoc
288
+ DDOC_BIN: =$G/ddoc_preprocessor
286
289
287
290
# ###############################################################################
288
291
# Resources
@@ -669,23 +672,24 @@ $W/phobos-prerelease/object.verbatim : $(DMD) $G/changelog/next-version
669
672
# ###############################################################################
670
673
671
674
.PHONY : phobos-prerelease
672
- phobos-prerelease : ${PHOBOS_FILES} druntime-target $(STD_DDOC_PRERELEASE ) $(DDOC_BIN ) $(DMD )
675
+ phobos-prerelease : ${PHOBOS_FILES} druntime-target $(STD_DDOC_PRERELEASE ) $(DDOC_BIN ) $(DMD ) \
676
+ $G /changelog/next-version
673
677
$(MAKE ) --directory=$(PHOBOS_DIR ) -f posix.mak html $(DDOC_VARS_PRERELEASE_HTML ) \
674
- DMD=" $( abspath $( DDOC_BIN) ) --compiler=$( DMD) "
678
+ DMD=" $( abspath $( DDOC_BIN) ) --compiler=$( abspath $( DMD) ) "
675
679
676
680
phobos-release : ${PHOBOS_FILES} druntime-target $(STD_DDOC_RELEASE ) $(DDOC_BIN ) $(DMD )
677
681
$(MAKE ) --directory=$(PHOBOS_DIR ) -f posix.mak html $(DDOC_VARS_RELEASE_HTML ) \
678
- DMD=" $( abspath $( DDOC_BIN) ) --compiler=$( DMD) "
682
+ DMD=" $( abspath $( DDOC_BIN) ) --compiler=$( abspath $( DMD) ) "
679
683
680
- phobos-latest : ${PHOBOS_LATEST_FILES} druntime-latest-target $(STD_DDOC_LATEST ) $(DDOC_BIN ) $(DMD )
684
+ phobos-latest : ${PHOBOS_LATEST_FILES} druntime-latest-target $(STD_DDOC_LATEST ) $(DDOC_BIN ) $(DMD_LATEST )
681
685
$(MAKE ) --directory=$(PHOBOS_LATEST_DIR ) -f posix.mak html $(DDOC_VARS_LATEST_HTML ) \
682
- DMD=" $( abspath $( DDOC_BIN) ) --compiler=$( DMD ) "
686
+ DMD=" $( abspath $( DDOC_BIN) ) --compiler=$( abspath $( DMD_LATEST ) ) "
683
687
684
688
phobos-prerelease-verbatim : ${PHOBOS_FILES} druntime-target \
685
689
$W /phobos-prerelease/index.verbatim
686
690
$W/phobos-prerelease/index.verbatim : verbatim.ddoc \
687
691
$W /phobos-prerelease/object.verbatim \
688
- $W /phobos-prerelease/mars.verbatim $G /changelog/next-version
692
+ $W /phobos-prerelease/mars.verbatim $G /changelog/next-version $( DMD )
689
693
${MAKE} --directory=${PHOBOS_DIR} -f posix.mak html $(DDOC_VARS_PRERELEASE_VERBATIM ) \
690
694
DOC_OUTPUT_DIR=$W /phobos-prerelease-verbatim
691
695
$(call CHANGE_SUFFIX,html,verbatim,$W/phobos-prerelease-verbatim)
@@ -838,7 +842,7 @@ test_dspec: dspec_tester.d $(DMD) $(PHOBOS_LIB)
838
842
@echo " Test the D Language specification"
839
843
$(DMD ) -run $< --compiler=$(DMD )
840
844
841
- test : $( ASSERT_WRITELN_BIN ) _test test_dspec test/next_version.sh all
845
+ test : test_dspec test/next_version.sh all
842
846
@echo " Searching for trailing whitespace"
843
847
@grep -n ' [[:blank:]]$$' $$(find . -type f -name "*.dd" | grep -v .generated ) ; test $$? -eq 1
844
848
@echo " Searching for tabs"
@@ -847,8 +851,8 @@ test: $(ASSERT_WRITELN_BIN)_test test_dspec test/next_version.sh all
847
851
@grep -n " UNDEFINED MACRO" $$(find $W -type f -name "*.html" -not -path "$W/phobos/*" ) ; test $$? -eq 1
848
852
@echo " Searching for undefined ddoc"
849
853
@grep -rn ' [$$](' $$(find $W/phobos-prerelease -type f -name "*.html" ) ; test $$? -eq 1
850
- @echo " Executing assert_writeln_magic tests"
851
- $<
854
+ @echo " Executing ddoc_preprocessor tests"
855
+ dub -C ddoc test
852
856
@echo " Executing next_version tests"
853
857
test/next_version.sh
854
858
@@ -933,22 +937,12 @@ $G/contributors_list.ddoc: | $(STABLE_RDMD) $(TOOLS_DIR) $(INSTALLER_DIR)
933
937
# Custom DDoc wrapper
934
938
# ------------------
935
939
#
936
- # This allows extending Ddoc files dynamically on-the-fly.
937
- # It is currently only used for the specification pages
938
- #
939
- # It does:
940
- # - dynamic TOC generation
941
- # - GRAMMAR overview generation
942
- # - CHANGELOG menu generation
943
- # - Assert -> writeln magic (https://dlang.org/blog/2017/03/08/editable-and-runnable-doc-examples-on-dlang-org)
944
- # - This transforms assert(a == b) to writeln(a); // b
945
- # - It creates a copy of Phobos to apply the transformations
946
- # - All "d" files are piped through the transformator,
947
- # other needed files (e.g. posix.mak) get copied over
940
+ # This allows extending Ddoc files and D source code files dynamically on-the-fly.
948
941
# ###############################################################################
949
942
950
- $(DDOC_BIN ) : ddoc_preprocessor.d | $(STABLE_DMD )
951
- $(STABLE_DMD ) -g -of$@ $<
943
+ $(DDOC_BIN ) : ddoc/source/preprocessor.d ddoc/source/assert_writeln_magic.d | $(STABLE_DMD )
944
+ $(STABLE_DMD_BIN_ROOT ) /dub build --compiler=$(STABLE_DMD ) --root=ddoc && \
945
+ mv ddoc/ddoc_preprocessor $@
952
946
953
947
# ###############################################################################
954
948
# Build and render the DMD man page
0 commit comments