Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 8909127

Browse files
author
The Dlang Bot
authored
Merge pull request #1994 from wilzbach/debug-dmd
Allow to use a debug DMD executable merged-on-behalf-of: Andrei Alexandrescu <[email protected]>
2 parents ff04e96 + 87e689e commit 8909127

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

posix.mak

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ifneq ($(BUILD),release)
2323
endif
2424
endif
2525

26-
DMD=$(DMD_DIR)/generated/$(OS)/release/$(MODEL)/dmd
26+
DMD=$(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd
2727
INSTALL_DIR=../install
2828

2929
DOCDIR=doc
@@ -146,30 +146,32 @@ endif
146146

147147
doc: $(DOCS)
148148

149-
$(DOCDIR)/object.html : src/object.d
149+
$(DOCDIR)/object.html : src/object.d $(DMD)
150150
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<
151151

152-
$(DOCDIR)/core_%.html : src/core/%.d
152+
$(DOCDIR)/core_%.html : src/core/%.d $(DMD)
153153
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<
154154

155-
$(DOCDIR)/core_stdc_%.html : src/core/stdc/%.d
155+
$(DOCDIR)/core_stdc_%.html : src/core/stdc/%.d $(DMD)
156156
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<
157157

158-
$(DOCDIR)/core_stdcpp_%.html : src/core/stdcpp/%.d
158+
$(DOCDIR)/core_stdcpp_%.html : src/core/stdcpp/%.d $(DMD)
159159
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<
160160

161-
$(DOCDIR)/core_sync_%.html : src/core/sync/%.d
161+
$(DOCDIR)/core_sync_%.html : src/core/sync/%.d $(DMD)
162162
$(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $<
163163

164-
changelog.html: changelog.dd
164+
changelog.html: changelog.dd $(DMD)
165165
$(DMD) -Df$@ $<
166166

167167
######################## Header .di file generation ##############################
168168

169169
import: $(IMPORTS)
170170

171-
$(IMPDIR)/core/sync/%.di : src/core/sync/%.d
171+
$(IMPDIR)/core/sync/%.di : src/core/sync/%.d $(DMD)
172172
@mkdir -p $(dir $@)
173+
echo $(BUILD)
174+
echo $(DMD)
173175
$(DMD) -conf= -c -o- -Isrc -Iimport -Hf$@ $<
174176

175177
######################## Header .di file copy ##############################
@@ -189,6 +191,11 @@ $(IMPDIR)/%.d : src/%.d
189191
@mkdir -p $(dir $@)
190192
cp $< $@
191193

194+
######################## Build DMD if non-existent ##############################
195+
196+
$(DMD):
197+
make -C $(DMD_DIR)/src -f posix.mak BUILD=$(BUILD) OS=$(OS) MODEL=$(MODEL)
198+
192199
################### C/ASM Targets ############################
193200

194201
$(ROOT)/%.o : src/rt/%.c
@@ -208,16 +215,16 @@ $(ROOT)/threadasm.o : src/core/threadasm.S
208215
$(DRUNTIMESO) $(DRUNTIMESOLIB) dll: DFLAGS+=-version=Shared -fPIC
209216
dll: $(DRUNTIMESOLIB)
210217

211-
$(DRUNTIMESO): $(OBJS) $(SRCS)
218+
$(DRUNTIMESO): $(OBJS) $(SRCS) $(DMD)
212219
$(DMD) -shared -debuglib= -defaultlib= -of$(DRUNTIMESO) $(DFLAGS) $(SRCS) $(OBJS) $(LINKDL)
213220

214-
$(DRUNTIMESOLIB): $(OBJS) $(SRCS)
221+
$(DRUNTIMESOLIB): $(OBJS) $(SRCS) $(DMD)
215222
$(DMD) -c -fPIC -of$(DRUNTIMESOOBJ) $(DFLAGS) $(SRCS)
216223
$(DMD) -conf= -lib -of$(DRUNTIMESOLIB) $(DRUNTIMESOOBJ) $(OBJS)
217224

218225
################### Library generation #########################
219226

220-
$(DRUNTIME): $(OBJS) $(SRCS)
227+
$(DRUNTIME): $(OBJS) $(SRCS) $(DMD)
221228
$(DMD) -lib -of$(DRUNTIME) -Xfdruntime.json $(DFLAGS) $(SRCS) $(OBJS)
222229

223230
UT_MODULES:=$(patsubst src/%.d,$(ROOT)/unittest/%,$(SRCS))
@@ -256,18 +263,18 @@ $(addprefix $(ROOT)/unittest/,$(DISABLED_TESTS)) :
256263

257264
ifeq (,$(SHARED))
258265

259-
$(ROOT)/unittest/test_runner: $(OBJS) $(SRCS) src/test_runner.d
266+
$(ROOT)/unittest/test_runner: $(OBJS) $(SRCS) src/test_runner.d $(DMD)
260267
$(DMD) $(UDFLAGS) -unittest -of$@ src/test_runner.d $(SRCS) $(OBJS) -debuglib= -defaultlib=
261268

262269
else
263270

264271
UT_DRUNTIME:=$(ROOT)/unittest/libdruntime-ut$(DOTDLL)
265272

266273
$(UT_DRUNTIME): UDFLAGS+=-version=Shared -fPIC
267-
$(UT_DRUNTIME): $(OBJS) $(SRCS)
274+
$(UT_DRUNTIME): $(OBJS) $(SRCS) $(DMD)
268275
$(DMD) $(UDFLAGS) -shared -unittest -of$@ $(SRCS) $(OBJS) $(LINKDL) -debuglib= -defaultlib=
269276

270-
$(ROOT)/unittest/test_runner: $(UT_DRUNTIME) src/test_runner.d
277+
$(ROOT)/unittest/test_runner: $(UT_DRUNTIME) src/test_runner.d $(DMD)
271278
$(DMD) $(UDFLAGS) -of$@ src/test_runner.d -L$(UT_DRUNTIME) -debuglib= -defaultlib=
272279

273280
endif
@@ -287,20 +294,20 @@ $(ROOT)/unittest/% : $(ROOT)/unittest/test_runner
287294
$(addsuffix /.run,$(filter-out test/shared,$(ADDITIONAL_TESTS))): $(DRUNTIME)
288295
test/shared/.run: $(DRUNTIMESO)
289296

290-
test/%/.run: test/%/Makefile
297+
test/%/.run: test/%/Makefile $(DMD)
291298
$(QUIET)$(MAKE) -C test/$* MODEL=$(MODEL) OS=$(OS) DMD=$(abspath $(DMD)) BUILD=$(BUILD) \
292299
DRUNTIME=$(abspath $(DRUNTIME)) DRUNTIMESO=$(abspath $(DRUNTIMESO)) LINKDL=$(LINKDL) \
293300
QUIET=$(QUIET) TIMELIMIT='$(TIMELIMIT)' PIC=$(PIC)
294301

295302
#################### benchmark suite ##########################
296303

297-
$(ROOT)/benchmark: benchmark/runbench.d target
304+
$(ROOT)/benchmark: benchmark/runbench.d target $(DMD)
298305
$(DMD) $(PHOBOS_DFLAGS) -de $< -of$@
299306

300307
benchmark: $(ROOT)/benchmark
301308
$<
302309

303-
benchmark-compile-only: $(ROOT)/benchmark
310+
benchmark-compile-only: $(ROOT)/benchmark $(DMD)
304311
DMD=$(DMD) $< --repeat=0 --dflags="$(PHOBOS_DFLAGS) -de"
305312

306313
#################### test for undesired white spaces ##########################

0 commit comments

Comments
 (0)