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
14 changes: 9 additions & 5 deletions circleci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,20 @@ coverage() {

# build dmd, druntime, and phobos
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD all
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD dmd.conf
make -j$N -C ../druntime -f posix.mak MODEL=$MODEL
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL

# rebuild dmd with coverage enabled
# use the just build dmd as host compiler this time
mv src/dmd src/host_dmd
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=./host_dmd clean
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=./host_dmd dmd.conf
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=./host_dmd ENABLE_COVERAGE=1
local build_path=generated/linux/release/$MODEL
# `generated` gets cleaned in the next step, so we create another _generated
# The nested folder hierarchy is needed to conform to those specified in
# the generate dmd.conf
mkdir -p _${build_path}
cp $build_path/dmd _${build_path}/host_dmd
cp $build_path/dmd.conf _${build_path}
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd clean
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd ENABLE_COVERAGE=1

make -j$N -C test MODEL=$MODEL ARGS="-O -inline -release" DMD_TEST_COVERAGE=1
}
Expand Down
43 changes: 28 additions & 15 deletions src/posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ $G/backend.a: $(G_OBJS)
$G/dmd_frontend: $(FRONT_SRCS) $D/gluelayer.d $(ROOT_SRCS) $G/newdelete.o $(STRING_IMPORT_FILES) $(HOST_DMD_PATH)
CC=$(HOST_CXX) $(HOST_DMD_RUN) -of$@ $(MODEL_FLAG) -vtls -J$G -J../res -L-lstdc++ $(DFLAGS) $(filter-out $(STRING_IMPORT_FILES) $(HOST_DMD_PATH),$^) -version=NoBackend

dmd: $G/dmd
dmd: $G/dmd $G/dmd.conf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be the biggest proposed change but I couldn't see any reason why we shouldn't auto-generate the dmd.conf into generated during a normal build.

Copy link
Member

Choose a reason for hiding this comment

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

Yes it should, but it also needs to be copied to src/dmd.conf while we're still using that.
Also the target for make -C src -f posix.mak dmd.conf (src/posix.mak) is used in many places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it should, but it also needs to be copied to src/dmd.conf while we're still using that.

Well, we can't copy it because the relative paths are different, but I put the "old" dmd.conf target back in.
Once @RazvanN7 does the ddmd -> dmd transition, he should be able to remove this legacy target :)

Also the target for make -C src -f posix.mak dmd.conf (src/posix.mak) is used in many places.

Yup I noticed - the Travis and CircleCi scripts have this behavior.

Copy link
Member

Choose a reason for hiding this comment

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

One reason this wasn't done previously is that a dmd.conf in the current working dir applies to any dmd being run, it has the highest precedence in the config search order. Super-annoying IMO, but I won't argue any more.
Since we've switched to explicit -conf= it shouldn't cause much troubles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cp $< .

ifdef ENABLE_LTO
Expand Down Expand Up @@ -385,26 +385,45 @@ endif

define DEFAULT_DMD_CONF
[Environment32]
DFLAGS=-I%@P%/../../../../../druntime/import -I%@P%/../../../../../phobos -L-L%@P%/../../../../../phobos/generated/$(OS)/release/32$(if $(filter $(OS),osx),, -L--export-dynamic)

[Environment64]
DFLAGS=-I%@P%/../../../../../druntime/import -I%@P%/../../../../../phobos -L-L%@P%/../../../../../phobos/generated/$(OS)/release/64$(if $(filter $(OS),osx),, -L--export-dynamic)
endef

export DEFAULT_DMD_CONF

$G/dmd.conf:
[ -f $@ ] || echo "$$DEFAULT_DMD_CONF" > $@

######## generate a default dmd.conf (for compatibility)
######## REMOVE ME after the ddmd -> dmd transition

define DEFAULT_DMD_CONF_LEGACY
[Environment32]
DFLAGS=-I%@P%/../../druntime/import -I%@P%/../../phobos -L-L%@P%/../../phobos/generated/$(OS)/release/32$(if $(filter $(OS),osx),, -L--export-dynamic)

[Environment64]
DFLAGS=-I%@P%/../../druntime/import -I%@P%/../../phobos -L-L%@P%/../../phobos/generated/$(OS)/release/64$(if $(filter $(OS),osx),, -L--export-dynamic)
endef

export DEFAULT_DMD_CONF
export DEFAULT_DMD_CONF_LEGACY

dmd.conf:
[ -f $@ ] || echo "$$DEFAULT_DMD_CONF" > $@
[ -f $@ ] || echo "$$DEFAULT_DMD_CONF_LEGACY" > $@

######## optabgen generates some source
optabgen_output = debtab.c optab.c cdxxx.c elxxx.c fltables.c tytab.c

$G/optabgen: $C/optabgen.c $C/cc.h $C/oper.h
$(HOST_CXX) $(CXXFLAGS) -I$(TK) $< -o $G/optabgen
$G/optabgen
mv $(optabgen_output) $G

optabgen_output = debtab.c optab.c cdxxx.c elxxx.c fltables.c tytab.c
$(optabgen_output) : $G/optabgen
optabgen_files = $(addprefix $G/, $(optabgen_output))
$(optabgen_files): optabgen.out
.INTERMEDIATE: optabgen.out
optabgen.out : $G/optabgen

######## idgen generates some source

Expand Down Expand Up @@ -438,11 +457,6 @@ $(shell test $(SYSCONFDIR) != "`cat $G/SYSCONFDIR.imp 2> /dev/null`" \
&& printf '$(SYSCONFDIR)' > $G/SYSCONFDIR.imp )

#########

$(G_GLUE_OBJS) : $(idgen_output)
$(G_OBJS) : $(optabgen_output)


# Specific dependencies other than the source file for all objects
########################################################################
# If additional flags are needed for a specific file add a _CXXFLAGS as a
Expand All @@ -467,21 +481,20 @@ var.o: $G/optab.c $G/tytab.c
# matching below.
#vpath %.c $(C)

$(G_OBJS): $G/%.o: $C/%.c posix.mak
-include $(DEPS)

$(G_OBJS): $G/%.o: $C/%.c posix.mak $(optabgen_files)
@echo " (CC) BACK_OBJS $<"
$(CXX) -c -o$@ $(CXXFLAGS) $(BACK_FLAGS) $(MMD) $<

$(G_GLUE_OBJS): $G/%.o: $D/%.c posix.mak
$(G_GLUE_OBJS): $G/%.o: $D/%.c posix.mak $(optabgen_files)
@echo " (CC) GLUE_OBJS $<"
$(CXX) -c -o$@ $(CXXFLAGS) $(GLUE_FLAGS) $(MMD) $<

$G/newdelete.o: $G/%.o: $(ROOT)/%.c posix.mak
@echo " (CC) ROOT_OBJS $<"
$(CXX) -c -o$@ $(CXXFLAGS) $(ROOT_FLAGS) $(MMD) $<


-include $(DEPS)

######################################################

install: all
Expand Down
2 changes: 0 additions & 2 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ clone() {
# build dmd, druntime, phobos
build() {
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD ENABLE_RELEASE=1 all
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD dmd.conf
make -j$N -C ../druntime -f posix.mak MODEL=$MODEL
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL
}
Expand All @@ -44,7 +43,6 @@ build() {
rebuild() {
mv src/dmd src/host_dmd
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=./host_dmd clean
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=./host_dmd dmd.conf
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=./host_dmd ENABLE_RELEASE=1 all
}

Expand Down