diff --git a/programs/dthelp/parser/canon1/build/Makefile.am b/programs/dthelp/parser/canon1/build/Makefile.am index 7b169c3b..a7474c51 100644 --- a/programs/dthelp/parser/canon1/build/Makefile.am +++ b/programs/dthelp/parser/canon1/build/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build +# build runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -13,9 +21,10 @@ HELPUTILSRC = $(HELPTAG)/util HELPBUILDSRC = $(HELPTAG)/build HELPUTILLIB = $(HELPTAG)/util/libutil.a -build_CFLAGS = -I$(HELPUTILSRC) +build_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -build_LDADD = ../util/libutil.a +build_LDADD = $(HELPUTILSRC)/libutil_host.a +build_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c diff --git a/programs/dthelp/parser/canon1/eltdef/Makefile.am b/programs/dthelp/parser/canon1/eltdef/Makefile.am index 315309c9..1cb0f498 100644 --- a/programs/dthelp/parser/canon1/eltdef/Makefile.am +++ b/programs/dthelp/parser/canon1/eltdef/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef +# eltdef runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -15,9 +23,10 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a HELPIFFILE = $(HELPTAGSRC)/help.if HELPTSSFILE = $(HELPTAGSRC)/htag.tss -eltdef_LDADD = $(HELPUTILLIB) +eltdef_LDADD = $(HELPUTILSRC)/libutil_host.a +eltdef_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a -eltdef_CFLAGS = -I$(HELPUTILSRC) -I$(HELPBUILDSRC) +eltdef_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -I$(HELPBUILDSRC) eltdef_SOURCES = eltdef.c eltutil.c entity.c scan.c diff --git a/programs/dthelp/parser/canon1/util/Makefile.am b/programs/dthelp/parser/canon1/util/Makefile.am index 44043e9e..961b3e0e 100644 --- a/programs/dthelp/parser/canon1/util/Makefile.am +++ b/programs/dthelp/parser/canon1/util/Makefile.am @@ -10,9 +10,9 @@ noinst_LIBRARIES = libutil.a # Makefile.am) compiles them with the sources of libutil. HOSTUTIL_C = $(filter %.c,$(libutil_a_SOURCES)) EXTRA_DIST = context.c -CLEANFILES = context fclndir +CLEANFILES = context fclndir hostobj libutil_host.a -all-local: context fclndir +all-local: context fclndir libutil_host.a context: context.c $(HOSTUTIL_C) $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/context.c $(addprefix $(srcdir)/,$(HOSTUTIL_C)) $(LDFLAGS_FOR_BUILD) @@ -20,6 +20,19 @@ context: context.c $(HOSTUTIL_C) fclndir: context cp context fclndir +# the same sources for the build host: the parser generators (build, +# eltdef) link this archive, and its objects must be the host's (t0230) +libutil_host.a: $(HOSTUTIL_C) + $(RM) -rf hostobj $@ + mkdir -p hostobj + for f in $(HOSTUTIL_C); do \ + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \ + -I. -I$(srcdir) -c $(srcdir)/$$f -o hostobj/`basename $$f .c`.o \ + || exit 1; \ + done + $(AR_FOR_BUILD) cru $@ hostobj/*.o + $(RANLIB_FOR_BUILD) $@ + libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \ diff --git a/programs/dthelp/parser/pass1/build/Makefile.am b/programs/dthelp/parser/pass1/build/Makefile.am index 4804ecde..4b2dae10 100644 --- a/programs/dthelp/parser/pass1/build/Makefile.am +++ b/programs/dthelp/parser/pass1/build/Makefile.am @@ -2,6 +2,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build +# build runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + .NOTPARALLEL: HELPTAG = .. @@ -13,9 +21,10 @@ HELPUTILSRC = $(HELPTAG)/util HELPBUILDSRC = $(HELPTAG)/build HELPUTILLIB = $(HELPTAG)/util/libutil.a -build_CFLAGS = -I$(HELPUTILSRC) +build_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -build_LDADD = ../util/libutil.a +build_LDADD = $(HELPUTILSRC)/libutil_host.a +build_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c diff --git a/programs/dthelp/parser/pass1/eltdef/Makefile.am b/programs/dthelp/parser/pass1/eltdef/Makefile.am index 9d045324..fdd444ab 100644 --- a/programs/dthelp/parser/pass1/eltdef/Makefile.am +++ b/programs/dthelp/parser/pass1/eltdef/Makefile.am @@ -2,6 +2,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef +# eltdef runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -13,9 +21,10 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a HELPIFFILE = $(HELPTAGSRC)/help.if HELPTSSFILE = $(HELPTAGSRC)/htag.tss -eltdef_LDADD = $(HELPUTILLIB) +eltdef_LDADD = $(HELPUTILSRC)/libutil_host.a +eltdef_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a -eltdef_CFLAGS = -I$(HELPUTILSRC) -I$(HELPBUILDSRC) +eltdef_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -I$(HELPBUILDSRC) eltdef_SOURCES = eltdef.c eltutil.c entity.c scan.c diff --git a/programs/dthelp/parser/pass1/util/Makefile.am b/programs/dthelp/parser/pass1/util/Makefile.am index 44043e9e..961b3e0e 100644 --- a/programs/dthelp/parser/pass1/util/Makefile.am +++ b/programs/dthelp/parser/pass1/util/Makefile.am @@ -10,9 +10,9 @@ noinst_LIBRARIES = libutil.a # Makefile.am) compiles them with the sources of libutil. HOSTUTIL_C = $(filter %.c,$(libutil_a_SOURCES)) EXTRA_DIST = context.c -CLEANFILES = context fclndir +CLEANFILES = context fclndir hostobj libutil_host.a -all-local: context fclndir +all-local: context fclndir libutil_host.a context: context.c $(HOSTUTIL_C) $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/context.c $(addprefix $(srcdir)/,$(HOSTUTIL_C)) $(LDFLAGS_FOR_BUILD) @@ -20,6 +20,19 @@ context: context.c $(HOSTUTIL_C) fclndir: context cp context fclndir +# the same sources for the build host: the parser generators (build, +# eltdef) link this archive, and its objects must be the host's (t0230) +libutil_host.a: $(HOSTUTIL_C) + $(RM) -rf hostobj $@ + mkdir -p hostobj + for f in $(HOSTUTIL_C); do \ + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \ + -I. -I$(srcdir) -c $(srcdir)/$$f -o hostobj/`basename $$f .c`.o \ + || exit 1; \ + done + $(AR_FOR_BUILD) cru $@ hostobj/*.o + $(RANLIB_FOR_BUILD) $@ + libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \ diff --git a/programs/dthelp/parser/pass2/build/Makefile.am b/programs/dthelp/parser/pass2/build/Makefile.am index c2fc5e0b..ebab4a2e 100644 --- a/programs/dthelp/parser/pass2/build/Makefile.am +++ b/programs/dthelp/parser/pass2/build/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build +# build runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HTAG2 = .. HTAG2SRC = $(HTAG2)/htag2 SDLPARSERSRC = $(HTAG2)/parser @@ -14,9 +22,10 @@ SDLBUILDSRC = $(HTAG2)/build SDLUTILLIB = $(HTAG2)/util/libutil.a SDLIFFILE = $(HTAG2SRC)/help.if -build_CFLAGS = -I$(SDLUTILSRC) +build_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(SDLUTILSRC) -build_LDADD = ../util/libutil.a +build_LDADD = $(SDLUTILSRC)/libutil_host.a +build_DEPENDENCIES = $(SDLUTILSRC)/libutil_host.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c diff --git a/programs/dthelp/parser/pass2/eltdef/Makefile.am b/programs/dthelp/parser/pass2/eltdef/Makefile.am index 0e79910a..86f87ebd 100644 --- a/programs/dthelp/parser/pass2/eltdef/Makefile.am +++ b/programs/dthelp/parser/pass2/eltdef/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef +# eltdef runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HTAG2 = .. HTAG2SRC = $(HTAG2)/htag2 SDLPARSERSRC = $(HTAG2)/parser @@ -14,9 +22,10 @@ SDLBUILDSRC = $(HTAG2)/build SDLUTILLIB = $(HTAG2)/util/libutil.a SDLIFFILE = $(HTAG2SRC)/sdl.if -eltdef_LDADD = $(SDLUTILLIB) +eltdef_LDADD = $(SDLUTILSRC)/libutil_host.a +eltdef_DEPENDENCIES = $(SDLUTILSRC)/libutil_host.a -eltdef_CFLAGS = -I$(SDLUTILSRC) -I$(SDLBUILDSRC) +eltdef_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(SDLUTILSRC) -I$(SDLBUILDSRC) eltdef_SOURCES = eltdef.c eltutil.c entity.c scan.c diff --git a/programs/dthelp/parser/pass2/util/Makefile.am b/programs/dthelp/parser/pass2/util/Makefile.am index 1d8e1f07..a4f494e9 100644 --- a/programs/dthelp/parser/pass2/util/Makefile.am +++ b/programs/dthelp/parser/pass2/util/Makefile.am @@ -12,9 +12,9 @@ noinst_LIBRARIES = libutil.a # Makefile.am) compiles them with the sources of libutil. HOSTUTIL_C = $(filter %.c,$(libutil_a_SOURCES)) EXTRA_DIST = context.c -CLEANFILES = context fclndir +CLEANFILES = context fclndir hostobj libutil_host.a -all-local: context fclndir +all-local: context fclndir libutil_host.a context: context.c $(HOSTUTIL_C) $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/context.c $(addprefix $(srcdir)/,$(HOSTUTIL_C)) $(LDFLAGS_FOR_BUILD) @@ -22,6 +22,19 @@ context: context.c $(HOSTUTIL_C) fclndir: context cp context fclndir +# the same sources for the build host: the parser generators (build, +# eltdef) link this archive, and its objects must be the host's (t0230) +libutil_host.a: $(HOSTUTIL_C) + $(RM) -rf hostobj $@ + mkdir -p hostobj + for f in $(HOSTUTIL_C); do \ + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \ + -I. -I$(srcdir) -c $(srcdir)/$$f -o hostobj/`basename $$f .c`.o \ + || exit 1; \ + done + $(AR_FOR_BUILD) cru $@ hostobj/*.o + $(RANLIB_FOR_BUILD) $@ + libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \