public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5690] [modula-2] Bugfix to allow html doc build and simplify target dir creation
@ 2023-02-03 16:36 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2023-02-03 16:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8d2c5b6101426f036bec7940aa29bf7bb8c4abc9

commit r13-5690-g8d2c5b6101426f036bec7940aa29bf7bb8c4abc9
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Fri Feb 3 16:35:22 2023 +0000

    [modula-2] Bugfix to allow html doc build and simplify target dir creation
    
    This patch allows the m2 html documentation to be built.
    It also simplifies all calls to $(mkinstalldirs) using $(@D) in
    gcc/m2/Make-lang.in.
    
    gcc/ChangeLog:
    
            * doc/gm2.texi (Internals): Remove from menu.
            (Using): Comment out ifnohtml conditional.
            (Documentation): Use gcc url.
            (License): Node simplified.
            (Copying): New node.  Include gpl_v3_without_node.
            (Contributing): Node simplified.
            (Internals): Commented out.
            (Libraries): Node simplified.
            (Indices): Ditto.
            (Contents): Ditto.
            (Functions): Ditto.
    
    gcc/m2/ChangeLog:
    
            * Make-lang.in (TEXISRC): Remove m2/images/gnu.eps.
            (RSTSRC): Remove m2/images/gnu.eps.
            (doc/m2.dvi): Add $(objdir)/m2/images/gnu.eps.
            (doc/m2.pdf): Add $(objdir)/m2/images/gnu.eps.
            (M2_PDFFILES): New definition.
            (m2.install-pdf): New rule.
            (m2.pod): Add $(objdir)/m2/images/gnu.eps.
            (m2.info): Add $(objdir)/m2/images/gnu.eps.
            (m2.html): New rule.
            (m2/gpl_v3_without_node.texi): New rule.
            (plugin/m2rte$(soext)): Simplify mkinstalldirs.
            (cc1gm2$(exeext)): Ditto.
            (m2/stage1/cc1gm2$(exeext)): Ditto.
            (m2/gm2-gcc/%.o): Ditto.
            (m2/gm2-gcc/rtegraph.o): Ditto.
            (m2/gm2-gcc/$(SRC_PREFIX)%.h): Ditto.
            (m2/mc-boot/$(SRC_PREFIX)%.o):Ditto.
            (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto.
            (m2/mc-boot/main.o): Ditto.
            (m2/gm2-libs-boot/%.o): Ditto.
            (m2/gm2-libs-boot/$(SRC_PREFIX)%.h): Ditto.
            (m2/gm2-libs-boot/RTcodummy.o): Ditto.
            (m2/gm2-libs-boot/wrapc.o): Ditto.
            (m2/gm2-libs-boot/M2LINK.o): Ditto.
            (m2/gm2-libs-boot/UnixArgs.o): Ditto.
            (m2/gm2-libs-boot/choosetemp.o): Ditto.
            (m2/gm2-libs-boot/errno.o): Ditto.
            (m2/gm2-libs-boot/dtoa.o): Ditto.
            (m2/gm2-libs-boot/ldtoa.o): Ditto.
            (m2/gm2-libs-boot/termios.o): Ditto.
            (m2/gm2-libs-boot/SysExceptions.o): Ditto.
            (m2/gm2-libs-boot/SysStorage.o): Ditto.
            (m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto.
            (m2/gm2-compiler-boot/M2Error.o): Ditto.
            (m2/gm2-compiler-boot/%.o): Ditto.
            (m2/gm2-compiler-boot/$(SRC_PREFIX)%.h): Ditto.
            (m2/gm2-compiler-boot/m2flex.o): Ditto.
            (m2/gm2-compiler/m2flex.c): Ditto.
            (m2/gm2-libiberty/$(SRC_PREFIX)%.h): Ditto.
            (m2/gm2-compiler/%.o): Ditto.
            (m2/gm2-compiler/m2flex.o): Ditto.
            (m2/gm2-compiler/%.o): Ditto.
            (m2/gm2-libs-iso/%.o): Ditto.
            (m2/gm2-libs/gm2-libs-host.h): Ditto.
            ($(objdir)/m2/gm2-libs-min/SYSTEM.def): Ditto.
            ($(objdir)/m2/gm2-libs/SYSTEM.def): Ditto.
            ($(objdir)/m2/gm2-libs-iso/SYSTEM.def): Ditto.
            ($(objdir)/m2/gm2-libs-coroutines/SYSTEM.def): Ditto.
            (m2/gm2-compiler/gm2.a): Ditto.
            (m2/gm2-libs-boot/libgm2.a): Ditto.
            (m2/gm2-compiler-boot/gm2.a): Ditto.
            (m2/boot-bin/mklink$(exeext)): Ditto.
            (m2/gm2-compiler-boot/$(SRC_PREFIX)%.h): Ditto.
            (m2/gm2-compiler/%.mod): Ditto.
            (m2/gm2-compiler-boot/%.mod): Ditto.
            (m2/pge-boot/%.o): Ditto.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/doc/gm2.texi    |  30 +++++------
 gcc/m2/Make-lang.in | 153 +++++++++++++++++++++++++++++-----------------------
 2 files changed, 102 insertions(+), 81 deletions(-)

diff --git a/gcc/doc/gm2.texi b/gcc/doc/gm2.texi
index fad9fafc75c..5b1858bfa50 100644
--- a/gcc/doc/gm2.texi
+++ b/gcc/doc/gm2.texi
@@ -73,7 +73,7 @@ Boston, MA 02110-1301, USA@*
 * License::          License of GNU Modula-2
 * Copying::          GNU Public License V3.
 * Contributing::     Contributing to GNU Modula-2
-* Internals::        GNU Modula-2 internals.
+@c * Internals::        GNU Modula-2 internals.
 * EBNF::             EBNF of GNU Modula-2
 * Libraries::        PIM and ISO library definitions.
 * Indices::          Document and function indices.
@@ -243,7 +243,7 @@ such as the AVR and the ARM).
 * Built-ins::             Accessing GNU Modula-2 Built-ins.
 * The PIM system module:: SYSTEM data types and procedures.
 * The ISO system module:: SYSTEM data types, procedures and run time.
-@ifnothtml
+@c @ifnothtml
 @c omit these nodes if generating gm2 webpage as these are hand written.
 * Release map:: Release map.
 * Documentation:: Placeholder for how to access the documentation online.
@@ -253,7 +253,7 @@ such as the AVR and the ARM).
 * FAQ:: Frequently asked questions.
 * Community:: How to join the community.
 * Other languages:: Other languages for GCC.
