Hi, This patch updates the build and invocation of idgen and impcnvgen, ensuring that they are removed when cleaning the build directory.
Added BUILD_LIBDEPS on the link command, which is necessary when the system installed compiler is not gcc, as noticed when testing compilation on OpenBSD. Bootstrapped and regression tested on x86_64-linux-gnu. Committed to trunk as r270397. -- Iain --- gcc/d/ChangeLog: 2019-04-16 Iain Buclaw <ibuc...@gdcproject.org> * Make-lang.in (d.mostyclean): Clean idgen and impcnvgen. (d/idgen): Rename to d/idgen$(build_exeext), add BUILD_LIBDEPS. (d/impcnvgen): Rename to d/impcnvgen$(build_exeext), add BUILD_LIBDEPS. (d/id.c): Call idgen$(build_exeext). (d/impcnvtab.c): Call impcnvgen$(build_exeext). ---
diff --git a/gcc/d/Make-lang.in b/gcc/d/Make-lang.in index 4e5b4a6c0c4..13b785e86a1 100644 --- a/gcc/d/Make-lang.in +++ b/gcc/d/Make-lang.in @@ -279,7 +279,8 @@ d.mostlyclean: -rm -f d/*$(objext) -rm -f d/*$(coverageexts) -rm -f $(D_GENERATED_SRCS) - -rm -f d/gdc$(exeext) gdc-cross$(exeext) d/d21$(exeext) + -rm -f d/idgen$(build_exeext) d/impcnvgen$(build_exeext) + -rm -f gdc$(exeext) gdc-cross$(exeext) d21$(exeext) d.clean: d.distclean: d.maintainer-clean: @@ -316,21 +317,23 @@ d/%.o: d/dmd/root/%.c $(D_GENERATED_SRCS) $(POSTCOMPILE) # Generated programs. -d/idgen: d/idgen.dmdgen.o - +$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ $^ +d/idgen$(build_exeext): d/idgen.dmdgen.o $(BUILD_LIBDEPS) + +$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \ + $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS) -d/impcvgen: d/impcnvgen.dmdgen.o - +$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ $^ +d/impcnvgen$(build_exeext): d/impcnvgen.dmdgen.o $(BUILD_LIBDEPS) + +$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \ + $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS) # Generated sources. -d/id.c: d/idgen - cd d && ./idgen +d/id.c: d/idgen$(build_exeext) + cd d && ./idgen$(build_exeext) # idgen also generates id.h; just verify it exists. d/id.h: d/id.c -d/impcnvtab.c: d/impcvgen - cd d && ./impcvgen +d/impcnvtab.c: d/impcnvgen$(build_exeext) + cd d && ./impcnvgen$(build_exeext) d/%.dmdgen.o: $(srcdir)/d/dmd/%.c $(DMDGEN_COMPILE) $(D_INCLUDES) $<