From 67077a1b46f525ad9d181851037e3813c6da4655 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 21 Mar 2000 17:11:40 +0000 Subject: [PATCH] Patches rtems-rc-4.5.0-1.diff from Ralf Corsepius that addresses the following: * Duplicate variables in Makefiles (many Makefile.ams below c/src/test are affected systematically) * Erroniously using local.am instead of host.am in host-Makefile.am (Only host Makefile.ams should be affected; Erroniously using local.am in host-Makefiles doesn't desturb much) * use '.' instead of '$pwd' in ./bootstrap (using $pwd does not work if $pwd is a symlink on linux). * Broken CVS Ids somewhere * Removing redundant/obsolete make variables from *.cfg files. Except of the last item from the list above, most parts of this patch are fairly harmless, sometimes even cosmetical. As mentioned before, this patch also contains a new ampolish script. This script features: * Pretty printing of Makefile.ams (eg. removal of trailing spaces, removal of duplicate empty lines, pretty printing make variables, etc.). * Some syntactical checks on the contents of Makefiles.am * Proper handling of Automake conditionals FYI: * Applying tools/update/rtems-polish.sh -am completely reformats all Makefile.am resulting into a very large (~500k) diff. * Applying tools/update/rtems-polish.sh -am twice, finally does not reformat the Makefile.ams anymore. * Many parts of the patch above result from merging back issues which have shown when applying this new ampolish (i.e. partially result from extracting the essentials of reformating being proposed by applying it on Makefile.ams). Though this ampolish is a very nice tool, IMHO, I am hestitant if you should apply (i.e. run tools/update/rtems-polish.sh -am) it to the sources before the release, because * the resulting diff is fairly large * I am not 100% sure it doesn't break anything. However, applying it after the release would result into compatibility problems in applying patches ;) I would suggest that you might consider trying it locally, then to examine the diff and then to decide whether to apply it in general or not. Joel's Comments: As Ralf points out, this patch is problematic in that applying it before a release could break things but applying it afterwards will result in patches being unusable for Makefiles. My inclination is to forge ahead and apply it. --- automake/local.am | 1 - bootstrap | 2 +- .../libbsp/hppa1.1/simhppa/wrapup/Makefile.am | 3 +- c/src/lib/libbsp/i386/pc386/tools/Makefile.am | 2 +- .../libbsp/i386/ts_386ex/tools/Makefile.am | 2 +- .../libbsp/i960/cvme961/wrapup/Makefile.am | 4 +- .../libbsp/i960/rxgen960/wrapup/Makefile.am | 4 +- .../libbsp/m68k/mvme136/wrapup/Makefile.am | 4 +- .../libbsp/m68k/mvme147s/wrapup/Makefile.am | 4 +- .../lib/libbsp/m68k/mvme162/tools/Makefile.am | 2 +- .../libbsp/no_cpu/no_bsp/wrapup/Makefile.am | 4 +- .../powerpc/ppcn_60x/startup/Makefile.am | 2 +- .../libbsp/powerpc/psim/wrapup/Makefile.am | 4 +- c/src/make/Makefile.am | 3 - c/src/make/main.cfg.in | 42 +- c/src/tests/itrontests/itronhello/Makefile.am | 2 - c/src/tests/itrontests/itronmbf01/Makefile.am | 2 - .../tests/itrontests/itronmbox01/Makefile.am | 2 - c/src/tests/itrontests/itronsem01/Makefile.am | 2 - .../tests/itrontests/itrontask01/Makefile.am | 2 - .../tests/itrontests/itrontask02/Makefile.am | 2 - .../tests/itrontests/itrontask03/Makefile.am | 2 - .../tests/itrontests/itrontask04/Makefile.am | 2 - .../tests/itrontests/itrontime01/Makefile.am | 2 - c/src/tests/mptests/mp14/Makefile.am | 3 +- c/src/tests/psxtests/psxfile01/Makefile.am | 2 - c/src/tests/samples/cdtest/Makefile.am | 2 - c/src/tests/samples/hello/Makefile.am | 2 - c/src/tests/samples/minimum/Makefile.am | 2 - c/src/tests/samples/paranoia/Makefile.am | 2 - c/src/tests/samples/ticker/Makefile.am | 2 - c/src/tests/samples/unlimited/Makefile.am | 2 - c/src/tests/support/stubdr/Makefile.am | 4 +- c/src/tests/support/wrapup/Makefile.am | 3 +- c/src/tests/tools/Makefile.am | 2 +- c/src/tests/tools/generic/Makefile.am | 6 +- make/compilers/gcc-no_bsp.cfg | 4 - make/compilers/gcc-portsw.cfg | 4 - make/compilers/gcc-target-default.cfg | 4 - make/custom/dmv177.cfg | 1 - make/custom/simhppa.cfg | 4 - make/leaf.cfg | 2 +- tools/update/ampolish | 529 +++++++++++++++--- 43 files changed, 488 insertions(+), 193 deletions(-) diff --git a/automake/local.am b/automake/local.am index a98f3dea5a..4cf0f85a3f 100644 --- a/automake/local.am +++ b/automake/local.am @@ -8,7 +8,6 @@ debug-am: $(MAKE) $(AM_MAKEFLAGS) "ARCH=o-debug" \ "CFLAGS_DEBUG=$(CFLAGS_DEBUG_V)" \ - "CFLAGS_OPTIMIZE=$(CFLAGS_DEBUG_OPTIMIZE_V)" \ "LDFLAGS_DEBUG=$(LDFLAGS_DEBUG_V)" $(TARGET_VA) debug: debug-am diff --git a/bootstrap b/bootstrap index 2672595433..24470802e7 100755 --- a/bootstrap +++ b/bootstrap @@ -61,7 +61,7 @@ pwd=`pwd`; case $mode in generate) - confs=`find $pwd -name 'configure.in' -print` + confs=`find . -name 'configure.in' -print` aclocal_dir=$pwd/aclocal for i in $confs; do dir=`dirname $i`; diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/wrapup/Makefile.am b/c/src/lib/libbsp/hppa1.1/simhppa/wrapup/Makefile.am index 6cf429adda..12eec94684 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/wrapup/Makefile.am +++ b/c/src/lib/libbsp/hppa1.1/simhppa/wrapup/Makefile.am @@ -4,7 +4,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 -BSP_FILES = startup tty # pieces to pick up out of libcpu/hppa CPU_FILES = clock milli timer @@ -16,7 +15,7 @@ GENERIC_FILES = $(GENERIC_MP_REL_FILES) if HAS_MP BSP_MP_O_FILES = shmsupp endif -BSP_FILES = $(BSP_MP_O_FILES) +BSP_FILES = start tty $(BSP_MP_O_FILES) include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../../../automake/lib.am diff --git a/c/src/lib/libbsp/i386/pc386/tools/Makefile.am b/c/src/lib/libbsp/i386/pc386/tools/Makefile.am index 43049dd3b7..585dd2883d 100644 --- a/c/src/lib/libbsp/i386/pc386/tools/Makefile.am +++ b/c/src/lib/libbsp/i386/pc386/tools/Makefile.am @@ -25,4 +25,4 @@ PREINSTALL_FILES = \ ## HACK: install into build-tree all-local: $(PREINSTALL_FILES) -include $(top_srcdir)/../../../../../../../automake/local.am +include $(top_srcdir)/../../../../../../../automake/host.am diff --git a/c/src/lib/libbsp/i386/ts_386ex/tools/Makefile.am b/c/src/lib/libbsp/i386/ts_386ex/tools/Makefile.am index 20363ef67b..05bcffd2c8 100644 --- a/c/src/lib/libbsp/i386/ts_386ex/tools/Makefile.am +++ b/c/src/lib/libbsp/i386/ts_386ex/tools/Makefile.am @@ -20,4 +20,4 @@ EXTRA_DIST = \ $(noinst_SCRIPTS) include $(top_srcdir)/../../../../../../../automake/subdirs.am -include $(top_srcdir)/../../../../../../../automake/local.am +include $(top_srcdir)/../../../../../../../automake/host.am diff --git a/c/src/lib/libbsp/i960/cvme961/wrapup/Makefile.am b/c/src/lib/libbsp/i960/cvme961/wrapup/Makefile.am index d43901b9b3..43f8d77768 100644 --- a/c/src/lib/libbsp/i960/cvme961/wrapup/Makefile.am +++ b/c/src/lib/libbsp/i960/cvme961/wrapup/Makefile.am @@ -4,8 +4,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 -BSP_FILES = startup clock console timer - if HAS_MP GENERIC_MP_REL_FILES = shmdr endif @@ -14,7 +12,7 @@ GENERIC_FILES += $(GENERIC_MP_REL_FILES) if HAS_MP BSP_MP_O_FILES = shmsupp endif -BSP_FILES += $(BSP_MP_O_FILES) +BSP_FILES = startup clock console timer $(BSP_MP_O_FILES) include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../../../automake/lib.am diff --git a/c/src/lib/libbsp/i960/rxgen960/wrapup/Makefile.am b/c/src/lib/libbsp/i960/rxgen960/wrapup/Makefile.am index f69c7f24ca..1783fbd3dc 100644 --- a/c/src/lib/libbsp/i960/rxgen960/wrapup/Makefile.am +++ b/c/src/lib/libbsp/i960/rxgen960/wrapup/Makefile.am @@ -7,8 +7,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../../../automake/lib.am -BSP_PIECES = startup clock console timer - if HAS_MP GENERIC_MP_REL_PIECES = shmdr endif @@ -17,7 +15,7 @@ GENERIC_PIECES += $(GENERIC_MP_REL_PIECES) if HAS_MP BSP_MP_O_PIECES = shmsupp endif -BSP_PIECES += $(BSP_MP_O_PIECES) +BSP_PIECES = startup clock console timer $(BSP_MP_O_PIECES) # bummer; have to use $foreach since % pattern subst rules only replace 1x OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ diff --git a/c/src/lib/libbsp/m68k/mvme136/wrapup/Makefile.am b/c/src/lib/libbsp/m68k/mvme136/wrapup/Makefile.am index f69c7f24ca..1783fbd3dc 100644 --- a/c/src/lib/libbsp/m68k/mvme136/wrapup/Makefile.am +++ b/c/src/lib/libbsp/m68k/mvme136/wrapup/Makefile.am @@ -7,8 +7,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../../../automake/lib.am -BSP_PIECES = startup clock console timer - if HAS_MP GENERIC_MP_REL_PIECES = shmdr endif @@ -17,7 +15,7 @@ GENERIC_PIECES += $(GENERIC_MP_REL_PIECES) if HAS_MP BSP_MP_O_PIECES = shmsupp endif -BSP_PIECES += $(BSP_MP_O_PIECES) +BSP_PIECES = startup clock console timer $(BSP_MP_O_PIECES) # bummer; have to use $foreach since % pattern subst rules only replace 1x OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ diff --git a/c/src/lib/libbsp/m68k/mvme147s/wrapup/Makefile.am b/c/src/lib/libbsp/m68k/mvme147s/wrapup/Makefile.am index f69c7f24ca..1783fbd3dc 100644 --- a/c/src/lib/libbsp/m68k/mvme147s/wrapup/Makefile.am +++ b/c/src/lib/libbsp/m68k/mvme147s/wrapup/Makefile.am @@ -7,8 +7,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../../../automake/lib.am -BSP_PIECES = startup clock console timer - if HAS_MP GENERIC_MP_REL_PIECES = shmdr endif @@ -17,7 +15,7 @@ GENERIC_PIECES += $(GENERIC_MP_REL_PIECES) if HAS_MP BSP_MP_O_PIECES = shmsupp endif -BSP_PIECES += $(BSP_MP_O_PIECES) +BSP_PIECES = startup clock console timer $(BSP_MP_O_PIECES) # bummer; have to use $foreach since % pattern subst rules only replace 1x OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ diff --git a/c/src/lib/libbsp/m68k/mvme162/tools/Makefile.am b/c/src/lib/libbsp/m68k/mvme162/tools/Makefile.am index ddeb10f584..2e27c091ee 100644 --- a/c/src/lib/libbsp/m68k/mvme162/tools/Makefile.am +++ b/c/src/lib/libbsp/m68k/mvme162/tools/Makefile.am @@ -14,4 +14,4 @@ install-exec-local: $(PROGRAMS) $(mkinstalldirs) $(PROJECT_ROOT)/mvme162/bin $(INSTALL_PROGRAM) $(PROGRAMS) $(PROJECT_ROOT)/mvme162/bin -include $(top_srcdir)/../../../../../../../automake/local.am +include $(top_srcdir)/../../../../../../../automake/host.am diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/wrapup/Makefile.am b/c/src/lib/libbsp/no_cpu/no_bsp/wrapup/Makefile.am index 3b0aa7b02d..66cc5b2303 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/wrapup/Makefile.am +++ b/c/src/lib/libbsp/no_cpu/no_bsp/wrapup/Makefile.am @@ -4,8 +4,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 -BSP_FILES = startup clock console timer - if HAS_MP GENERIC_MP_REL_FILES = shmdr endif @@ -14,7 +12,7 @@ GENERIC_FILES = $(GENERIC_MP_REL_FILES) if HAS_MP BSP_MP_O_FILES = shmsupp endif -BSP_FILES = $(BSP_MP_O_FILES) +BSP_FILES = startup clock console timer $(BSP_MP_O_FILES) # bummer; have to use $foreach since % pattern subst rules only replace 1x OBJS = $(foreach piece, $(BSP_FILES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ diff --git a/c/src/lib/libbsp/powerpc/ppcn_60x/startup/Makefile.am b/c/src/lib/libbsp/powerpc/ppcn_60x/startup/Makefile.am index 903436dfef..61988b07f4 100644 --- a/c/src/lib/libbsp/powerpc/ppcn_60x/startup/Makefile.am +++ b/c/src/lib/libbsp/powerpc/ppcn_60x/startup/Makefile.am @@ -1,5 +1,5 @@ ## -## $Id: +## $Id$ ## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/lib/libbsp/powerpc/psim/wrapup/Makefile.am b/c/src/lib/libbsp/powerpc/psim/wrapup/Makefile.am index d2f956fb88..241b4b1f1c 100644 --- a/c/src/lib/libbsp/powerpc/psim/wrapup/Makefile.am +++ b/c/src/lib/libbsp/powerpc/psim/wrapup/Makefile.am @@ -7,8 +7,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../../../automake/lib.am -BSP_PIECES = startup clock console timer vectors - if HAS_MP GENERIC_MP_REL_PIECES = shmdr endif @@ -17,7 +15,7 @@ GENERIC_PIECES += $(GENERIC_MP_REL_PIECES) if HAS_MP BSP_MP_O_PIECES = shmsupp endif -BSP_PIECES += $(BSP_MP_O_PIECES) +BSP_PIECES = startup clock console timer vectors $(BSP_MP_O_PIECES) # bummer; have to use $foreach since % pattern subst rules only replace 1x OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ diff --git a/c/src/make/Makefile.am b/c/src/make/Makefile.am index e86b688293..413dd83719 100644 --- a/c/src/make/Makefile.am +++ b/c/src/make/Makefile.am @@ -31,9 +31,6 @@ rtems_bsp_make_DATA = \ bsp.cfg if MAINTAINER_MODE -$(srcdir)/main.cfg.in: $(top_srcdir)/@RTEMS_TOPdir@/make/main.cfg - sed -e 's%\$$(RTEMS_BSP)%\@RTEMS_BSP\@%g' < $< >$@ - $(srcdir)/host.cfg.in: $(top_srcdir)/@RTEMS_TOPdir@/make/host.cfg.in cp $< $@ diff --git a/c/src/make/main.cfg.in b/c/src/make/main.cfg.in index 4ca3480d41..05aa314b30 100644 --- a/c/src/make/main.cfg.in +++ b/c/src/make/main.cfg.in @@ -4,15 +4,14 @@ # # Make(1) configuration file include'd by all Makefile's # +# NOTE: This file does not get exported from the source tree +# # # where things are relative to PROJECT_ROOT; shouldn't need to change, # but could be overridden in custom files. # -PROJECT_RELEASE=$(PROJECT_ROOT)/@RTEMS_BSP@ -PROJECT_BIN=$(PROJECT_RELEASE)/bin -PROJECT_INCLUDE=$(PROJECT_RELEASE)/lib/include PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools # @@ -24,21 +23,6 @@ ARCH=o-optimize VARIANT= -# -# Initial target for make(1) -# Once this is established we can safely include other targets -# within this make-include file. -# - -default_target: all - -# -# Default makefile name -# May be overridden by command line macro assignment -# - -MAKEFILE=Makefile - # # Target variant names # @@ -49,27 +33,5 @@ TARGET_VARIANTS = optimize debug profile # VARIANTS=${TARGET_VARIANTS:%=o-%} -# -# List of "recursion-able" targets for directory Makefiles -# - -RECURSE_TARGETS=all depend install \ -preinstall-recursive \ -$(TARGET_VARIANTS) - ${ARCH}: test -d ${ARCH} || mkdir ${ARCH} - -ifndef AUTOMAKE -distclean-generic: - -$(RM) .#* $(CONFIG_CLEAN_FILES) - -$(RM) -r $(CLOBBER_ADDITIONS) - -clean-generic: - -$(RM) a.out core mon.out gmon.out - -$(RM) -r $(CLEAN_ADDITIONS) -endif - -.PHONY: $(RECURSE_TARGETS) -.PHONY: clean-generic -.PHONY: distclean-generic diff --git a/c/src/tests/itrontests/itronhello/Makefile.am b/c/src/tests/itrontests/itronhello/Makefile.am index 4507631ccd..a95c1a50fc 100644 --- a/c/src/tests/itrontests/itronhello/Makefile.am +++ b/c/src/tests/itrontests/itronhello/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itronmbf01/Makefile.am b/c/src/tests/itrontests/itronmbf01/Makefile.am index 7a1b7c2eee..f53953f6d2 100644 --- a/c/src/tests/itrontests/itronmbf01/Makefile.am +++ b/c/src/tests/itrontests/itronmbf01/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itronmbox01/Makefile.am b/c/src/tests/itrontests/itronmbox01/Makefile.am index 0b154bae50..d93df4fe39 100644 --- a/c/src/tests/itrontests/itronmbox01/Makefile.am +++ b/c/src/tests/itrontests/itronmbox01/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itronsem01/Makefile.am b/c/src/tests/itrontests/itronsem01/Makefile.am index fee97a7d17..b379ffe1de 100644 --- a/c/src/tests/itrontests/itronsem01/Makefile.am +++ b/c/src/tests/itrontests/itronsem01/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itrontask01/Makefile.am b/c/src/tests/itrontests/itrontask01/Makefile.am index 8ccdafd176..244a1bf760 100644 --- a/c/src/tests/itrontests/itrontask01/Makefile.am +++ b/c/src/tests/itrontests/itrontask01/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itrontask02/Makefile.am b/c/src/tests/itrontests/itrontask02/Makefile.am index 54dc405a4c..d424fc088d 100644 --- a/c/src/tests/itrontests/itrontask02/Makefile.am +++ b/c/src/tests/itrontests/itrontask02/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itrontask03/Makefile.am b/c/src/tests/itrontests/itrontask03/Makefile.am index fb1ebc89ed..d98ead2b53 100644 --- a/c/src/tests/itrontests/itrontask03/Makefile.am +++ b/c/src/tests/itrontests/itrontask03/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itrontask04/Makefile.am b/c/src/tests/itrontests/itrontask04/Makefile.am index d3d2d60902..a1875a2b43 100644 --- a/c/src/tests/itrontests/itrontask04/Makefile.am +++ b/c/src/tests/itrontests/itrontask04/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/itrontests/itrontime01/Makefile.am b/c/src/tests/itrontests/itrontime01/Makefile.am index ffbfb346bf..44a1f89020 100644 --- a/c/src/tests/itrontests/itrontime01/Makefile.am +++ b/c/src/tests/itrontests/itrontime01/Makefile.am @@ -22,8 +22,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(TEST).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/itrontests.am diff --git a/c/src/tests/mptests/mp14/Makefile.am b/c/src/tests/mptests/mp14/Makefile.am index db1ff08d1d..2a2950ef0e 100644 --- a/c/src/tests/mptests/mp14/Makefile.am +++ b/c/src/tests/mptests/mp14/Makefile.am @@ -6,7 +6,8 @@ AUTOMAKE_OPTIONS = foreign 1.4 SUBDIRS = node1 node2 -EXTRA_DIST = system.h delay.c evtask1.c evtmtask.c exit.c init.c msgtask1.c pttask1.c smtask1.c +EXTRA_DIST = system.h delay.c evtask1.c evtmtask.c exit.c init.c msgtask1.c \ + pttask1.c smtask1.c include $(top_srcdir)/../../../../automake/subdirs.am include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/tests/psxtests/psxfile01/Makefile.am b/c/src/tests/psxtests/psxfile01/Makefile.am index cc98f3d0bf..a042cc60ef 100644 --- a/c/src/tests/psxtests/psxfile01/Makefile.am +++ b/c/src/tests/psxtests/psxfile01/Makefile.am @@ -4,8 +4,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 -VPATH = @srcdir@ - TEST = psxfile01 MANAGERS = all diff --git a/c/src/tests/samples/cdtest/Makefile.am b/c/src/tests/samples/cdtest/Makefile.am index 0fd0c412b8..d300f81494 100644 --- a/c/src/tests/samples/cdtest/Makefile.am +++ b/c/src/tests/samples/cdtest/Makefile.am @@ -26,8 +26,6 @@ OBJS = $(C_O_FILES) $(CC_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(SAMPLE).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/sample.am diff --git a/c/src/tests/samples/hello/Makefile.am b/c/src/tests/samples/hello/Makefile.am index 3d0c031368..c0aa98dfc9 100644 --- a/c/src/tests/samples/hello/Makefile.am +++ b/c/src/tests/samples/hello/Makefile.am @@ -23,8 +23,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(SAMPLE).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/sample.am diff --git a/c/src/tests/samples/minimum/Makefile.am b/c/src/tests/samples/minimum/Makefile.am index 02b64d3be9..ceae017108 100644 --- a/c/src/tests/samples/minimum/Makefile.am +++ b/c/src/tests/samples/minimum/Makefile.am @@ -20,8 +20,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(SAMPLE).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/sample.am diff --git a/c/src/tests/samples/paranoia/Makefile.am b/c/src/tests/samples/paranoia/Makefile.am index 660c367434..317df1ff11 100644 --- a/c/src/tests/samples/paranoia/Makefile.am +++ b/c/src/tests/samples/paranoia/Makefile.am @@ -23,8 +23,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(SAMPLE).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/sample.am diff --git a/c/src/tests/samples/ticker/Makefile.am b/c/src/tests/samples/ticker/Makefile.am index 944bf9eace..16b7e0ce32 100644 --- a/c/src/tests/samples/ticker/Makefile.am +++ b/c/src/tests/samples/ticker/Makefile.am @@ -23,8 +23,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(SAMPLE).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/sample.am diff --git a/c/src/tests/samples/unlimited/Makefile.am b/c/src/tests/samples/unlimited/Makefile.am index 33ecc50197..0b6c2da6fd 100644 --- a/c/src/tests/samples/unlimited/Makefile.am +++ b/c/src/tests/samples/unlimited/Makefile.am @@ -23,8 +23,6 @@ OBJS = $(C_O_FILES) PRINT_SRCS = $(DOCS) -PGM = ${ARCH}/$(SAMPLE).exe - include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg include $(top_srcdir)/sample.am diff --git a/c/src/tests/support/stubdr/Makefile.am b/c/src/tests/support/stubdr/Makefile.am index 8829ea588b..76e9c66cf2 100644 --- a/c/src/tests/support/stubdr/Makefile.am +++ b/c/src/tests/support/stubdr/Makefile.am @@ -18,9 +18,7 @@ OBJS = $(C_O_FILES) include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(RTEMS_ROOT)/make/leaf.cfg -TMPINSTALL_FILES = \ -$(PROJECT_INCLUDE) \ -$(H_FILES:%=$(PROJECT_INCLUDE)/%) +TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(H_FILES:%=$(PROJECT_INCLUDE)/%) $(PROJECT_INCLUDE): @$(mkinstalldirs) $@ diff --git a/c/src/tests/support/wrapup/Makefile.am b/c/src/tests/support/wrapup/Makefile.am index 752951613f..41762e0cb0 100644 --- a/c/src/tests/support/wrapup/Makefile.am +++ b/c/src/tests/support/wrapup/Makefile.am @@ -19,8 +19,7 @@ include $(top_srcdir)/../../../../automake/lib.am # (OPTIONAL) Add local stuff here using += # -TMPINSTALL_FILES += \ -$(PROJECT_RELEASE)/lib/$(LIBNAME)$(LIB_VARIANT).a +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/$(LIBNAME)$(LIB_VARIANT).a $(LIB): ${OBJS} $(make-library) diff --git a/c/src/tests/tools/Makefile.am b/c/src/tests/tools/Makefile.am index ec01965fb6..8350d64884 100644 --- a/c/src/tests/tools/Makefile.am +++ b/c/src/tests/tools/Makefile.am @@ -8,4 +8,4 @@ ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal SUBDIRS = @subdirs@ include $(top_srcdir)/../../../../automake/subdirs.am -include $(top_srcdir)/../../../../automake/local.am +include $(top_srcdir)/../../../../automake/host.am diff --git a/c/src/tests/tools/generic/Makefile.am b/c/src/tests/tools/generic/Makefile.am index 489e31f40e..e16823c4fc 100644 --- a/c/src/tests/tools/generic/Makefile.am +++ b/c/src/tests/tools/generic/Makefile.am @@ -9,10 +9,8 @@ noinst_SCRIPTS = difftest sorttimes project_bspdir = $(PROJECT_ROOT)/@RTEMS_BSP@ -PREINSTALL_FILES = \ -$(project_bspdir)/tests \ -$(project_bspdir)/tests/difftest \ -$(project_bspdir)/tests/sorttimes +PREINSTALL_FILES += $(project_bspdir)/tests $(project_bspdir)/tests/difftest \ + $(project_bspdir)/tests/sorttimes $(project_bspdir)/tests: @$(mkinstalldirs) $@ diff --git a/make/compilers/gcc-no_bsp.cfg b/make/compilers/gcc-no_bsp.cfg index af2a88f580..02997de16b 100644 --- a/make/compilers/gcc-no_bsp.cfg +++ b/make/compilers/gcc-no_bsp.cfg @@ -78,10 +78,6 @@ CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer # debug flag; typically -g CFLAGS_DEBUG_V=-g -Wno-unused -# when debugging, optimize flag: typically empty -# some compilers do allow optimization with their "-g" -CFLAGS_DEBUG_OPTIMIZE_V= - # profile flag; use gprof(1) CFLAGS_PROFILE_V=-pg diff --git a/make/compilers/gcc-portsw.cfg b/make/compilers/gcc-portsw.cfg index 2d67ebb099..bc6870f3b7 100644 --- a/make/compilers/gcc-portsw.cfg +++ b/make/compilers/gcc-portsw.cfg @@ -59,10 +59,6 @@ CFLAGS_OPTIMIZE_V=-Os # debug flag; typically -g CFLAGS_DEBUG_V=-g -O0 -DRTEMS_DEBUG -DSTACK_CHECKER_ON -# when debugging, optimize flag: typically empty -# some compilers do allow optimization with their "-g" -CFLAGS_DEBUG_OPTIMIZE_V= - # profile flag; use gprof(1) CFLAGS_PROFILE_V= diff --git a/make/compilers/gcc-target-default.cfg b/make/compilers/gcc-target-default.cfg index 88b5e58c0d..62757713d9 100644 --- a/make/compilers/gcc-target-default.cfg +++ b/make/compilers/gcc-target-default.cfg @@ -93,10 +93,6 @@ ifeq ($(RTEMS_USE_GCC272),no) CFLAGS_DEBUG_V+=-qrtems_debug endif -# when debugging, optimize flag: typically empty -# some compilers do allow optimization with their "-g" -CFLAGS_DEBUG_OPTIMIZE_V=-g - # profile flag; use gprof(1) CFLAGS_PROFILE_V=-pg diff --git a/make/custom/dmv177.cfg b/make/custom/dmv177.cfg index 4f42ef6e81..73f2042a5e 100644 --- a/make/custom/dmv177.cfg +++ b/make/custom/dmv177.cfg @@ -84,7 +84,6 @@ endef # and (hopefully) optimize for it. # CPU_CFLAGS = -mcpu=603 -#CFLAGS_DEBUG_OPTIMIZE_V= # optimize flag: typically -0, could use -O4 or -fast # -O4 is ok for RTEMS diff --git a/make/custom/simhppa.cfg b/make/custom/simhppa.cfg index 93e25b0f9c..ed5de71bda 100644 --- a/make/custom/simhppa.cfg +++ b/make/custom/simhppa.cfg @@ -125,10 +125,6 @@ define make-exe endef endif -define make-rel - $(LDARGS) $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $(OBJS) -endef - # Miscellaneous additions go here # BSP-specific tools diff --git a/make/leaf.cfg b/make/leaf.cfg index a8b90ee1f1..a4f29aa6ef 100644 --- a/make/leaf.cfg +++ b/make/leaf.cfg @@ -49,7 +49,7 @@ ifndef AUTOMAKE debug: $(MAKE) -f $(MAKEFILE) MAKEFILE=$(MAKEFILE) "ARCH=o-debug" \ "CFLAGS_DEBUG=$(CFLAGS_DEBUG_V)" \ - "CFLAGS_OPTIMIZE=$(CFLAGS_DEBUG_OPTIMIZE_V)" \ + "CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)" \ "LDFLAGS_DEBUG=$(LDFLAGS_DEBUG_V)" $(TARGET_VA) profile: diff --git a/tools/update/ampolish b/tools/update/ampolish index 0d79581f26..d36da726da 100755 --- a/tools/update/ampolish +++ b/tools/update/ampolish @@ -1,5 +1,7 @@ #!/usr/bin/perl +package main ; + use strict ; # @@ -11,9 +13,334 @@ use strict ; # /ampolish Makefile.am~ # mv Makefile.am~ Makefile.am # -# ATTENTION: This file contains embedded tabs -my $subdirs_seen = "" ; +my @vars ; +my @conditions = ( "" ) ; +my @buffer = (); +my %var_ ; + +define_variable( "\$(AUTOMAKE_OPTIONS)", ( "foreign", "1.4" ) ); +define_variable( "\$(VPATH)", ( "\@srcdir\@" ) ); + +# find relative up-path to configure.in +my $rtems_cfg = find_file(".","configure.in"); + +# find relative up-path from configure.in to VERSION +my $rtems_top = find_file("$rtems_cfg","VERSION"); + +if ( "$rtems_top" eq "." ) { $rtems_top = "" ; } +else { $rtems_top .= "/" ; } + +{ +# PASS1: +# read input file and concatenate multiple lines into single lines. + + my @ibuf = () ; + + while( ) + { # consume header + last if ( /^[^#].*$/ ) ; + push @ibuf, "$_" ; + } + + push @ibuf, "§header\n" ; + + do + { + if ( /^(#.*)$/o ) + { # preserve comments + push @ibuf, "$_" ; + } + elsif ( /^(\t.*)\\[\s]*$/o ) + { # multilines for scripts + my $line = "$1§" ; + while( ) + { + if ( /^(.*)\\[\s]*$/o ) + { + $line .= "$1§" ; + } + else + { + $line .= "$_" ; + push @ibuf, $line ; + last ; + } + } + } + elsif ( /^(.*)\\[\s]*$/o ) + { # multilines + my $line = "$1" ; + while( ) + { + if ( /^(.*)\\[\s]*$/o ) + { + $line .= "$1" ; + } + else + { + $line .= "$_" ; + $line =~ s%[\s]+% %g ; + push @ibuf, "$line\n" ; + last ; + } + } + } + else + { + push @ibuf, "$_" ; + } + } while ( ) ; + @buffer = @ibuf ; +} + +{ +# PASS2: +# fix obsolete constructs + my @ibuf = () ; + + foreach ( @buffer ) + { +# tr /\{\}/\(\)/ ; + + if ( /^(TMP|PRE)INSTALL_FILES[\s]*=(.*)$/o ) + { # force "+=" + push @ibuf, "$1INSTALL_FILES +=$2\n" ; + } + elsif ( /^(VPATH|EXTRA_DIST)[\s]*\+=(.*)$/o ) + { # force "=" + push @ibuf, "$1 = $2\n" ; + } + elsif ( /^[\s]*ACLOCAL[\s]*=[\s]*\@ACLOCAL\@.*$/o ) + { # remove the line + } + elsif ( /^[\s]*(ACLOCAL_AMFLAGS)[\s\t]*[\+]*=[\s]*(.*)[\s]*$/o ) + { # remove the line + } + elsif ( /^[\s]*debug-am:.*$/o ) + { # remove the line + } + elsif ( /^[\s]*profile-am:.*$/o ) + { # remove the line + } + elsif ( /^[\s]*include[\s\t]*\$\(RTEMS_ROOT\)\/make\/lib.cfg[\s]*$/o ) + { + push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/lib.am\n" ; + } + elsif ( /^(.*[^\s])[\s]*$/o ) + { # remove trailing spaces + push @ibuf, "$1\n" ; + } + else + { + push @ibuf, "$_" ; + } + } + @buffer = @ibuf ; +} + +# print STDERR "\n", @buffer, "\n" ; + +{ + my @ibuf = () ; + foreach ( @buffer ) + { + if ( /^#(.*)$/o ) + { + push @ibuf, "#$1\n" ; + } + elsif ( /^[\s]*if[\s\t]+([a-zA-Z0-9_]+)[\s\t]*$/o ) + { + push @conditions, "\@" . $1 . "_TRUE\@" ; + push @ibuf, "if $1\n" ; + } + elsif ( /^[\s]*else[\s\t]*$/o ) + { + @conditions[$#conditions] =~ s/_TRUE\@$/_FALSE\@/; + push @ibuf, "else\n" ; + } + elsif ( /^[\s]*endif[\s\t]*$/o ) + { + pop @conditions ; + push @ibuf, "endif\n" ; + } + elsif ( /^§.*$/o ) + { + push @ibuf, "$_" ; + } + elsif ( /^[\s]*(VPATH)[\s\t]*([\+]*)=[\s]*(.*)[\s]*$/o ) + { + my $lh = "\$($1)" ; + my @rh = split( /:/,"$3"); + if ( $#conditions > 0 ) + { + print STDERR "WARNING: $1 must not be set inside of conditionals!\n" + } + define_variable( "$lh", @rh ); + + } + elsif ( /^[\s]*(AUTOMAKE_OPTIONS)[\s\t]*([\+]*)=[\s]*(.*)$/o ) + { + my $lh = "\$($1)" ; + my @rh = &split_vars("$3"); + + if ( $#conditions > 0 ) + { + print STDERR "WARNING: $1 must not be set inside of conditionals!\n" + } + + define_variable( "$lh", @rh ); + } + elsif ( /^[\s]*([a-zA-Z0-9_]+)[\s\t]*([\+]*)=[\s]*(.*)$/o ) + { + my $lh = join ('',@conditions) . "\$($1)" ; + my @rh = &split_vars("$3"); + my $seen = variable_seen( "$lh" ) ; + + if ( $#conditions > 0 ) + { + define_variable( "\$($1)", () ); + } + + define_variable( "$lh", @rh ); + + if ( not $seen ) + { + push @ibuf, "§$2var_$lh\n" ; + } + } + elsif ( /^[\s]*include[\s\t]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o ) + { + if ( "$1" eq "lib" ) + { + push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/$1.am\n" ; + } + elsif ( "$1" eq "local" ) + { + $main::seen_local = 1 ; + } + elsif ( "$1" eq "host" ) + { + $main::seen_host = 1 ; + } + } + elsif ( /^[\s]*include[\s\t]*(.*)$/o ) + { + push @ibuf, "include $1\n" ; + } + elsif ( /^\t(.*)$/o ) + { + push @ibuf, "\t$1\n" ; + } + elsif ( /^(.*)\:(.*)$/o ) + { + push @ibuf, "$1:$2\n" ; + } + elsif ( /^[\s]*$/o ) + { + push @ibuf, "\n" ; + } + else + { + die "ERROR: Don't know how to handle <$_>" ; + } + } # for + @buffer = @ibuf ; +} # while + +die "Conditional stack corrupted" if ( $#conditions != 0 ); + +foreach( @vars ) +{ + purge( \@{$var_{"$_"}} ); +} + +# print STDERR "\n", @buffer, "\n" ; + + +{ + my @ibuf = () ; + foreach( @buffer ) + { + if ( /^#.*$/o ) + { + push @ibuf, "$_" ; + } + elsif( /^§header$/o ) + { + my $l = $var_{"\$(AUTOMAKE_OPTIONS)"} ; + push @ibuf, "\nAUTOMAKE_OPTIONS = @{$l}\n" ; + if ( "$rtems_cfg" eq "." ) + { + push @ibuf, "ACLOCAL_AMFLAGS = -I \$(RTEMS_TOPdir)/aclocal\n" ; + } + if ( defined( @{$var_{"\$(VPATH)"}} ) ) + { + if ( $#{$var_{"\$(VPATH)"}} > 0 ) + { + my $l = join (':',@{$var_{"\$(VPATH)"}}) ; + push @ibuf, "\nVPATH = $l\n" ; + } + } + push @ibuf, "\n" ; + } + elsif ( /^§(\+|)var_(.*)\$\((.*)\)$/o ) + { + print_var(\@ibuf, "$3 $1=", $var_{"$2\$($3)"}) ; + } + elsif ( /^\t.*$/o ) + { + &print_script(\@ibuf, "$_"); + } + elsif ( /^[\s]*if[\s]+([a-zA-Z0-9_]+)[\s\t]*$/o ) + { + push @conditions, "\@$1_TRUE\@" ; + push @ibuf, "if $1\n" ; + } + elsif ( /^[\s]*else[\s]*$/o ) + { + @conditions[$#conditions] =~ s/_TRUE\@$/_FALSE\@/; + push @ibuf, "else\n" ; + } + elsif ( /^[\s]*endif[\s]*$/o ) + { + pop @conditions ; + push @ibuf, "endif\n" ; + } + else + { + print_line(\@ibuf,$_); + } + } + + if ( variable_seen("\$(SUBDIRS)") ) + { + push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/subdirs.am\n" ; + } + + if ( defined( $main::seen_host ) ) + { + push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/host.am\n" ; + } + else + { + push @ibuf, "include \$(top_srcdir)/${rtems_top}automake/local.am\n" ; + } + + @buffer = @ibuf ; +} + +#print STDERR "\n", @buffer, "\n" ; + +{ ## pretty print + my $out = join ('',@buffer) ; + $out =~ s/\s\#\n(\#\n)+/\n/g ; + $out =~ s/\n\n\#\n\n/\n/g ; + $out =~ s/\n\n[\n]*/\n\n/g ; + print $out ; +} + +exit 0; # find a relative up-path to a file $file, starting at directory $pre sub find_file @@ -44,78 +371,154 @@ sub find_file die "Can't find file ${file}\n" ; } -# find relative up-path to configure.in -my $rtems_cfg = find_file(".","configure.in"); - -# find relative up-path from configure.in to VERSION -my $rtems_top = find_file("$rtems_cfg","VERSION"); - -if ( "$rtems_top" eq "." ) -{ $rtems_top = "" ; } -else { $rtems_top .= "/" ; } - -my $nl_seen = 0 ; - -while( <> ) -{ # consume header - last if ( /^[^#].*$/ ) ; - print "$_" ; -} - -print "\nAUTOMAKE_OPTIONS = foreign 1.4\n"; -if ( "$rtems_cfg" eq "." ) +sub variable_seen($) { - print "ACLOCAL_AMFLAGS = -I \$(RTEMS_TOPdir)/aclocal\n" + my $label = "$_[0]" ; + my $res = defined $var_{"$label"}; +#print STDERR "SEEN: $label ->$res<\n" ; + return $res ; } -while( <> ) -{ - if ( /^[\s\t]*$/o ) +sub define_variable($$) +{ + my ($label,@value) = @_ ; + + if ( not variable_seen("$label") ) { - $nl_seen = $nl_seen+1; +#print STDERR "DEFINING: $label\n" ; + push @vars, "$label" ; } - if ( /^[\s\t]*AUTOMAKE_OPTIONS.*$/o ) - { # remove the line + foreach my $i ( @{value} ) + { + push @{$var_{"$label"}}, $i ; } - elsif ( /^[\s\t]*ACLOCAL[\s\t]*=[\s\t]*\@ACLOCAL\@.*$/o ) - { # remove the line - } - elsif ( /^[\s\t]*ACLOCAL_AMFLAGS[\s\t]*=[\s\t]*.*$/o ) - { # remove the line - } - elsif ( /^[\s\t]*include[\s\t]*\$\(top_srcdir\)[\.\/]*automake\/(.*)\.am$/o ) +} + +# Strip off duplicate entries from a list +sub purge($) +{ + my $list = $_[0] ; # Reference to list ! + my (@tmp) = () ; + + foreach my $l ( @{$list} ) { - if ( "$1" eq "lib" ) + my $i = 1 ; + foreach my $t (@tmp) { - print "include \$(top_srcdir)/${rtems_top}automake/$1.am\n" ; + if ( $t eq $l ) + { + $i = 0 ; + last ; + } + } + push @tmp,$l if ($i) ; + } + + @{$list} = @tmp ; +} + +# +# Break the right hand side of a variable assignment into separate chunks +# +sub split_vars($) +{ + my $line = $_[0] ; + my (@buf) = split(//,"$line") ; + + my $begin = 0 ; + my @res = () ; + + my $depth = 0 ; + my $state = 0 ; + + my $len = $#buf + 1 ; + for ( my $i = 0 ; $i < $len ; $i++ ) + { + my $c = @buf[$i] ; + if ( $state == 0 ) + { + if ( "$c" ne " " ) + { # token + $begin = $i ; + $state++ ; + } + if ( "$c" eq "\$" ) + { # variable + $depth++ ; + } + } + elsif ( $state == 1 ) + { + if ( ( "$c" eq "\)" ) or ( "$c" eq "\}" ) ) + { # variable + $depth-- ; + } + elsif ( ("$c" eq " " ) and ( $depth == 0 ) ) + { + push @res, substr($line,$begin,$i-$begin); + $state-- ; + } + elsif ( "$c" eq "\$" ) + { # variable + $depth++ ; + } + } + else + { + die "split_vars: unknown mode\n" ; } } - elsif ( /^[\s\t]*include[\s\t]*\$\(RTEMS_ROOT\)\/make\/lib.cfg$/o ) - { - print "include \$(top_srcdir)/${rtems_top}automake/lib.am\n" ; - } - elsif ( /^[\s\t]*SUBDIRS.*$/o ) - { - $subdirs_seen = "yes" ; - print "$_" ; - $nl_seen = 0 ; - } - elsif ( /^[ ]*$/o ) - { - print "$_" if $nl_seen < 2 ; - } - else - { - print "$_" ; - $nl_seen = 0; - } -} # while -if ( "$subdirs_seen" ) -{ - print "include \$(top_srcdir)/${rtems_top}automake/subdirs.am\n" ; + if ( $state > 0 ) + { + push @res, substr($line,$begin,$len-$begin); + $state = 0 + } + return @res ; } -print "include \$(top_srcdir)/${rtems_top}automake/local.am\n" ; -;1 +sub print_var($$$) +{ + my ($ibuf,$line,$l) = @_ ; # $l .. reference to list + + foreach (@{$l}) { + if ( ( length($line) + length($_) ) < 76 ) + { + $line .= " $_"; + } + else + { + push @{$ibuf}, "$line \\\n"; + $line = " $_" ; + } + } + push @{$ibuf}, "$line\n" ; +} + +sub print_line($$) +{ + my ($ibuf,$input) = @_ ; + my @l = split( / /, $input ); + my $line = shift @l ; + + foreach my $i (@l) { + if ( ( length($line) + length($i) ) < 76 ) + { + $line .= " $i"; + } + else + { + push @{$ibuf}, "$line \\\n"; + $line = " $i" ; + } + } + push @{$ibuf}, "$line" ; +} + +sub print_script($$) +{ + my ($ibuf,$input) = @_ ; + $input =~ s%§%\\\n%g ; + push @{$ibuf}, $input ; +}