Skip to content
Merged
Show file tree
Hide file tree
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
31 changes: 25 additions & 6 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
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)

# Removes inclusion of all dynamic content and timestamps
export DIFFABLE

################################################################################
# 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 $< $@
5 changes: 5 additions & 0 deletions docs/gen_man.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 26 additions & 1 deletion src/posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -534,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
Expand Down