-@end ifnothtml
+@c @end ifnothtml
 @end menu
 
 This document contains the user and design issues relevant to the
@@ -2658,7 +2658,7 @@ you wish to see something different please email
 @section Documentation
 
 The GNU Modula-2 documentation is available on line
-@url{https://www.nongnu.org/gm2/homepage.html,at the gm2 homepage}
+@url{https://gcc.gnu.org/onlinedocs}
 or in the pdf, info, html file format.
 
 @node Regression tests, Limitations, Documentation, Using
@@ -2746,7 +2746,7 @@ The mailing list contents can be viewed
 These exist and can be found on the frontends web page on the
 @uref{http://gcc.gnu.org/frontends.html, gcc web site}.
 
-@node License, Copying, Using, Top
+@node License, , ,
 @section License of GNU Modula-2
 
 GNU Modula-2 is free software, the compiler is held under the GPL v3
@@ -2766,10 +2766,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 More information on how these licenses work is available
 @uref{http://www.gnu.org/licenses/licenses.html} on the GNU web site.
 
-@c Copying node is inside the gpl_v3.texi
-@include gpl_v3.texi
+@node Copying, , ,
+@include gpl_v3_without_node.texi
 
-@node Contributing, Internals, Copying, Top
+@node Contributing, , ,
 @section Contributing to GNU Modula-2
 
 Please do and please read the GNU Emacs info under
@@ -2788,12 +2788,12 @@ coding.  The mailing list may be subscribed via a web interface
 
 Many thanks and enjoy your coding!
 
-@node Internals, EBNF, Contributing, Top
+@c @node Internals, , ,
 
-This section is still being written.
+@c This section is still being written.
 @c @include gm2-internals.texi
 
-@node EBNF, Libraries, Internals, Top
+@node EBNF, , ,
 @chapter EBNF of GNU Modula-2
 
 This chapter contains the EBNF of GNU Modula-2.  This grammar currently
@@ -2807,14 +2807,14 @@ phase.
 
 @include m2/gm2-ebnf.texi
 
-@node Libraries, Indices, EBNF, Top
+@node Libraries, , ,
 @chapter PIM and ISO library definitions
 
 This chapter contains M2F, PIM and ISO libraries.
 
 @include m2/gm2-libs.texi
 
-@node Indices, , Libraries, Top
+@node Indices, , ,
 @section Indices
 
 @ifhtml
@@ -2823,11 +2823,11 @@ This chapter contains M2F, PIM and ISO libraries.
 * Functions::   Function, constants, types, ebnf indices.
 @end menu
 
-@node Contents, Functions, ,
+@node Contents, , ,
 @section Section and subsections
 @printindex cp
 
-@node Functions, , Contents,
+@node Functions, , ,
 @section Function, constants, types, ebnf indices.
 @end ifhtml
 
diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
index 47a5b2f0759..d1d02a0d78e 100644
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -41,16 +41,15 @@ else
   PLUGINLDFLAGS += -nodefaultlibs
 endif
 
-TEXISRC = $(objdir)/m2/images/gnu.eps \
-          $(srcdir)/doc/gm2.texi \
+TEXISRC = $(srcdir)/doc/gm2.texi \
           m2/gm2-libs.texi \
           m2/gm2-ebnf.texi \
           m2/SYSTEM-pim.texi \
           m2/SYSTEM-iso.texi \
-          m2/Builtins.texi
+          m2/Builtins.texi \
+          m2/gpl_v3_without_node.texi
 
-RSTSRC = $(objdir)/m2/images/gnu.eps \
-          $(srcdir)/doc/gm2.texi \
+RSTSRC =  $(srcdir)/doc/gm2.texi \
           m2/gm2-libs.rst \
           m2/gm2-ebnf.rst \
           m2/SYSTEM-pim.rst \
@@ -142,7 +141,7 @@ $(DESTDIR)$(man1dir)/$(GM2_INSTALL_NAME)$(man1ext): doc/m2.1 installdirs
 
 m2.dvi: doc/m2.dvi
 
-doc/m2.dvi: $(TEXISRC)
+doc/m2.dvi: $(TEXISRC) $(objdir)/m2/images/gnu.eps
 	$(TEXI2DVI) -c -I $(objdir)/m2 -I $(srcdir)/doc/include -o $@ $(srcdir)/doc/gm2.texi
 
 doc/m2.ps: doc/m2.dvi
@@ -150,15 +149,27 @@ doc/m2.ps: doc/m2.dvi
 
 m2.pdf: doc/m2.pdf
 
-doc/m2.pdf: $(TEXISRC)
+doc/m2.pdf: $(TEXISRC) $(objdir)/m2/images/gnu.eps
 	$(TEXI2PDF) -I $(objdir)/m2 -I $(srcdir)/doc/include $(srcdir)/doc/gm2.texi -o $@
 
+M2_PDFFILES = doc/m2.pdf
+
+m2.install-pdf: $(M2_PDFFILES)
+	@$(NORMAL_INSTALL)
+	test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
+	@list='$(M2_PDFFILES)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(pdf__strip_dir) \
+	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
+	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
+	done
+
 .INTERMEDIATE: m2.pod
 
-m2.pod: $(TEXISRC)
+m2.pod: $(TEXISRC) $(objdir)/m2/images/gnu.eps
 	-$(TEXI2POD) -I $(objdir)/m2 -D m2 < $< > $@
 
-doc/m2.info: $(TEXISRC)
+doc/m2.info: $(TEXISRC) $(objdir)/m2/images/gnu.eps
 	if test "x$(BUILD_INFO)" = xinfo; then \
 	  rm -f doc/m2.info*; \
           $(MAKEINFO) -I$(objdir)/m2 -I$(srcdir)/doc/include \
@@ -166,9 +177,16 @@ doc/m2.info: $(TEXISRC)
 	else true; fi
 
 $(objdir)/m2/images/gnu.eps: $(srcdir)/m2/images/gnupng
-	-test -d m2/images || $(mkinstalldirs) m2/images
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	cp $(srcdir)/m2/images/gnu.eps $@
 
+m2.html: $(build_htmldir)/m2/index.html
+
+$(build_htmldir)/m2/index.html: $(TEXISRC) $(objdir)/m2/images/gnu.eps
+	$(mkinstalldirs) $(@D)
+	rm -f $(@D)/*
+	$(TEXI2HTML) -I $(objdir)/m2 -I $(srcdir)/m2 -I $(gcc_docdir)/include -o $(@D) $<
+
 # gm2-libs.texi
 
 m2/gm2-libs.texi: gm2-libs.texi-check; @true
@@ -176,9 +194,9 @@ m2/gm2-libs.texi: gm2-libs.texi-check; @true
 ifeq ($(HAVE_PYTHON),yes)
 gm2-libs.texi-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
                      $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
-	test -d m2/gm2-libs-log || $(mkinstalldirs) m2/gm2-libs-log
-	test -d m2/gm2-libs-iso || $(mkinstalldirs) m2/gm2-libs-iso
-	test -d m2/gm2-libs || $(mkinstalldirs) m2/gm2-libs
+	-test -d m2/gm2-libs-log || $(mkinstalldirs) m2/gm2-libs-log
+	-test -d m2/gm2-libs-iso || $(mkinstalldirs) m2/gm2-libs-iso
+	-test -d m2/gm2-libs || $(mkinstalldirs) m2/gm2-libs
 	$(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.texi
 else
 gm2-libs.texi-check:
@@ -295,6 +313,9 @@ Builtins.rst-check:  m2/gm2-libs/Builtins.def
 endif
 	$(STAMP) Builtins.rst-check
 
+m2/gpl_v3_without_node.texi: doc/include/gpl_v3.texi
+	grep -v "^@node" $< > $@
+
 # Stage hooks:
 # The toplevel makefile has already created stage?/m2 at this point.
 
@@ -388,7 +409,7 @@ override PLUGINCFLAGS := $(filter-out -mdynamic-no-pic,$(PLUGINCFLAGS))
 
 plugin/m2rte$(soext): $(srcdir)/m2/plugin/m2rte.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) \
         insn-attr-common.h insn-flags.h $(generated_files)
-	-test -d plugin || $(mkinstalldirs) plugin
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(PLUGINCC) $(PLUGINCFLAGS) -fno-rtti -I. -I$(srcdir) $(INCINTL) -I$(srcdir)/m2 -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/../include -I$(srcdir)/../libcpp/include -Wall $(GMPINC) -Wno-literal-suffix -fPIC -c -o plugin/m2rte.o $(srcdir)/m2/plugin/m2rte.cc
 	$(PLUGINCC) $(PLUGINCFLAGS) $(PLUGINLDFLAGS) $(PLUGINLIBS) $(LIBINTL) -fno-rtti plugin/m2rte.o -shared -o $@
 
@@ -496,7 +517,7 @@ cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) $(m2.prev)
 m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(P) \
                             $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS) \
                             m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext) m2/gm2-libs-boot/M2LINK.o
-	-test -d m2/stage2 || $(mkinstalldirs) m2/stage2
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	@$(call LINK_PROGRESS,$(INDEX.m2),start)
 	+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler/m2flex.o \
                             attribs.o \
@@ -511,7 +532,7 @@ m2/stage1/cc1gm2$(exeext): gm2$(exeext) m2/gm2-compiler-boot/m2flex.o \
                             m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext) \
                             m2/gm2-libs-boot/M2LINK.o \
                             $(m2.prev)
-	-test -d m2/stage1 || $(mkinstalldirs) m2/stage1
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	@$(call LINK_PROGRESS,$(INDEX.m2),start)
 	+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-boot/m2flex.o \
                             attribs.o \
@@ -529,7 +550,7 @@ GCC_HEADER_DEPENDENCIES_FOR_M2 = $(BUILD-BOOT-H) $(TIMEVAR_H) m2/gm2config.h $(C
         $(generated_files) insn-attr-common.h
 
 m2/gm2-gcc/%.o: $(srcdir)/m2/gm2-gcc/%.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
-	-test -d m2/gm2-gcc || $(mkinstalldirs) m2/gm2-gcc
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
              $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
@@ -537,7 +558,7 @@ m2/gm2-gcc/m2configure.o: $(srcdir)/m2/gm2-gcc/m2configure.cc \
                $(SYSTEM_H) $(GCC_H) $(CONFIG_H) \
                m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) \
                $(generated_files) $(C_TREE_H) insn-attr-common.h
-	-test -d m2/gm2-gcc || $(mkinstalldirs) m2/gm2-gcc
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
          $(DRIVER_DEFINES) \
 		-DLIBSUBDIR=\"$(libsubdir)\" \
@@ -559,7 +580,7 @@ m2/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
 
 m2/gm2-gcc/rtegraph.o: $(srcdir)/m2/gm2-gcc/rtegraph.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) \
                        gt-m2-rtegraph.h
-	-test -d m2/gm2-gcc || $(mkinstalldirs) m2/gm2-gcc
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(COMPILER) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \
             $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
@@ -568,7 +589,7 @@ c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
             $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 m2/gm2-gcc/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-gcc/%.def $(MCDEPS)
-	-test -d m2/gm2-gcc || $(mkinstalldirs) m2/gm2-gcc
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=$@ $(srcdir)/m2/gm2-gcc/$*.def
 
 # The following tables define the source files which are translated into C using mc
@@ -1326,19 +1347,19 @@ m2/boot-bin/mc$(exeext): $(BUILD-MC-BOOT-O) $(BUILD-MC-INTERFACE-O) \
          mcflex.o m2/gm2-libs-boot/RTcodummy.o -lm
 
 m2/mc-boot/$(SRC_PREFIX)%.o: m2/mc-boot/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/mc-boot || $(mkinstalldirs) m2/mc-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@
 
 m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/mc-boot-ch || $(mkinstalldirs) m2/mc-boot-ch
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@
 
 m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/mc-boot-ch || $(mkinstalldirs) m2/mc-boot-ch
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@
 
 m2/mc-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
-	-test -d m2/mc-boot || $(mkinstalldirs) m2/mc-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	unset CC ; $(M2LINK) -s --langc++ --exit --name m2/mc-boot/main.c $(srcdir)/m2/init/mcinit
 	$(CXX) -g -c -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) m2/mc-boot/main.c -o $@
 
@@ -1349,73 +1370,73 @@ mcflex.c: $(srcdir)/m2/mc/mc.flex
 	flex -t $< > $@
 
 m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs-boot/$*.mod
 	$(COMPILER) -c -DIN_GCC $(CFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@
 
 m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs/$*.mod
 	$(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@
 
 m2/gm2-libs-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
 
 m2/gm2-libs-boot/RTcodummy.o: $(srcdir)/m2/gm2-libs-ch/RTcodummy.c m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/RTintdummy.o: $(srcdir)/m2/gm2-libs-ch/RTintdummy.c m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/M2LINK.o: $(srcdir)/m2/gm2-libs-ch/M2LINK.c m2/gm2-libs-boot/$(SRC_PREFIX)M2LINK.h m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c m2/gm2-libs-boot/$(SRC_PREFIX)errno.h m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c $(BUILD-LIBS-BOOT-H) m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \
                                   m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-boot/SysStorage.o: $(srcdir)/m2/gm2-libs/SysStorage.mod $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=m2/gm2-libs-boot/SysStorage.c $(srcdir)/m2/gm2-libs/SysStorage.mod
 	$(COMPILER) -DIN_GCC -c $(CFLAGS) \
           -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) \
           m2/gm2-libs-boot/SysStorage.c -o m2/gm2-libs-boot/SysStorage.o
 
 m2/gm2-compiler-boot/M2GCCDeclare.o: $(srcdir)/m2/gm2-compiler/M2GCCDeclare.mod $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) --extended-opaque -o=m2/gm2-compiler-boot/M2GCCDeclare.c $<
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
             -I. -I$(srcdir)/../include -I$(srcdir) \
@@ -1423,7 +1444,7 @@ m2/gm2-compiler-boot/M2GCCDeclare.o: $(srcdir)/m2/gm2-compiler/M2GCCDeclare.mod
             -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2GCCDeclare.c -o $@
 
 m2/gm2-compiler-boot/M2Error.o: $(srcdir)/m2/gm2-compiler/M2Error.mod $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) --extended-opaque -o=m2/gm2-compiler-boot/M2Error.c $<
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
             -I. -I$(srcdir)/../include -I$(srcdir) \
@@ -1431,7 +1452,7 @@ m2/gm2-compiler-boot/M2Error.o: $(srcdir)/m2/gm2-compiler/M2Error.mod $(MCDEPS)
             -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2Error.c -o $@
 
 m2/gm2-compiler-boot/%.o: $(srcdir)/m2/gm2-compiler/%.mod $(BUILD-BOOT-H) $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=m2/gm2-compiler-boot/$*.c $(srcdir)/m2/gm2-compiler/$*.mod
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
             -I. -I$(srcdir)/../include -I$(srcdir) \
@@ -1439,7 +1460,7 @@ m2/gm2-compiler-boot/%.o: $(srcdir)/m2/gm2-compiler/%.mod $(BUILD-BOOT-H) $(MCDE
             -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@
 
 m2/gm2-compiler-boot/%.o: m2/gm2-compiler-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=m2/gm2-compiler-boot/$*.c m2/gm2-compiler-boot/$*.mod
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
             -I. -I$(srcdir)/../include -I$(srcdir) \
@@ -1447,46 +1468,46 @@ m2/gm2-compiler-boot/%.o: m2/gm2-compiler-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H)
             -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@
 
 m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler/%.def $(MCDEPS)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=$@ $(srcdir)/m2/gm2-compiler/$*.def
 
 m2/gm2-compiler-boot/m2flex.o: m2/gm2-compiler/m2flex.c $(BUILD-BOOT-H) $(TIMEVAR_H) \
         $(BUILD-LIBS-BOOT-H)  m2/gm2-compiler-boot/$(SRC_PREFIX)NameKey.h \
         $(CONFIG_H) m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(COMPILER) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
           $(GM2GCC) $(INCLUDES) -I$(srcdir)/m2 \
           -Im2 -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@
 
 m2/gm2-compiler/m2flex.c: $(srcdir)/m2/m2.flex $(TIMEVAR_H) insn-attr-common.h
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	flex -t $< | sed -e 's/ malloc/ xmalloc/' | sed -e 's/ realloc/ xrealloc/' > $@
 
 m2/gm2-libiberty/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libiberty/%.def $(MCDEPS)
-	-test -d m2/gm2-libiberty || $(mkinstalldirs) m2/gm2-libiberty
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) -o=$@ $(srcdir)/m2/gm2-libiberty/$*.def
 
 # The rules to build objects in gm2-compiler and gm2-libs directories.
 
 m2/gm2-compiler/%.o: $(srcdir)/m2/gm2-compiler/%.mod
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(GM2_1) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
 
 m2/gm2-compiler/m2flex.o: m2/gm2-compiler/m2flex.c m2/gm2-libs/gm2-libs-host.h $(TIMEVAR_H)
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(COMPILER) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
           $(GM2GCC) -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@
 
 m2/gm2-compiler/%.o: m2/gm2-compiler/%.mod
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(GM2_1) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
 
 m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.c m2/gm2-libs/gm2-libs-host.h
-	-test -d m2/gm2-libs-iso || $(mkinstalldirs) m2/gm2-libs-iso
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) -DBUILD_GM2_LIBS_TARGET -DBUILD_GM2_LIBS -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
 
 m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.mod
-	-test -d m2/gm2-libs-iso || $(mkinstalldirs) m2/gm2-libs-iso
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(GM2_1) $(GM2_ISO_FLAGS) -c -B./ -Im2/gm2-libs-iso:$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $< -o $@
 
 
@@ -1494,7 +1515,7 @@ m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.mod
 # again using itself.
 
 m2/gm2-libs/gm2-libs-host.h:
-	-test -d m2/gm2-libs || $(mkinstalldirs) m2/gm2-libs
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	echo "Configuring to build libraries using native compiler" ; \
         NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../../ ${srcdir} m2/gm2-libs` ; \
         export NEW_SRCDIR ; \
@@ -1529,7 +1550,7 @@ m2/gm2config.aci:
         fi
 
 $(objdir)/m2/gm2-libs-min/SYSTEM.def: $(GM2_PROG_DEP)
-	-test -d m2/gm2-libs-min || $(mkinstalldirs) m2/gm2-libs-min
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \
              $(srcdir)/m2/gm2-libs-min/SYSTEM.def \
              $(srcdir)/m2/gm2-libs-min/SYSTEM.mod \
@@ -1537,7 +1558,7 @@ $(objdir)/m2/gm2-libs-min/SYSTEM.def: $(GM2_PROG_DEP)
              "$(GM2_FOR_TARGET)" $@
 
 $(objdir)/m2/gm2-libs/SYSTEM.def: $(GM2_PROG_DEP)
-	-test -d m2/gm2-libs || $(mkinstalldirs) m2/gm2-libs
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	echo "GM2_FOR_TARGET $(GM2_FOR_TARGET)"
 	echo "GCC_FOR_TARGET $(GCC_FOR_TARGET)"
 	$(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \
@@ -1547,7 +1568,7 @@ $(objdir)/m2/gm2-libs/SYSTEM.def: $(GM2_PROG_DEP)
              "$(GM2_FOR_TARGET)" $@
 
 $(objdir)/m2/gm2-libs-iso/SYSTEM.def: $(GM2_PROG_DEP)
-	-test -d m2/gm2-libs-iso || $(mkinstalldirs) m2/gm2-libs-iso
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(SHELL) $(srcdir)/m2/tools-src/makeSystem -fiso \
              $(srcdir)/m2/gm2-libs-iso/SYSTEM.def \
              $(srcdir)/m2/gm2-libs-iso/SYSTEM.mod \
@@ -1555,7 +1576,7 @@ $(objdir)/m2/gm2-libs-iso/SYSTEM.def: $(GM2_PROG_DEP)
              "$(GM2_FOR_TARGET)" $@
 
 $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def: $(GM2_PROG_DEP)
-	-test -d m2/gm2-libs-coroutines || $(mkinstalldirs) m2/gm2-libs-coroutines
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \
              $(srcdir)/m2/gm2-libs-coroutines/SYSTEM.def \
              $(srcdir)/m2/gm2-libs-coroutines/SYSTEM.mod \
@@ -1567,13 +1588,13 @@ build-compiler: $(GM2-COMP-MODS:%.mod=m2/gm2-compiler/%.o) \
                 m2/gm2-compiler/m2flex.o
 
 m2/gm2-compiler/gm2.a: build-compiler gm2$(exeext)
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(AR_FOR_TARGET) cr $@ $(GM2-COMP-MODS:%.mod=m2/gm2-compiler/%.o) \
                     $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler/%.o)
 	$(RANLIB) $@
 
 m2/gm2-libs-boot/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-BOOT)
-	-test -d m2/gm2-libs-boot || $(mkinstalldirs) m2/gm2-libs-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(AR) cr $@ $(GM2-LIBS-BOOT-MODS:%.mod=m2/gm2-libs-boot/%.o) \
                     $(GM2-LIBS-BOOT-CC:%.cc=m2/gm2-libs-boot/%.o) \
                     $(GM2-LIBS-BOOT-C:%.c=m2/gm2-libs-boot/%.o)
@@ -1581,7 +1602,7 @@ m2/gm2-libs-boot/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-BOOT)
 
 m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext) m2/boot-bin/mklink$(exeext) \
                          $(BUILD-LIBS-BOOT) $(BUILD-COMPILER-BOOT)
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(AR) cr $@ $(GM2-COMP-BOOT-MODS:%.mod=m2/gm2-compiler-boot/%.o) \
                     $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-boot/%.o)
 	$(RANLIB) $@
@@ -1589,19 +1610,19 @@ m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext) m2/boot-bin/mklink$(exeext)
 m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext)
 
 m2/boot-bin/mklink$(exeext): $(srcdir)/m2/tools-src/mklink.c
-	-test -d m2/boot-bin || $(mkinstalldirs) m2/boot-bin
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@
 
 m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler-boot/%.def $(MCDEPS)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(MC) --quiet -o=$@ $(srcdir)/m2/gm2-compiler-boot/$*.def
 
 m2/gm2-compiler/%.mod: $(srcdir)/m2/gm2-compiler/%.bnf $(PGE)
-	-test -d m2/gm2-compiler || $(mkinstalldirs) m2/gm2-compiler
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(PGE) -k -l $< -o $@
 
 m2/gm2-compiler-boot/%.mod: $(srcdir)/m2/gm2-compiler/%.bnf $(PGE)
-	-test -d m2/gm2-compiler-boot || $(mkinstalldirs) m2/gm2-compiler-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(PGE) -k -l $< -o $@
 
 check-m2: check-gm2
@@ -1670,11 +1691,11 @@ ifeq ($(M2_MAINTAINER),yes)
 include m2/Make-maintainer
 else
 m2/pge-boot/%.o: m2/pge-boot/%.c m2/gm2-libs/gm2-libs-host.h m2/gm2config.h
-	-test -d m2/pge-boot ||$(mkinstalldirs) m2/pge-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@
 
 m2/pge-boot/%.o: m2/pge-boot/%.cc m2/gm2-libs/gm2-libs-host.h m2/gm2config.h
-	-test -d m2/pge-boot || $(mkinstalldirs) m2/pge-boot
+	-test -d $(@D) || $(mkinstalldirs) $(@D)
 	$(CXX) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@
 
 $(PGE): $(BUILD-PGE-O)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-03 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 16:36 [gcc r13-5690] [modula-2] Bugfix to allow html doc build and simplify target dir creation Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).