From 6da55905ec67d431c21f8d53360e39a316996191 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Wed, 15 Apr 2020 11:34:01 -0600 Subject: [PATCH] dthelp/parser/pass1: get it to build So this is going to be tricky/painful getting this parser fully operational. It's pretty hairy with various interdependencies and generated code. It's rather complicated how each sub dir depends on the previous one. Also, the parser subdir has dependencies on the helptag subdir, and vice-versa, so some hackery was needed to get that to work. Due to the wierd interdepencencies between helptag and parser, we disable parallel builds there. This is some really horrible code and design - not surprising since it dates to 1989. I think it should just be removed -- who can maintain or refactor this code? Also, dthelp_htag1 is now built in pass1/parser/, not in pass1/helptag/ as it used to be. --- cde/.gitignore | 6 +- cde/autogen.sh | 2 +- cde/configure.ac | 11 +-- cde/programs/dthelp/Makefile.am | 3 +- cde/programs/dthelp/parser/Makefile.am | 4 +- .../dthelp/parser/pass1/build/Makefile.am | 49 +++++-------- .../dthelp/parser/pass1/eltdef/Makefile.am | 40 +++-------- .../dthelp/parser/pass1/helptag/Makefile.am | 68 ++++++------------- .../dthelp/parser/pass1/parser/Makefile.am | 49 +++++++++++++ .../dthelp/parser/pass1/util/Makefile.am | 21 ++++++ 10 files changed, 135 insertions(+), 118 deletions(-) create mode 100644 cde/programs/dthelp/parser/pass1/parser/Makefile.am create mode 100644 cde/programs/dthelp/parser/pass1/util/Makefile.am diff --git a/cde/.gitignore b/cde/.gitignore index 4a4c2ffba..7638667aa 100644 --- a/cde/.gitignore +++ b/cde/.gitignore @@ -10,8 +10,9 @@ *~ .depend -# flags for saying directory is complete +# flags for saying directory/target is complete DONE +?DONE # imports of of headers imports/x11 @@ -590,13 +591,12 @@ programs/dthelp/parser/pass1/eltdef/stfile.c programs/dthelp/parser/pass1/eltdef/tfile.c programs/dthelp/parser/pass1/helptag/LocaleXlate.c programs/dthelp/parser/pass1/helptag/XlationSvc.c -programs/dthelp/parser/pass1/helptag/dthelp_htag1 programs/dthelp/parser/pass1/parser/case.c programs/dthelp/parser/pass1/parser/context.h programs/dthelp/parser/pass1/parser/delim.dat programs/dthelp/parser/pass1/parser/delim.h programs/dthelp/parser/pass1/parser/error -programs/dthelp/parser/pass1/parser/parser +programs/dthelp/parser/pass1/parser/dthelp_htag1 programs/dthelp/parser/pass1/util/context programs/dthelp/parser/pass1/util/fclndir programs/dthelp/parser/pass2/build/arc.h diff --git a/cde/autogen.sh b/cde/autogen.sh index a04d23368..9461dd37a 100755 --- a/cde/autogen.sh +++ b/cde/autogen.sh @@ -9,7 +9,7 @@ DIE=0 libtoolize --force --automake aclocal -I admin -autoconf +autoconf -f autoheader automake --foreign --include-deps --add-missing diff --git a/cde/configure.ac b/cde/configure.ac index a8a66bf93..370b5bab4 100644 --- a/cde/configure.ac +++ b/cde/configure.ac @@ -514,6 +514,13 @@ programs/dthelp/dthelpview/Makefile programs/dthelp/dthelpgen/Makefile programs/dthelp/dthelpdemo/Makefile programs/dthelp/dthelpprint/Makefile +programs/dthelp/parser/Makefile +programs/dthelp/parser/pass1/Makefile +programs/dthelp/parser/pass1/util/Makefile +programs/dthelp/parser/pass1/build/Makefile +programs/dthelp/parser/pass1/eltdef/Makefile +programs/dthelp/parser/pass1/helptag/Makefile +programs/dthelp/parser/pass1/parser/Makefile programs/nsgmls/Makefile @@ -659,9 +666,6 @@ programs/localized/es_ES.UTF-8/appmanager/Makefile AC_OUTPUT dnl not currently building -dnl programs/dthelp/Makefile -dnl programs/dthelp/dthelpgen/Makefile -dnl programs/dthelp/dthelpprint/Makefile dnl programs/dthelp/parser/pass1/helptag/Makefile dnl programs/dthelp/parser/pass1/Makefile dnl programs/dthelp/parser/pass1/eltdef/Makefile @@ -669,4 +673,3 @@ dnl programs/dthelp/parser/pass1/build/Makefile dnl programs/dthelp/parser/Makefile dnl programs/dthelp/parser/canon1/Makefile dnl programs/dthelp/parser/pass2/Makefile -dnl programs/dthelp/dthelpview/Makefile diff --git a/cde/programs/dthelp/Makefile.am b/cde/programs/dthelp/Makefile.am index 970aa4116..4d351c9f5 100644 --- a/cde/programs/dthelp/Makefile.am +++ b/cde/programs/dthelp/Makefile.am @@ -1,5 +1,4 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = dthelpview dthelpgen dthelpdemo dthelpprint +SUBDIRS = dthelpview dthelpgen dthelpdemo dthelpprint parser -#NOTYET = parser diff --git a/cde/programs/dthelp/parser/Makefile.am b/cde/programs/dthelp/parser/Makefile.am index a0167120b..4e38114c9 100644 --- a/cde/programs/dthelp/parser/Makefile.am +++ b/cde/programs/dthelp/parser/Makefile.am @@ -1,3 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = pass1 canon1 pass2 helptag misc dtds +SUBDIRS = pass1 + +#NOTYET canon1 pass2 helptag misc dtds diff --git a/cde/programs/dthelp/parser/pass1/build/Makefile.am b/cde/programs/dthelp/parser/pass1/build/Makefile.am index 19f53ca9a..7f6163bae 100644 --- a/cde/programs/dthelp/parser/pass1/build/Makefile.am +++ b/cde/programs/dthelp/parser/pass1/build/Makefile.am @@ -2,10 +2,6 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build -ARCCMD = arc u -UNARCCMD = arc x -ARCDELCMD = arc d - HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -17,15 +13,7 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a build_CFLAGS = -I$(HELPUTILSRC) -build_LDADD = -l$(HELPUTILLIB) - -if HPUX -build_LDFLAGS = -Wl,-a archive -endif - -if SOLARIS -.NO_PARALLEL: -endif +build_LDADD = ../util/libutil.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c @@ -43,28 +31,25 @@ CPRODS = $(CHPRODS) $(CCPRODS) BPRODS = $(BHPRODS) $(BCPRODS) TRASH = error delim.dat template -PRODUCTS = $(CPRODS) $(BPRODS) +BUILT_SOURCES = $(CPRODS) $(BPRODS) +CLEANFILES = $(BUILT_SOURCES) $(TRASH) BDONE CDONE -all:: $(PRODUCTS) +# We want the commands that actually create BPRODS and CPRODS to only +# run once during a make so we gate them using these CDONE and BDONE +# targets. This allows us to enable parallel building too. +$(BPRODS): BDONE -$(BPRODS): build $(HELPDTDFILE) - $(RM) $(BPRODS) $(BTRASH) - ./build < $(HELPDTDFILE) +$(CPRODS): CDONE -$(CPRODS): $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.bld context.dat - $(RM) $(CPRODS) $(CTRASH) - $(CP) $(HELPTAGSRC)/delim.bld delim.dat #appl.-specific delim.dat - $(HELPUTILSRC)/context sparse +# build the BRPODS +BDONE: ./build $(HELPDTDFILE) + $(RM) $(BPRODS) $(BTRASH) && ./build < $(HELPDTDFILE) && touch BDONE -$(HELPUTILSRC)/context: - cd $(HELPUTILSRC); make context -arc package : - if exist util.arc $(CP) build.arc old.arc - $(ARCCMD) util.arc *.c *.h makefile +# build the CRPODS +CDONE: $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.bld context.dat + $(RM) $(CPRODS) $(CTRASH) + $(CP) $(HELPTAGSRC)/delim.bld delim.dat # appl.-specific delim.dat + $(HELPUTILSRC)/context sparse + touch CDONE -unarc dearc : - $(UNARCCMD) util.arc - -clean:: - $(RM) $(PRODUCTS) $(TRASH) diff --git a/cde/programs/dthelp/parser/pass1/eltdef/Makefile.am b/cde/programs/dthelp/parser/pass1/eltdef/Makefile.am index 8b3c8d6f3..9d0453243 100644 --- a/cde/programs/dthelp/parser/pass1/eltdef/Makefile.am +++ b/cde/programs/dthelp/parser/pass1/eltdef/Makefile.am @@ -2,10 +2,6 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef -ARCCMD = arc u -UNARCCMD = arc x -ARCDELCMD = arc d - HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -17,15 +13,7 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a HELPIFFILE = $(HELPTAGSRC)/help.if HELPTSSFILE = $(HELPTAGSRC)/htag.tss -eltdef_LDADD = -l$(HELPUTILLIB) - -if HPUX -eltdef_LDFLAGS = -Wl,-a archive -endif - -if SOLARIS -.NO_PARALLEL: -endif +eltdef_LDADD = $(HELPUTILLIB) eltdef_CFLAGS = -I$(HELPUTILSRC) -I$(HELPBUILDSRC) @@ -44,28 +32,22 @@ CTRASH = delim.dat error ETRASH = estring.h error TRASH = delim.dat estring.h error -PRODUCTS = $(CPRODS) $(EPRODS) +BUILT_SOURCES = $(CPRODS) $(EPRODS) +CLEANFILES = $(BUILT_SOURCES) $(TRASH) CDONE EDONE -all:: $(PRODUCTS) +$(CPRODS): CDONE -$(EPRODS): eltdef $(HELPIFFILE) $(HELPTSSFILE) +$(EPRODS): EDONE + + +EDONE: eltdef $(HELPIFFILE) $(HELPTSSFILE) $(RM) $(EPRODS) $(ETRASH) ./eltdef $(HELPIFFILE) + touch EDONE -$(CPRODS): $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.elt context.dat +CDONE: $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.elt context.dat $(RM) $(CPRODS) $(CTRASH) $(CP) $(HELPTAGSRC)/delim.elt delim.dat # appl.-specific delim.dat $(HELPUTILSRC)/context + touch CDONE -$(HELPUTILSRC)/context: - cd $(HELPUTILSRC); make context - -arc package : - if exist util.arc $(CP) build.arc old.arc - $(ARCCMD) util.arc *.c *.h makefile - -unarc dearc : - $(UNARCCMD) util.arc - -clean:: - $(RM) $(PRODUCTS) $(TRASH) diff --git a/cde/programs/dthelp/parser/pass1/helptag/Makefile.am b/cde/programs/dthelp/parser/pass1/helptag/Makefile.am index ca07559ac..5e9da946b 100644 --- a/cde/programs/dthelp/parser/pass1/helptag/Makefile.am +++ b/cde/programs/dthelp/parser/pass1/helptag/Makefile.am @@ -1,10 +1,9 @@ MAINTAINERCLEANFILES = Makefile.in -bin_PROGRAMS = dthelp_htag1 - -ARCCMD = arc u -UNARCCMD = arc x -ARCDELCMD = arc d +# Due to the wierd interdepencencies between helptag and parser, +# disable parallel builds here. This is some really horrible code and +# design - not surprising since it dates to 1989. +.NOTPARALLEL: HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag @@ -17,51 +16,28 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a HELPIFFILE = $(HELPTAGSRC)/help.if HELPTSSFILE = $(HELPTAGSRC)/htag.tss -XLATESRC = $(DTHELPSRC) -XLATEHDRS = $(XLATESRC)/XlationSvc.h $(XLATESRC)/LocaleXlate.h -XLATESRCS = ${top_srcdir}/lib/DtSvc/DtUtil2/XlationSvc.c \ - ${top_srcdir}/lib/DtSvc/DtUtil2/LocaleXlate.c +XLATESRCS = XlationSvc.c LocaleXlate.c -ELTHDRS = $(HELPUTILSRC)/entdef.h $(HELPUTILSRC)/entext.h +XLATESRCDIR = ${top_srcdir}/lib/DtSvc/DtUtil2 -# PARSEHDRS are header files used by many parser routines -PARSEHDRS = $(HELPUTILSRC)/basic.h $(HELPUTILSRC)/trie.h \ - $(HELPUTILSRC)/common.h $(HELPUTILSRC)/dtddef.h \ - $(HELPUTILSRC)/dtdext.h $(HELPUTILSRC)/sparse.h \ - parser.h proto.h +$(XLATESRCS): XDONE -APPLHDRS = $(PARSEHDRS) $(ELTHDRS) \ - $(HELPUTILSRC)/version.h \ - $(HELPTAGSRC)/global.h $(HELPTAGSRC)/charconv.h \ - $(HELPTAGSRC)/roman8.h $(HELPTAGSRC)/fproto.h \ - ../parser/pval.h ../parser/globdec.h ../parser/signonx.h \ - ../parser/userinc.h +XDONE: $(XLATESRCDIR)/XlationSvc.c $(XLATESRCDIR)/LocaleXlate.c + $(RM) $(XLATESRCS) + $(CP) $(XLATESRCDIR)/XlationSvc.c XlationSvc.c + $(CP) $(XLATESRCDIR)/LocaleXlate.c LocaleXlate.c + cd ../parser; $(MAKE) CDONE + touch XDONE -dthelp_htag1_CFLAGS = -I$(HELPUTILSRC) -I$(HELPPARSERSRC) -I$(HELPELTDEFSRC) \ - -I$(XLATESRC) +BUILT_SOURCES = $(XLATESRCS) +CLEANFILES = $(BUILT_SOURCES) XDONE -dthelp_htag1_LDADD = $(HELPUTILLIB) +AM_CPPFLAGS = -I. -I$(HELPPARSERSRC) -I$(HELPUTILSRC) \ + -I$(HELPELTDEFSRC) -I$(XLATESRCDIR) $(DT_INCDIR) -if HPUX -dthelp_htag1_LDFLAGS = -Wl,-a archive -endif - -if SOLARIS -dthelp_htag1_LDADD += -lm -ldl -lgen -endif - -dthelp_htag1_SOURCES = custom.c default.c help.c make.c option.c out.c \ - special.c xref.c $(XLATESRCS) - -dthelp_htag1$(EXEEXT): $(HELPPARSERSRC)/parser - $(RM) dthelp_htag1 - $(CP) $(HELPPARSERSRC)/parser dthelp_htag1 - -arcappl archptag : - if exist hptag.arc $(CP) hptag.arc hptag.old - $(ARCCMD) hptag.arc *.c *.h linkcmd.dos linkcmd.unx $(HELPDTDFILE) \ - tex.if makefile makefile.doc make.ini delim.* - -unarcappl unarchptag : - $(UNARCCMD) hptag.arc +# needed by parser/ +noinst_LIBRARIES = libhelptag.a +libhelptag_a_SOURCES = custom.c default.c help.c make.c option.c \ + special.c out.c xref.c $(XLATESRCS) \ + ../parser/delim.h diff --git a/cde/programs/dthelp/parser/pass1/parser/Makefile.am b/cde/programs/dthelp/parser/pass1/parser/Makefile.am new file mode 100644 index 000000000..2352373c0 --- /dev/null +++ b/cde/programs/dthelp/parser/pass1/parser/Makefile.am @@ -0,0 +1,49 @@ +MAINTAINERCLEANFILES = Makefile.in + +bin_PROGRAMS = dthelp_htag1 + +# Due to the wierd interdepencencies between helptag and parser, +# disable parallel builds here. This is some really horrible code and +# design - not surprising since it dates to 1989. +.NOTPARALLEL: + +HELPTAG = .. +HELPTAGSRC = $(HELPTAG)/helptag +HELPPARSERSRC = $(HELPTAG)/parser +HELPELTDEFSRC = $(HELPTAG)/eltdef +HELPDTDFILE = $(HELPTAGSRC)/hptag.dtd +HELPUTILSRC = $(HELPTAG)/util +HELPBUILDSRC = $(HELPTAG)/build +HELPUTILLIB = $(HELPTAG)/util/libutil.a + +AM_CPPFLAGS = -I. -I$(HELPUTILSRC) -I$(HELPTAGSRC) -I$(HELPBUILDSRC) \ + -I$(HELPELTDEFSRC) + +dthelp_htag1_SOURCES = parser.c actutil.c \ + closent.c code.c cyclent.c dcurelt.c \ + end.c entity.c \ + error.c getsign.c \ + input.c level.c lookent.c \ + minim.c optstrg.c param.c parent.c \ + parutil.c pi.c \ + scan.c setpar.c start.c string.c struct.c \ + text.c + +APPLOBJECTS = ../helptag/libhelptag.a + +dthelp_htag1_LDADD = $(APPLOBJECTS) $(HELPUTILLIB) $(DTCLIENTLIBS) $(XTOOLLIB) + +CPRODS = case.c context.h delim.h +CTRASH = error delim.dat + +BUILT_SOURCES = $(CPRODS) +CLEANFILES = $(BUILT_SOURCES) $(CTRASH) CDONE + +$(CPRODS): CDONE + +CDONE: $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.par context.dat + $(RM) $(CPRODS) $(CTRASH) + $(CP) $(HELPTAGSRC)/delim.par delim.dat # appl.-specific delim.dat + $(HELPUTILSRC)/context + touch CDONE + diff --git a/cde/programs/dthelp/parser/pass1/util/Makefile.am b/cde/programs/dthelp/parser/pass1/util/Makefile.am new file mode 100644 index 000000000..4826cd82e --- /dev/null +++ b/cde/programs/dthelp/parser/pass1/util/Makefile.am @@ -0,0 +1,21 @@ +MAINTAINERCLEANFILES = Makefile.in + +noinst_LIBRARIES = libutil.a + +noinst_PROGRAMS = context fclndir + +context_SOURCES = context.c + +fclndir_SOURCES = context.c + +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 lower.c malloc.c openchk.c \ + trie.c triecnt.c upper.c whitesp.c basic.h common.h \ + dtddef.h entdef.h sparse.h trie.h chartype.h cont.h dtdext.h \ + entext.h sref.h version.h + +# FIXME I think emptyfil.c and fclndir.c can be deleted? + +context_LDADD = libutil.a +fclndir_LDADD = libutil.a