forked from Imagelibrary/rtems
Here is the result of my nightly work to get RTEMS_ROOT=$srcdir working with different shells and relative/absolute paths. What I did is relatively simple in principle: Instead of setting RTEMS_ROOT in configure.in and then let configure substitute @RTEMS_ROOT@ inside the Makefiles, I now let each Makefile set RTEMS_ROOT from each Makefile's @top_srcdir@ value. The difference is subtile, but with enormous side effects: - If RTEMS_ROOT is set in configure, then the same single value will be propagated to all Makefiles. This breaks using relative paths, as the relative path to the root of the source tree is used inside of all subdirectory Makefiles. - Now each Makefile.in sets RTEMS_ROOT = @top_srcdir@. top_srcdir is computed individually by configure for each single Makefile.in, hereby receiving the correct value, no matter if relative or absolute paths are used. To get this working, I needed to remove setting RTEMS_ROOT from target.cfg.in, because this overrides the value of RTEMS_ROOT from each individual Makefile. Furthermore, I removed RTEMS_CUSTOM from the Makefiles and replaced all "include $(RTEMS_CUSTOM)" directives with"include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP)". Perhaps you don't like this, but I think, to have one variable less is clearer and easier to understand than having several variables refering to the next one. I enclose a small patch to this mail, which - fixes the config.h problem (to finally clearify misunderstands) - removes assignment/subsitution of RTEMS_ROOT from configure.in - contains a workaround for the application Makefile's RTEMS_ROOT problem (reported by Eric) - removes some unused lines from the toplevel Makefile.in - removes assignment of RTEMS_ROOT from make/target.cfg.in
84 lines
2.2 KiB
Makefile
84 lines
2.2 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@
|
|
VPATH = @srcdir@
|
|
RTEMS_ROOT = @top_srcdir@
|
|
PROJECT_ROOT = @PROJECT_ROOT@
|
|
|
|
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 eachother
|
|
CUSTOM_FILES := custom/default.cfg $(patsubst %,custom/%.cfg,@RTEMS_BSP_LIST@)
|
|
|
|
# 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)/rtems:
|
|
-$(MKDIR) $(prefix)
|
|
-$(MKDIR) $(prefix)/rtems
|
|
|
|
install: install_files $(prefix)/rtems
|
|
|
|
install_files:: $(GENERIC_FILES) $(MAKEFILES)
|
|
@test -d $(prefix)/rtems/make || \
|
|
$(MKDIR) $(prefix)/rtems/make
|
|
for f in $^; do \
|
|
$(INSTALL) -m 644 "$$f" $(prefix)/rtems/make ;\
|
|
done
|
|
|
|
install_files:: $(COMPILER_FILES)
|
|
@test -d $(prefix)/rtems/make/compilers || \
|
|
$(MKDIR) $(prefix)/rtems/make/compilers
|
|
for f in $^; do \
|
|
$(INSTALL) -m 644 "$$f" $(prefix)/rtems/make/compilers; \
|
|
done
|
|
|
|
install_files:: $(CUSTOM_FILES)
|
|
@test -d $(prefix)/rtems/make/custom || \
|
|
$(MKDIR) $(prefix)/rtems/make/custom
|
|
for f in $^; do \
|
|
$(INSTALL) -m 644 "$$f" $(prefix)/rtems/make/custom; \
|
|
done
|
|
|
|
install_files:: $(TEMPLATE_FILES)
|
|
@test -d $(prefix)/rtems/make/Templates || \
|
|
$(MKDIR) $(prefix)/rtems/make/Templates
|
|
for f in $^; do \
|
|
$(INSTALL) -m 644 "$$f" $(prefix)/rtems/make/Templates; \
|
|
done
|