summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-09-12 20:54:13 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-09-12 20:54:13 +0000
commit1ea70d78ddbd7347df50103c4a915e140d913f9c (patch)
treeb626c2aa756c5b84db5a3bd3cedc4da9ccfaa0e9
parenta4e45452c34c462378028d8041c0d147b375aaa6 (diff)
downloadrtems-1ea70d78ddbd7347df50103c4a915e140d913f9c.tar.bz2
2000-09-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* aclocal/check-cxx.m4: Add AC_SUBST(CPLUS_LD_LIBS) * aclocal/prog-cc.m4: Cleanup comments, require RTEMS_ENABLE_GCC28, add automake conditionals RTEMS_USE_GCC, RTEMS_USE_GCC272. * automake/compile.am: Replaced. * automake/local.am: Remove building variant handling.
-rw-r--r--ChangeLog8
-rw-r--r--aclocal/check-cxx.m45
-rw-r--r--aclocal/prog-cc.m410
-rw-r--r--automake/compile.am289
-rw-r--r--automake/local.am44
5 files changed, 306 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index e4a1c7724f..edba3c0a7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-09-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+ * aclocal/check-cxx.m4: Add AC_SUBST(CPLUS_LD_LIBS)
+ * aclocal/prog-cc.m4: Cleanup comments, require RTEMS_ENABLE_GCC28,
+ add automake conditionals RTEMS_USE_GCC, RTEMS_USE_GCC272.
+ * automake/compile.am: Replaced.
+ * automake/local.am: Remove building variant handling.
+
2000-09-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* aclocal/enable-rtemsbsp.m4: Add RTEMS_ENABLE_BARE,
diff --git a/aclocal/check-cxx.m4 b/aclocal/check-cxx.m4
index ce9900a580..997f0fbf6a 100644
--- a/aclocal/check-cxx.m4
+++ b/aclocal/check-cxx.m4
@@ -18,4 +18,9 @@ AC_CACHE_CHECK([whether to build rtems++],
fi])
HAS_CPLUSPLUS="$rtems_cv_HAS_CPLUSPLUS";
AC_SUBST(HAS_CPLUSPLUS)dnl
+
+if test "$HAS_CPLUSPLUS" = "yes"; then
+CPLUS_LD_LIBS='$(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)'
+fi
+AC_SUBST(CPLUS_LD_LIBS)
])
diff --git a/aclocal/prog-cc.m4 b/aclocal/prog-cc.m4
index 337c580152..3cc83ff3c5 100644
--- a/aclocal/prog-cc.m4
+++ b/aclocal/prog-cc.m4
@@ -3,8 +3,6 @@ dnl $Id$
dnl
dnl Check for target gcc
dnl
-dnl 98/05/20 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
-dnl Completely reworked
AC_DEFUN(RTEMS_PROG_CC,
[
@@ -13,6 +11,7 @@ AC_BEFORE([$0], [AC_PROG_CC])dnl
AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl
AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
AC_REQUIRE([RTEMS_ENABLE_LIBCDIR])dnl
+AC_REQUIRE([RTEMS_ENABLE_GCC28])dnl
dnl Only accept gcc and cc
dnl NOTE: This might be too restrictive for native compilation
@@ -64,6 +63,8 @@ unset ac_cv_prog_gcc
unset ac_cv_prog_cc_g
unset ac_cv_prog_cc_works
unset ac_cv_prog_cc_cross
+
+AM_CONDITIONAL(RTEMS_USE_GCC,test x"$rtems_cv_prog_gcc" = x"yes")
])
AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET,
@@ -83,6 +84,11 @@ if test "$RTEMS_USE_GCC272" != "yes" ; then
fi
test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
+## Conditional for automake files
+AM_CONDITIONAL(RTEMS_USE_GCC272, test x"$RTEMS_USE_GCC272" = x"yes")
+## Make variable for autoconf fragments (*.cfg)
+AC_SUBST(RTEMS_USE_GCC272)
+
dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
case $host_os in
*cygwin*) GCCSED="| sed 's%\\\\%/%g'" ;;
diff --git a/automake/compile.am b/automake/compile.am
index ea4018ea3b..29c7137732 100644
--- a/automake/compile.am
+++ b/automake/compile.am
@@ -1,18 +1,297 @@
##
## $Id$
##
-## In future this file shall take compilation rules, now contained in
-## gcc-target-default.cfg
-##
## -------------------------------------------------------------------------
-## NOTE: This is experimental.
+## NOTE: This file is rather immature and has to be considered to be
+## almost experimental.
##
-## Expect frequent changes :(
+## Expect frequent changes -- It deserves to be cleaned up :(
## -------------------------------------------------------------------------
+## The section below is based on make/compilers/gcc-target-default.cfg
+## used in former versions of RTEMS.
+
+##
+## Set up the flags for the toolchains:
+##
+## We are considering 3 different building schemes here:
+## * Using gcc's being able to accept -specs (aka gcc-2.8 building scheme)
+## * Using gcc's not being able to accept -specs (aka gcc-2.7.2 building
+## scheme)
+## * Using third party toolchains (aka non-gcc building scheme)
+##
+## Automake conditionals in use:
+## RTEMS_USE_GCC .. if we are using GCC
+## RTEMS_USE_GCC272 .. if using gcc and if requested not to apply
+## gcc <= 2.7.2 incompatible rules
+
+## NOTES:
+## * The gcc-2.8 building scheme is the nominal building scheme and
+## is actively supported.
+## * The gcc-2.7.2 building scheme is not supported by all BSPs and
+## is not extensively tested.
+## * The non-gcc building scheme requires manually setting up environment
+## variables and is hardly tested at all
+
+## CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
+## would want the corresponding macros to be set to.
+##
+## CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set by the
+## 'VARIANT=<OPTIMIZE|DEBUG|PROFILE>' targets to their _V values.
+
+## XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
+## are used to add flags from the shell
+## cf. make.info ("Implicit rules/variables" for details)
+
+if RTEMS_USE_GCC
+## All the stuff below is specific to gcc
+
+CFLAGS_DEFAULT=-g -Wall -ansi -fasm
+
+if RTEMS_USE_GCC272
+## gcc <= 2.7.2
+RTEMS_CPPFLAGS = -isystem $(PROJECT_INCLUDE)
+
+# default location of Standard C Library
+LIBC_LIBC = $(shell $(CC) $(CPU_CFLAGS) -print-file-name=libc.a $(GCCSED))
+LIBC_LIBM = $(shell $(CC) $(CPU_CFLAGS) -print-file-name=libm.a $(GCCSED))
+LIBC_LIBGCC = $(shell $(CC) $(CPU_CFLAGS) -print-libgcc-file-name $(GCCSED))
+
+### FIXME: False if using multilibbed RTEMS
+LINK_LIBS_RTEMS = $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
+
+LINK_LIBS_GCC272 = $(LINK_LIBS_RTEMS) $(LIBC_LIBC) $(LIBC_LIBGCC)
+else
+## gcc >= 2.8.x
+## FIXME: This is BSP-specific and will fail for BSP-independent directories
+GCCSPECS = -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems
+endif
+else
+## fall back to the old style compilers/*.cfg
+## CONFIG.CC is supposed to be provided by <BSP>.cfg
+include $(CONFIG.CC)
+endif # RTEMS_USE_GCC
+
DEFS = @DEFS@
+CPPFLAGS += $(CPU_DEFINES) $(CPU_CFLAGS) \
+ $(DEFINES) $(XCPPFLAGS) $(CPPFLAGS_GCC)
+CFLAGS = $(CFLAGS_DEFAULT) $(XCFLAGS)
+CXXFLAGS = $(CFLAGS_DEFAULT) $(XCXXFLAGS)
+ASFLAGS = $(CPU_ASFLAGS) $(XASFLAGS)
+
+LINK_LIBS = $(LINK_LIBS_GCC272) $(LD_LIBS)
+
+## FIXME: This doesn't seem to be correct
+# when debugging, optimize flag: typically empty
+# some compilers do allow optimization with their "-g"
+CFLAGS_DEBUG_OPTIMIZE_V=-g
+CXXFLAGS_DEBUG_OPTIMIZE_V=-g
+LDFLAGS_DEBUG_V =
+
+# profile flag; use gprof(1)
+CFLAGS_PROFILE_V=-pg
+CXXFLAGS_PROFILE_V=-pg
+LDFLAGS_PROFILE_V =
+
+# List of library paths without -L
+LD_PATHS= $(PROJECT_RELEASE)/lib
+
+# ld flag for incomplete link
+LDFLAGS_INCOMPLETE = -r
+
+# ld flags for profiling, debugging
+LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
+
+#
+# Client compiler and support tools
+#
+
+## HACK: specific to gcc
+## FIXME: Do we call the correct CPP, why aren't
+## CPPFLAGS and CFLAGS part of this call?
+# CPP command to write file to standard output
+CPP=$(CC) -E -ansi -w -Wp,-$$
+
+ARFLAGS=ruv
+
+#
+# How to compile stuff into ${ARCH} subdirectory
+#
+
+${ARCH}/%.o: %.c
+ ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
+
+${ARCH}/%.o: %.cc
+ ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
+
+${ARCH}/%.o: %.cpp
+ ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
+
+${ARCH}/%.o: %.cxx
+ ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
+
+${ARCH}/%.o: %.C
+ ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
+
+${ARCH}/%.o: %.S
+ ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
+
+# Make foo.rel from foo.o
+${ARCH}/%.rel: ${ARCH}/%.o
+ ${make-rel}
+
+# create $(ARCH)/pgm from pgm.sh
+${ARCH}/%: %.sh
+ $(RM) $@
+ $(CP) $< $@
+ $(CHMOD) +x $@
+
+# Dependency files for use by gmake
+# NOTE: we don't put them into $(ARCH)
+# so that 'make clean' doesn't blow it away
+
+DEPEND=Depends-${ARCH}
+
+CLEAN_DEPEND=$(DEPEND).tmp
+CLOBBER_DEPEND=$(DEPEND)
+
+# We deliberately don't have anything depend on the
+# $(DEPEND) file; otherwise it will get rebuilt even
+# on 'make clean'
+#
+
+## HACK: Specific to gcc
+## FIXME: The approach below is known to be conceptionally broken.
+depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
+## Use gcc -M to generate dependencies
+## Replace foo.o with $(ARCH)/foo.o
+## Replace $(ARCH) value with string $(ARCH)
+## so that it will for debug and profile cases
+ $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M $^ | \
+ sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
+ -e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
+ mv $(DEPEND).tmp $(DEPEND)
+depend: depend-am
+
+# spell out all the LINK_FILE's, rather than using -lbsp, so
+# that $(LINK_FILES) can be a dependency
+
+LINK_OBJS = \
+ $(OBJS) \
+ $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
+
+LINK_FILES =\
+ $(START_FILE) \
+ $(OBJS) \
+ $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
+ $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
+
+if RTEMS_USE_GCC
+if RTEMS_USE_GCC272
+define make-rel
+ $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $^
+endef
+else
+## gcc >= 2.8
+define make-rel
+ $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
+ -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
+endef
+endif
+else
+## non-gcc
+define make-rel
+ $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
+ $(XLDFLAGS) -o $@ $^
+endef
+endif
+
+## -------------------------------------------------------------------------
+
+## translate VARIANT into VARIANT_V
+VARIANT = OPTIMIZE
+
+VARIANT_OPTIMIZE_V = OPTIMIZE
+VARIANT_DEBUG_V = DEBUG
+VARIANT_PROFILE_V = PROFILE
+VARIANT_optimize_V = OPTIMIZE
+VARIANT_debug_V = DEBUG
+VARIANT_profile_V = PROFILE
+
+VARIANT_V = $(VARIANT_$(VARIANT)_V)
+
+## Setup the variant build subdirectory
+ARCH_OPTIMIZE_V = o-optimize
+ARCH_DEBUG_V = o-debug
+ARCH_PROFILE_V = o-profile
+
+ARCH__V = $(ARCH_OPTIMIZE_V)
+ARCH = $(ARCH_$(VARIANT_V)_V)
+
+## Setup the library suffix
+LIBSUFFIX_OPTIMIZE_V =
+LIBSUFFIX_DEBUG_V = _g
+LIBSUFFIX_PROFILE_V = _p
+LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
+
+LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
+LIBSUFFIX_VA = $(LIB_VARIANT).a
+
+## These are supposed to be set in make/custom/<bsp>.cfg
+## CFLAGS_OPTIMIZE_V =
+## CFLAGS_DEBUG_V =
+## CFLAGS_PROFILE_V =
+CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
+
+## ------------------------------------------------------------------------
+## Setup hard-coded flags
+if RTEMS_USE_GCC
+if RTEMS_USE_GCC272
+## gcc < gcc-2.8
+RTEMS_CFLAGS_OPTIMIZE_V =
+RTEMS_CFLAGS_DEBUG_V = -Wno-unused
+RTEMS_CFLAGS_PROFILE_V =
+else
+## gcc >= gcc-2.8
+RTEMS_CFLAGS_OPTIMIZE_V =
+RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unused
+RTEMS_CFLAGS_PROFILE_V =
+endif
+## non-gcc
+## We can't guess what flags might be required here.
+## Pass the values from the environment if you want to apply them.
+endif
+RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
+
+## -------------------------------------------------------------------------
+
+## FIXME: This will probably vanish, when GNU canonicalization will be
+## introduced
+
+CC = $(CC_FOR_TARGET) $(GCCSPECS)
+CXX = $(CXX_FOR_TARGET) $(GCCSPECS)
+AR_FOR_TARGET = @AR_FOR_TARGET@
+AR = $(AR_FOR_TARGET)
+AS_FOR_TARGET = @AS_FOR_TARGET@
+AS = $(AS_FOR_TARGET)
+RANLIB_FOR_TARGET = @RANLIB_FOR_TARGET@
+RANLIB = $(RANLIB_FOR_TARGET)
+LD_FOR_TARGET = @LD_FOR_TARGET@
+LD = $(LD_FOR_TARGET)
+NM_FOR_TARGET = @NM_FOR_TARGET@
+NM = $(NM_FOR_TARGET)
+OBJCOPY_FOR_TARGET = @OBJCOPY_FOR_TARGET@
+OBJCOPY = $(OBJCOPY_FOR_TARGET)
+SIZE_FOR_TARGET = @SIZE_FOR_TARGET@
+SIZE = $(SIZE_FOR_TARGET)
+STRIP_FOR_TARGET = @STRIP_FOR_TARGET@
+STRIP = $(STRIP_FOR_TARGET)
+
##
## FIXME: DEFS and INCLUDES should not be passed as AM_CPPFLAGS
AM_CPPFLAGS += $(DEFS) $(INCLUDES) $(RTEMS_CPPFLAGS)
+
+AM_CFLAGS += $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
+AM_CXXFLAGS += $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
diff --git a/automake/local.am b/automake/local.am
index 324a803a37..ca146e837e 100644
--- a/automake/local.am
+++ b/automake/local.am
@@ -1,48 +1,5 @@
## $Id$
-## NOTE: This is a temporary work-around to keep
-## RTEMS's non automake standard make targets working.
-## Once automake is fully integrated these make targets
-## and this file will probably be removed
-
-## translate VARIANT into VARIANT_V
-VARIANT = OPTIMIZE
-
-VARIANT_OPTIMIZE_V = OPTIMIZE
-VARIANT_DEBUG_V = DEBUG
-VARIANT_PROFILE_V = PROFILE
-VARIANT_optimize_V = OPTIMIZE
-VARIANT_debug_V = DEBUG
-VARIANT_profile_V = PROFILE
-
-VARIANT_V = $(VARIANT_$(VARIANT)_V)
-
-## Setup the variant build subdirectory
-ARCH_OPTIMIZE_V = o-optimize
-ARCH_DEBUG_V = o-debug
-ARCH_PROFILE_V = o-profile
-
-ARCH__V = $(ARCH_OPTIMIZE_V)
-ARCH = $(ARCH_$(VARIANT_V)_V)
-
-## Setup the library suffix
-LIBSUFFIX_OPTIMIZE_V =
-LIBSUFFIX_DEBUG_V = _g
-LIBSUFFIX_PROFILE_V = _p
-
-LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
-LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
-
-LIBSUFFIX_VA = $(LIB_VARIANT).a
-
-## These are supposed to be set in make/custom/<bsp>.cfg
-## CFLAGS_OPTIMIZE_V =
-## CFLAGS_DEBUG_V =
-## CFLAGS_PROFILE_V =
-
-CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
-AM_CFLAGS += $(CFLAGS_$(VARIANT_V)_V)
-
debug:
@echo
@echo "\"make debug\" is obsolete, instead use:"
@@ -78,3 +35,4 @@ distclean-local:
$(RM) Depends-o-optimize Depends-o-debug Depends-o-profile
PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools
+