forked from Imagelibrary/rtems
This patch is the most scary of all proposals I've been mailing to you
this week until now.
It consists of 3 parts:
1. a patch
2. a perl script (acpolish)
3. a shell script wrapper to invoke the perl-script.
The perl-script reads in each Makefile.in and modifies them
("polishes/beautifies" them :-).
These modifications are not easy to describe:
Basically, it hard-codes some automake Makefile-variables and rules into
RTEMS autoconf-Makefile.ins (Note: autoconf vs. automake!!) and converts
some settings/variables to configure scripts' requirements (Yes,
plural).
E.g. it adds the automake standard variables $top_builddir and $subdir,
adds dependency rules for automatic re-generation of Makefiles from
Makefile.in, adds support variables for relative paths to multiple
configure scripts etc.
The patch is a one-line patch to enable the support of the new features
added by acpolish.
The shell script is a wrapper which pokes around inside of the source
tree for Makefile.ins and invokes acpolish on all autoconf-Makefile.ins.
acpolish is designed to be able to run several times on the same
Makefile.in and may once become a more general tool to convert RTEMS
Makefile.in to automake. Therefore, I'd like to keep it inside of source
tree. (e.g. as contrib/acpolish or c/update-tools/acpolish). However, it
doesn't make sense to export it outside of RTEMS.
To apply this:
cd <source-tree>
patch -p1 -E < <path-to-patch>/rtems-rc-19990318-1.diff
tar xzvf <path-to>/rtems-rc-polish.tar.gz
./rtems-polish.sh
./autogen
Note: The path contrib/acpolish is hard-coded into rtems-polish.sh, if
you decide to put it in an alternative place, please modify
rtems-polish.sh to reflect this change.
Later:
cvs rm make/rtems.cfg (It isn't used anymore)
cvs add contrib
cvs add contrib/acpolish
cvs commit
I've tested this intensively, but naturally I can't exclude bugs.
Ralf.
PS.: Most probably, this is the last "Towards automake" patch. The next
one probably will be a real automake patch.
104 lines
2.7 KiB
Makefile
104 lines
2.7 KiB
Makefile
#
|
|
# $Id$
|
|
#
|
|
# Not strictly necessary to pull in this stuff. But it helps with
|
|
# working with the templates and poking around.
|
|
#
|
|
|
|
@SET_MAKE@
|
|
srcdir = @srcdir@
|
|
top_srcdir = @top_srcdir@
|
|
top_builddir = ..
|
|
subdir = make
|
|
|
|
INSTALL = @INSTALL@
|
|
|
|
RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@
|
|
PROJECT_ROOT = @PROJECT_ROOT@
|
|
|
|
VPATH = @srcdir@
|
|
|
|
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
|
include $(RTEMS_ROOT)/make/leaf.cfg
|
|
|
|
CLEAN_ADDITIONS +=
|
|
CLOBBER_ADDITIONS +=
|
|
|
|
# NOTE: No need to prepend $(srcdir) to file names,
|
|
# VPATH handles the paths for us.
|
|
# NOTE: Only the files really need get installed.
|
|
|
|
GENERIC_FILES := host.cfg target.cfg
|
|
|
|
MAKEFILES := README \
|
|
directory.cfg leaf.cfg \
|
|
lib.cfg main.cfg
|
|
|
|
# NOTE: Use the wildcard rule to install all custom files
|
|
# CUSTOM_FILES := $(wildcard $(srcdir)/custom/*.cfg)
|
|
|
|
# NOTE: This should be sufficient, but may fail for some BSPS:
|
|
# Get all custom files for the BSP family, they may depend on each other
|
|
#CUSTOM_FILES := custom/default.cfg $(patsubst %,custom/%.cfg, posix)
|
|
|
|
# This version of the rule is pretty ugly but I think it works ALL the time.
|
|
# + Figure out what this BSP.cfg includes
|
|
# + Make those files have the correct relative path.
|
|
# + Now fix $(RTEMS_HOST) to the real host name
|
|
CUSTOM_FILES := custom/default.cfg custom/$(RTEMS_BSP).cfg \
|
|
$(shell grep "^include.*make/custom" $(srcdir)/custom/$(RTEMS_BSP).cfg | \
|
|
sed -e 's/^.*make\///' | sed -e s/\\$$\(RTEMS_HOST\)/${RTEMS_HOST}/)
|
|
|
|
# NOTE: Use the wildcard rule to install all compiler files
|
|
# COMPILER_FILES := $(wildcard $(srcdir)/compilers/*.cfg)
|
|
COMPILER_FILES := $(CONFIG.$(TARGET_ARCH).CC) $(CONFIG.$(HOST_ARCH).CC)
|
|
|
|
# NOTE: Don't use a wildcard rule here, otherwise Templates/Makefile.inc
|
|
# will be installed, too
|
|
TEMPLATE_FILES := \
|
|
Templates/Makefile.dir \
|
|
Templates/Makefile.leaf \
|
|
Templates/Makefile.lib
|
|
|
|
get: retrieve
|
|
|
|
all:
|
|
|
|
$(prefix):
|
|
@top_srcdir@/mkinstalldirs $@
|
|
|
|
install: $(prefix) \
|
|
$(prefix)/make \
|
|
$(prefix)/make/compilers \
|
|
$(prefix)/make/custom \
|
|
$(prefix)/make/Templates \
|
|
install_files
|
|
|
|
$(prefix)/make:
|
|
@top_srcdir@/mkinstalldirs $@
|
|
|
|
install_files:: $(GENERIC_FILES) $(MAKEFILES)
|
|
$(INSTALL_DATA) $^ $(prefix)/make
|
|
|
|
$(prefix)/make/compilers:
|
|
@top_srcdir@/mkinstalldirs $@
|
|
|
|
install_files:: $(COMPILER_FILES)
|
|
$(INSTALL_DATA) $^ $(prefix)/make/compilers
|
|
|
|
$(prefix)/make/custom:
|
|
@top_srcdir@/mkinstalldirs $@
|
|
|
|
install_files:: $(CUSTOM_FILES)
|
|
$(INSTALL_DATA) $^ $(prefix)/make/custom
|
|
|
|
$(prefix)/make/Templates:
|
|
@top_srcdir@/mkinstalldirs $@
|
|
|
|
install_files:: $(TEMPLATE_FILES)
|
|
$(INSTALL_DATA) $^ $(prefix)/make/Templates
|
|
|
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|
cd $(top_builddir) \
|
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|