From 895fbbadeacf40ef5a34184ee80594c1b23a5d18 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Mon, 8 Jan 2018 13:17:23 +0100 Subject: [PATCH 1/4] Document Makefile targets --- src/posix.mak | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/posix.mak b/src/posix.mak index 99d297e8d2cd..1654f1be88e2 100644 --- a/src/posix.mak +++ b/src/posix.mak @@ -25,6 +25,20 @@ # ENABLE_PROFILE: Build dmd with a profiling recorder (D) # ENABLE_COVERAGE Build dmd with coverage counting # ENABLE_SANITIZERS Build dmd with sanitizer (e.g. ENABLE_SANITIZERS=address,undefined) +# +# Targets +# ------- +# +# all Build dmd +# unittest Run all unittest blocks +# cxx-unittest Check conformance of the C++ headers +# build-examples Build DMD as library examples +# clean Remove all generated files +# man Generate the man pages +# checkwhitespace Checks for trailing whitespace and tabs +# zip Packs all sources into a ZIP archive +# gitzip Packs all sources into a ZIP archive +# install Installs dmd into $(INSTALL_DIR) ################################################################################ # get OS and MODEL From cee08de5a2003a6dc57c62ddcf030bea8aee1bc2 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Mon, 8 Jan 2018 13:18:03 +0100 Subject: [PATCH 2/4] Build MAN pages to generated --- docs/Makefile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 0504d941eed0..b9bfea51c3cd 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,23 +1,39 @@ -MAN_PAGE=man/man1/dmd.1 DMD=dmd DMD_ROOT=.. -G=$(DMD_ROOT)/generated +GENERATED=$(DMD_ROOT)/generated +G=$(DMD_ROOT)/generated/docs +DMD_MAN_PAGE=man/man1/dmd.1 +OTHER_MAN_PAGES=$(addprefix man/, \ + $(addprefix man1/, dumpobj.1 obj2asm.1) \ + man5/dmd.conf.5 \ +) + +include ../src/osmodel.mak + +BUILD=release +G_BIN=$(GENERATED)/$(OS)/$(BUILD)/$(MODEL) ################################################################################ # Main targets ################################################################################ -build: $(MAN_PAGE) +build: $(addprefix $G/, $(DMD_MAN_PAGE) $(OTHER_MAN_PAGES)) preview: - man -l $(MAN_PAGE) + man -l $G/$(DMD_MAN_PAGE) ################################################################################ # Actual compilation commands ################################################################################ -$(MAN_PAGE): $G/gen_man +$G/$(DMD_MAN_PAGE): $(G_BIN)/gen_man + @mkdir -p $(dir $@) $< > $@ -$G/gen_man: gen_man.d $(DMD_ROOT)/src/dmd/cli.d +$(G_BIN)/gen_man: gen_man.d $(DMD_ROOT)/src/dmd/cli.d + @mkdir -p $(dir $@) $(DMD) -I$(DMD_ROOT)/src -of$@ $^ + +$G/%: % + @mkdir -p $(dir $@) + cp $< $@ From 559421c5f354a82cf942dcbed08de7615fa4e04d Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Mon, 8 Jan 2018 13:19:24 +0100 Subject: [PATCH 3/4] Add 'man' target (builds the MAN pages) --- src/posix.mak | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/posix.mak b/src/posix.mak index 1654f1be88e2..276ac94ac0de 100644 --- a/src/posix.mak +++ b/src/posix.mak @@ -548,9 +548,20 @@ $G/newdelete.o: $G/%.o: $(ROOT)/%.c $(SRC_MAKE) @echo " (CC) ROOT_OBJS $<" $(CXX) -c -o$@ $(CXXFLAGS) $(ROOT_FLAGS) $(MMD) $< +################################################################################ +# Generate the man pages +################################################################################ + +DMD_MAN_PAGE = $(GENERATED)/docs/man1/dmd.1 + +$(DMD_MAN_PAGE): dmd/cli.d + ${MAKE} -C ../docs DMD=$(HOST_DMD_PATH) build + +man: $(DMD_MAN_PAGE) + ###################################################### -install: all +install: all $(DMD_MAN_PAGE) $(eval bin_dir=$(if $(filter $(OS),osx), bin, bin$(MODEL))) mkdir -p $(INSTALL_DIR)/$(OS)/$(bin_dir) cp $G/dmd $(INSTALL_DIR)/$(OS)/$(bin_dir)/dmd From efd1bec0c8fbf48775528d28457a8e1e67458d1c Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Tue, 9 Jan 2018 05:58:40 +0100 Subject: [PATCH 4/4] Be aware of DIFFABLE -> use a static timestamp for DAutoTest --- docs/Makefile | 3 +++ docs/gen_man.d | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/docs/Makefile b/docs/Makefile index b9bfea51c3cd..ccd872a0e576 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -13,6 +13,9 @@ include ../src/osmodel.mak BUILD=release G_BIN=$(GENERATED)/$(OS)/$(BUILD)/$(MODEL) +# Removes inclusion of all dynamic content and timestamps +export DIFFABLE + ################################################################################ # Main targets ################################################################################ diff --git a/docs/gen_man.d b/docs/gen_man.d index 94c436937c8d..1e5a3620bc14 100644 --- a/docs/gen_man.d +++ b/docs/gen_man.d @@ -79,9 +79,14 @@ string bold(string w) void main() { import std.algorithm, std.array, std.conv, std.datetime, std.range, std.stdio, std.uni; + import std.process : environment; import dmd.cli; auto now = Clock.currTime; + auto diffable = environment.get("DIFFABLE", "0"); + if (diffable == "1") + now = SysTime(DateTime(2018, 01, 01)); + writefln(header, now.toISOExtString.take(10)); foreach (option; Usage.options)