Index: c/src/lib/libcpu/powerpc/ChangeLog
===================================================================
--- c/src/lib/libcpu/powerpc/ChangeLog	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/ChangeLog	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -1,2 +1,10 @@
+2004-01-21	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* configure.ac: Require automake >= 1.8.2.
+	* Makefile.am, mpc505/Makefile.am, mpc6xx/Makefile.am, 
+	mpc8260/Makefile.am, mpc8xx/Makefile.am, ppc403/Makefile.am, 
+	shared/Makefile.am: Use automake compilation rules.
+	Add PREINSTALL_DIRS.
+
 2004-01-14	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: c/src/lib/libcpu/powerpc/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -9,33 +9,9 @@
     rtems/powerpc/debugmod.h
 
-## Check configure.in for conditions to set the conditionals below
-if shared
-SHARED_LIB = shared
-endif
-
-if mpc505
-CPU_SUBDIR = mpc505
-endif
-if mpc6xx
-CPU_SUBDIR = mpc6xx
-endif
-if mpc8xx
-CPU_SUBDIR = mpc8xx
-endif
-if mpc8260
-CPU_SUBDIR = mpc8260
-endif
-if ppc403
-CPU_SUBDIR = ppc403
-endif
-if ppc405
-## 403 and 405 chips use the same CPU sources...
-CPU_SUBDIR = ppc403
-endif
-
-SUBDIRS = $(SHARED_LIB) $(CPU_SUBDIR) wrapup
+SUBDIRS = shared mpc505 mpc6xx mpc8260 mpc8xx ppc403 wrapup
 
 all-local: $(TMPINSTALL_FILES)
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
@@ -43,5 +19,5 @@
 	@$(mkdir_p) $(PROJECT_INCLUDE)/rtems/powerpc
 	@: > $(PROJECT_INCLUDE)/rtems/powerpc/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/powerpc/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/powerpc/$(dirstamp)
 
 $(PROJECT_INCLUDE)/rtems/powerpc/cache.h: rtems/powerpc/cache.h $(PROJECT_INCLUDE)/rtems/powerpc/$(dirstamp)
@@ -54,4 +30,5 @@
 
 CLEANFILES = $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/subdirs.am
Index: c/src/lib/libcpu/powerpc/configure.ac
===================================================================
--- c/src/lib/libcpu/powerpc/configure.ac	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/configure.ac	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -10,10 +10,9 @@
 RTEMS_CANONICAL_TARGET_CPU
 
-AM_INIT_AUTOMAKE([no-define foreign 1.8])
+AM_INIT_AUTOMAKE([no-define foreign 1.8.2])
 AM_MAINTAINER_MODE
 
 RTEMS_ENABLE_BARE
 RTEMS_ENV_RTEMSBSP
-
 
 RTEMS_PROJECT_ROOT
@@ -43,5 +42,8 @@
 || test "$RTEMS_CPU_MODEL" = "mpc860" )
 AM_CONDITIONAL(mpc8260, test "$RTEMS_CPU_MODEL" = "mpc8260")
-AM_CONDITIONAL(ppc403, test "$RTEMS_CPU_MODEL" = "ppc403")
+
+# the ppc405 shares files with the ppc403
+AM_CONDITIONAL(ppc403,[test "$RTEMS_CPU_MODEL" = "ppc403" \
+|| test "$RTEMS_CPU_MODEL" = "ppc405"])
 AM_CONDITIONAL(ppc405, test "$RTEMS_CPU_MODEL" = "ppc405")
 
Index: c/src/lib/libcpu/powerpc/mpc505/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/mpc505/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/mpc505/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -3,6 +3,7 @@
 ##
 
-CLEANDIRS =
+CLEANFILES =
 EXTRA_DIST =
+EXTRA_PROGRAMS =
 noinst_DATA =
 
@@ -10,54 +11,54 @@
 include $(top_srcdir)/../../../automake/lib.am
 
+if mpc505
+# ictrl
 include_HEADERS = ictrl/ictrl.h
 
-# ictrl
-ictrl_C_FILES = ictrl/ictrl.c
-EXTRA_DIST += $(ictrl_C_FILES)
+EXTRA_PROGRAMS += ictrl.rel
+CLEANFILES += ictrl.rel
+ictrl_rel_SOURCES = ictrl//ictrl.c
+ictrl_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+ictrl_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-ictrl_rel_OBJECTS = $(ictrl_C_FILES:ictrl/%.c=icrtl/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += ictrl_g.rel
+CLEANFILES += ictrl_g.rel
+ictrl_g_rel_SOURCES = $(ictrl_rel_SOURCES)
+ictrl_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+ictrl_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-ictrl/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) ictrl/$(ARCH)
-	@: > ictrl/$(ARCH)/$(dirstamp)
-ictrl/$(ARCH)/%.$(OBJEXT): ictrl/%.c ictrl/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-ictrl/$(ARCH)/ictrl.rel: $(ictrl_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += ictrl/o-optimize ictrl/o-debug
-noinst_DATA += ictrl/$(ARCH)/ictrl.rel
+noinst_DATA += ictrl$(LIB_VARIANT).rel
 
 ## timer
-timer_C_FILES = timer/timer.c
-EXTRA_DIST += $(timer_C_FILES)
+EXTRA_PROGRAMS += timer.rel
+CLEANFILES += timer.rel
+timer_rel_SOURCES = timer/timer.c
+timer_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer_rel_OBJECTS = $(timer_C_FILES:timer/%.c=timer/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += timer_g.rel
+CLEANFILES += timer_g.rel
+timer_g_rel_SOURCES = $(timer_rel_SOURCES)
+timer_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+timer_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) timer/$(ARCH)
-	@: > timer/$(ARCH)/$(dirstamp)
-timer/$(ARCH)/%.$(OBJEXT): timer/%.c timer/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-timer/$(ARCH)/timer.rel: $(timer_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += timer/o-optimize timer/o-debug
-noinst_DATA += timer/$(ARCH)/timer.rel
+noinst_DATA += timer$(LIB_VARIANT).rel
 
 ## vector
 vectors_S_FILES = vectors/vectors.S
-EXTRA_DIST += $(vectors_S_FILES)
 
-vectors_rel_OBJECTS = \
-    $(vectors_S_FILES:vectors/%.S=vectors/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += vectors.rel
+CLEANFILES += vectors.rel
+vectors_rel_SOURCES = vectors/vectors.S
+vectors_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+vectors_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-vectors/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) vectors/$(ARCH)
-	@: > vectors/$(ARCH)/$(dirstamp)
-vectors/$(ARCH)/%.$(OBJEXT): vectors/%.S vectors/$(ARCH)/$(dirstamp)
-	${CCASCOMPILE} -o $@ -c $<
-vectors/$(ARCH)/vectors.rel: $(vectors_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += vectors/o-optimize vectors/o-debug
-noinst_DATA += vectors/$(ARCH)/vectors.rel
+EXTRA_PROGRAMS += vectors_g.rel
+CLEANFILES += vectors_g.rel
+vectors_g_rel_SOURCES = $(vectors_rel_SOURCES)
+vectors_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+vectors_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += vectors$(LIB_VARIANT).rel
+endif
 
 ## --
@@ -65,4 +66,5 @@
 all-local: $(PREINSTALL_FILES)
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
@@ -70,11 +72,14 @@
 	@$(mkdir_p) $(PROJECT_INCLUDE)
 	@: > $(PROJECT_INCLUDE)/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
 
+if mpc505
 $(PROJECT_INCLUDE)/ictrl.h: ictrl/ictrl.h $(PROJECT_INCLUDE)/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/ictrl.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/ictrl.h
+endif
 
-CLEANFILES = $(PREINSTALL_FILES)
+CLEANFILES += $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/local.am
Index: c/src/lib/libcpu/powerpc/mpc6xx/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/mpc6xx/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/mpc6xx/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -7,96 +7,89 @@
 
 EXTRA_DIST =
-CLEANDIRS =
+EXTRA_PROGRAMS =
+CLEANFILES =
 noinst_DATA =
 
+if mpc6xx
 include_libcpudir = $(includedir)/libcpu
 include_libcpu_HEADERS = exceptions/raw_exception.h
 
 # exceptions
-exceptions_C_FILES = exceptions/raw_exception.c
-exceptions_S_FILES = exceptions/asm_utils.S
-EXTRA_DIST += $(exceptions_C_FILES) $(exceptions_S_FILES)
+EXTRA_PROGRAMS += exceptions.rel
+CLEANFILES += exceptions.rel
+exceptions_rel_SOURCES = exceptions/raw_exception.c exceptions/asm_utils.S
+exceptions_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+exceptions_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-exceptions_rel_OBJECTS = \
-    $(exceptions_C_FILES:exceptions/%.c=exceptions/$(ARCH)/%.$(OBJEXT)) \
-    $(exceptions_S_FILES:exceptions/%.S=exceptions/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += exceptions_g.rel
+CLEANFILES += exceptions_g.rel
+exceptions_g_rel_SOURCES = $(exceptions_rel_SOURCES)
+exceptions_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+exceptions_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-exceptions/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) exceptions/$(ARCH)
-	@: > exceptions/$(ARCH)/$(dirstamp)
-exceptions/$(ARCH)/%.$(OBJEXT): exceptions/%.c exceptions/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-exceptions/$(ARCH)/%.$(OBJEXT): exceptions/%.S exceptions/$(ARCH)/$(dirstamp)
-	${CCASCOMPILE} -o $@ -c $<
-exceptions/$(ARCH)/exceptions.rel: $(exceptions_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += exceptions/o-optimize exceptions/o-debug
-noinst_DATA += exceptions/$(ARCH)/exceptions.rel
+noinst_DATA += exceptions$(LIB_VARIANT).rel
 
 # mmu
 include_libcpu_HEADERS += mmu/bat.h mmu/pte121.h
-mmu_C_FILES = mmu/bat.c mmu/pte121.c
-mmu_S_FILES = mmu/mmuAsm.S
-EXTRA_DIST += $(mmu_C_FILES) $(mmu_S_FILES)
 
-mmu_rel_OBJECTS = $(mmu_C_FILES:mmu/%.c=mmu/$(ARCH)/%.$(OBJEXT)) \
-    $(mmu_S_FILES:mmu/%.S=mmu/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += mmu.rel
+CLEANFILES += mmu.rel
+mmu_rel_SOURCES = mmu/bat.c mmu/bat.h mmu/pte121.c mmu/pte121.h \
+    mmu/mmuAsm.S
+mmu_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-mmu/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) mmu/$(ARCH)
-	@: > mmu/$(ARCH)/$(dirstamp)
-mmu/$(ARCH)/%.$(OBJEXT): mmu/%.c mmu/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-mmu/$(ARCH)/%.$(OBJEXT): mmu/%.S mmu/$(ARCH)/$(dirstamp)
-	${CCASCOMPILE} -o $@ -c $<
-mmu/$(ARCH)/mmu.rel: $(mmu_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += mmu/o-optimize mmu/o-debug
-noinst_DATA += mmu/$(ARCH)/mmu.rel
+EXTRA_PROGRAMS += mmu_g.rel
+CLEANFILES += mmu_g.rel
+mmu_g_rel_SOURCES = $(mmu_rel_SOURCES)
+mmu_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+mmu_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += mmu$(LIB_VARIANT).rel
 
 # clock
 include_libcpu_HEADERS += clock/c_clock.h
 
-clock_C_FILES = clock/c_clock.c
-EXTRA_DIST += $(clock_C_FILES)
+EXTRA_PROGRAMS += clock.rel
+CLEANFILES += clock.rel
+clock_rel_SOURCES = clock/c_clock.c clock/c_clock.h
+clock_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock_rel_OBJECTS = $(clock_C_FILES:clock/%.c=clock/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += clock_g.rel
+CLEANFILES += clock_g.rel
+clock_g_rel_SOURCES = $(clock_rel_SOURCES)
+clock_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+clock_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) clock/$(ARCH)
-	@: > clock/$(ARCH)/$(dirstamp)
-clock/$(ARCH)/%.$(OBJEXT): clock/%.c clock/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-clock/$(ARCH)/clock.rel: $(clock_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += clock/o-optimize clock/o-debug
-noinst_DATA += clock/$(ARCH)/clock.rel
+noinst_DATA += clock$(LIB_VARIANT).rel
 
 # timer
+EXTRA_PROGRAMS += timer.rel
+CLEANFILES += timer.rel
+timer_rel_SOURCES = timer/timer.c
+timer_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer_C_FILES = timer/timer.c
-EXTRA_DIST += $(timer_C_FILES)
+EXTRA_PROGRAMS += timer_g.rel
+CLEANFILES += timer_g.rel
+timer_g_rel_SOURCES = $(timer_rel_SOURCES)
+timer_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+timer_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer_rel_OBJECTS = $(timer_C_FILES:timer/%.c=timer/$(ARCH)/%.$(OBJEXT))
-
-timer/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) timer/$(ARCH)
-	@: > timer/$(ARCH)/$(dirstamp)
-timer/$(ARCH)/%.$(OBJEXT): timer/%.c timer/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-timer/$(ARCH)/timer.rel: $(timer_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += timer/o-optimize timer/o-debug
-noinst_DATA += timer/$(ARCH)/timer.rel
+noinst_DATA += timer$(LIB_VARIANT).rel
+endif
 
 ## ----
 all-local: $(PREINSTALL_FILES)
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
+if mpc6xx
 $(PROJECT_INCLUDE)/libcpu/$(dirstamp):
 	@$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
 	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 
 $(PROJECT_INCLUDE)/libcpu/raw_exception.h: exceptions/raw_exception.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
@@ -115,6 +108,8 @@
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/c_clock.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/c_clock.h
+endif
 
-CLEANFILES = $(PREINSTALL_FILES)
+CLEANFILES += $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/local.am
Index: c/src/lib/libcpu/powerpc/mpc8260/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/mpc8260/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/mpc8260/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -4,5 +4,6 @@
 
 EXTRA_DIST =
-CLEANDIRS =
+EXTRA_PROGRAMS =
+CLEANFILES =
 noinst_DATA =
 
@@ -10,8 +11,8 @@
 include $(top_srcdir)/../../../automake/lib.am
 
+if mpc8260
 include_mpc8260dir = $(includedir)/mpc8260
 
 include_HEADERS = include/mpc8260.h
-include_mpc8260_HEADERS = include/console.h include/mmu.h include/cpm.h
 
 include_libcpudir = $(includedir)/libcpu
@@ -19,106 +20,109 @@
 
 ## console-generic
-console_C_FILES = console-generic/console-generic.c
-EXTRA_DIST += $(console_C_FILES)
+include_mpc8260_HEADERS = include/console.h
 
-console_rel_OBJECTS = \
-    $(console_C_FILES:console-generic/%.c=console-generic/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += console-generic.rel
+CLEANFILES += console-generic.rel
+console_generic_rel_SOURCES = console-generic/console-generic.c \
+    include/console.h
+console_generic_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+console_generic_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-console-generic/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) console-generic/$(ARCH)
-	@: > console-generic/$(ARCH)/$(dirstamp)
-console-generic/$(ARCH)/%.$(OBJEXT): console-generic/%.c console-generic/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-console-generic/$(ARCH)/console-generic.rel: $(console_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += console-generic/o-optimize console-generic/o-debug
-noinst_DATA += console-generic/$(ARCH)/console-generic.rel
+EXTRA_PROGRAMS += console-generic_g.rel
+CLEANFILES += console-generic_g.rel
+console_generic_g_rel_SOURCES = $(console_generic_rel_SOURCES)
+console_generic_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+console_generic_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += console-generic$(LIB_VARIANT).rel
 
 ## clock
-clock_C_FILES = clock/clock.c
-EXTRA_DIST += $(clock_C_FILES)
+EXTRA_PROGRAMS += clock.rel
+CLEANFILES += clock.rel
+clock_rel_SOURCES = clock/clock.c
+clock_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock_rel_OBJECTS = $(clock_C_FILES:clock/%.c=clock/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += clock_g.rel
+CLEANFILES += clock_g.rel
+clock_g_rel_SOURCES = $(clock_rel_SOURCES)
+clock_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+clock_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) clock/$(ARCH)
-	@: > clock/$(ARCH)/$(dirstamp)
-clock/$(ARCH)/%.$(OBJEXT): clock/%.c clock/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-clock/$(ARCH)/clock.rel: $(clock_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += clock/o-optimize clock/o-debug
-noinst_DATA += clock/$(ARCH)/clock.rel
+noinst_DATA += clock$(LIB_VARIANT).rel
 
 ## cpm
-cpm_C_FILES = cpm/cp.c cpm/dpram.c cpm/brg.c
-EXTRA_DIST += $(cpm_C_FILES)
+include_mpc8260_HEADERS += include/cpm.h
 
-cpm_rel_OBJECTS = $(cpm_C_FILES:cpm/%.c=cpm/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += cpm.rel
+CLEANFILES += cpm.rel
+cpm_rel_SOURCES = cpm/cp.c cpm/dpram.c cpm/brg.c include/cpm.h
+cpm_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+cpm_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-cpm/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) cpm/$(ARCH)
-	@: > cpm/$(ARCH)/$(dirstamp)
-cpm/$(ARCH)/%.$(OBJEXT): cpm/%.c cpm/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-cpm/$(ARCH)/cp.rel: $(cpm_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += cpm/o-optimize cpm/o-debug
-noinst_DATA += cpm/$(ARCH)/cp.rel
+EXTRA_PROGRAMS += cpm_g.rel
+CLEANFILES += cpm_g.rel
+cpm_g_rel_SOURCES = $(cpm_rel_SOURCES)
+cpm_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+cpm_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += cpm$(LIB_VARIANT).rel
 
 ## exceptions
-exceptions_C_FILES = exceptions/raw_exception.c
-exceptions_S_FILES = exceptions/asm_utils.S
+include_libcpu_HEADERS += exceptions/raw_exception.h
 
-exceptions_rel_OBJECTS = \
-    $(exceptions_C_FILES:exceptions/%.c=exceptions/$(ARCH)/%.$(OBJEXT)) \
-    $(exceptions_S_FILES:exceptions/%.S=exceptions/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += exceptions.rel
+CLEANFILES += exceptions.rel
+exceptions_rel_SOURCES = exceptions/raw_exception.c exceptions/asm_utils.S \
+    exceptions/raw_exception.h
+exceptions_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+exceptions_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-exceptions/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) exceptions/$(ARCH)
-	@: > exceptions/$(ARCH)/$(dirstamp)
-exceptions/$(ARCH)/%.$(OBJEXT): exceptions/%.c exceptions/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-exceptions/$(ARCH)/%.$(OBJEXT): exceptions/%.S exceptions/$(ARCH)/$(dirstamp)
-	${CCASCOMPILE} -o $@ -c $<
-exceptions/$(ARCH)/exceptions.rel: $(exceptions_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += exceptions/o-optimize exceptions/o-debug
-noinst_DATA += exceptions/$(ARCH)/exceptions.rel
+EXTRA_PROGRAMS += exceptions_g.rel
+CLEANFILES += exceptions_g.rel
+exceptions_g_rel_SOURCES = $(exceptions_rel_SOURCES)
+exceptions_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+exceptions_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += exceptions$(LIB_VARIANT).rel
 
 ## mmu
-mmu_C_FILES = mmu/mmu.c
-EXTRA_DIST += $(mmu_C_FILES)
+include_mpc8260_HEADERS += include/mmu.h
 
-mmu_rel_OBJECTS = $(mmu_C_FILES:mmu/%.c=mmu/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += mmu.rel
+CLEANFILES += mmu.rel
+mmu_rel_SOURCES = mmu/mmu.c include/mmu.h
+mmu_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-mmu/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) mmu/$(ARCH)
-	@: > mmu/$(ARCH)/$(dirstamp)
-mmu/$(ARCH)/%.$(OBJEXT): mmu/%.c mmu/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-mmu/$(ARCH)/mmu.rel: $(mmu_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += mmu/o-optimize mmu/o-debug
-noinst_DATA += mmu/$(ARCH)/mmu.rel
+EXTRA_PROGRAMS += mmu_g.rel
+CLEANFILES += mmu_g.rel
+mmu_g_rel_SOURCES = $(mmu_rel_SOURCES)
+mmu_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+mmu_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += mmu$(LIB_VARIANT).rel
 
 ## timer
-timer_C_FILES = timer/timer.c
-EXTRA_DIST += $(timer_C_FILES)
+EXTRA_PROGRAMS += timer.rel
+CLEANFILES += timer.rel
+timer_rel_SOURCES = timer/timer.c
+timer_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer_rel_OBJECTS = $(timer_C_FILES:timer/%.c=timer/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += timer_g.rel
+CLEANFILES += timer_g.rel
+timer_g_rel_SOURCES = $(timer_rel_SOURCES)
+timer_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+timer_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) timer/$(ARCH)
-	@: > timer/$(ARCH)/$(dirstamp)
-timer/$(ARCH)/%.$(OBJEXT): timer/%.c timer/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-timer/$(ARCH)/timer.rel: $(timer_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += timer/o-optimize timer/o-debug
-noinst_DATA += timer/$(ARCH)/timer.rel
+noinst_DATA += timer$(LIB_VARIANT).rel
+endif
+
+all-local: $(PREINSTALL_FILES)
 
 ## --
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
@@ -126,10 +130,11 @@
 	@$(mkdir_p) $(PROJECT_INCLUDE)
 	@: > $(PROJECT_INCLUDE)/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
 
+if mpc8260
 $(PROJECT_INCLUDE)/mpc8260/$(dirstamp):
 	@$(mkdir_p) $(PROJECT_INCLUDE)/mpc8260
 	@: > $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
 
 $(PROJECT_INCLUDE)/mpc8260.h: include/mpc8260.h $(PROJECT_INCLUDE)/$(dirstamp)
@@ -137,11 +142,16 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260.h
 
+$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
+	@$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
+	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+
+$(PROJECT_INCLUDE)/libcpu/raw_exception.h: exceptions/raw_exception.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/raw_exception.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/raw_exception.h
+
 $(PROJECT_INCLUDE)/mpc8260/console.h: include/console.h $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc8260/console.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260/console.h
-
-$(PROJECT_INCLUDE)/mpc8260/mmu.h: include/mmu.h $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc8260/mmu.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260/mmu.h
 
 $(PROJECT_INCLUDE)/mpc8260/cpm.h: include/cpm.h $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
@@ -149,14 +159,15 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260/cpm.h
 
-$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
-	@$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
-	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
-
 $(PROJECT_INCLUDE)/libcpu/raw_exception.h: exceptions/raw_exception.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/raw_exception.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/raw_exception.h
 
-CLEANFILES = $(PREINSTALL_FILES)
+$(PROJECT_INCLUDE)/mpc8260/mmu.h: include/mmu.h $(PROJECT_INCLUDE)/mpc8260/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc8260/mmu.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260/mmu.h
+endif
+
+CLEANFILES += $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/local.am
Index: c/src/lib/libcpu/powerpc/mpc8xx/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/mpc8xx/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/mpc8xx/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -3,6 +3,7 @@
 ##
 
-CLEANDIRS =
+CLEANFILES =
 EXTRA_DIST =
+EXTRA_PROGRAMS =
 noinst_DATA =
 
@@ -10,117 +11,113 @@
 include $(top_srcdir)/../../../automake/lib.am
 
+if mpc8xx
 include_mpc8xxdir = $(includedir)/mpc8xx
+include_libcpudir = $(includedir)/libcpu
 
 include_HEADERS = include/mpc8xx.h
-include_mpc8xx_HEADERS = include/console.h include/cpm.h include/mmu.h
 
-include_libcpudir = $(includedir)/libcpu
+## clock
+EXTRA_PROGRAMS += clock.rel
+CLEANFILES += clock.rel
+clock_rel_SOURCES = clock/clock.c
+clock_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+EXTRA_PROGRAMS += clock_g.rel
+CLEANFILES += clock_g.rel
+clock_g_rel_SOURCES = $(clock_rel_SOURCES)
+clock_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+clock_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += clock$(LIB_VARIANT).rel
+
+## console-generic
+include_mpc8xx_HEADERS = include/console.h
+
+EXTRA_PROGRAMS += console-generic.rel
+CLEANFILES += console-generic.rel
+console_generic_rel_SOURCES = console-generic/console-generic.c
+console_generic_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+console_generic_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+EXTRA_PROGRAMS += console-generic_g.rel
+CLEANFILES += console-generic_g.rel
+console_generic_g_rel_SOURCES = $(console_generic_rel_SOURCES)
+console_generic_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+console_generic_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += console-generic$(LIB_VARIANT).rel
+
+## cpm
+include_mpc8xx_HEADERS += include/cpm.h
+
+EXTRA_PROGRAMS += cpm.rel
+CLEANFILES += cpm.rel
+cpm_rel_SOURCES = cpm/cp.c cpm/dpram.c
+cpm_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+cpm_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+EXTRA_PROGRAMS += cpm_g.rel
+CLEANFILES += cpm_g.rel
+cpm_g_rel_SOURCES = $(cpm_rel_SOURCES)
+cpm_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+cpm_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += cpm$(LIB_VARIANT).rel
+
+## exceptions
 include_libcpu_HEADERS = exceptions/raw_exception.h
 
-## clock
-clock_C_FILES = clock/clock.c
-EXTRA_DIST += $(clock_C_FILES)
+EXTRA_PROGRAMS += exceptions.rel
+CLEANFILES += exceptions.rel
+exceptions_rel_SOURCES = exceptions/raw_exception.c exceptions/asm_utils.S
+exceptions_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+exceptions_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock_rel_OBJECTS = $(clock_C_FILES:clock/%.c=clock/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += exceptions_g.rel
+CLEANFILES += exceptions_g.rel
+exceptions_g_rel_SOURCES = $(exceptions_rel_SOURCES)
+exceptions_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+exceptions_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) clock/$(ARCH)
-	@: > clock/$(ARCH)/$(dirstamp)
-clock/$(ARCH)/%.$(OBJEXT): clock/%.c clock/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-clock/$(ARCH)/clock.rel: $(clock_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += clock/o-optimize clock/o-debug
-noinst_DATA += clock/$(ARCH)/clock.rel
-
-## console-generic
-console_C_FILES = console-generic/console-generic.c
-EXTRA_DIST += $(console_C_FILES)
-
-console_rel_OBJECTS = \
-    $(console_C_FILES:console-generic/%.c=console-generic/${ARCH}/%.$(OBJEXT))
-
-console-generic/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) console-generic/$(ARCH)
-	@: > console-generic/$(ARCH)/$(dirstamp)
-console-generic/$(ARCH)/%.$(OBJEXT): console-generic/%.c console-generic/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-console-generic/$(ARCH)/console-generic.rel: $(console_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += console-generic/o-optimize console-generic/o-debug
-noinst_DATA += console-generic/$(ARCH)/console-generic.rel
-
-## cpm
-cpm_C_FILES = cpm/cp.c cpm/dpram.c
-EXTRA_DIST += $(cpm_C_FILES)
-
-cpm_rel_OBJECTS = $(cpm_C_FILES:cpm/%.c=cpm/${ARCH}/%.$(OBJEXT))
-
-cpm/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) cpm/$(ARCH)
-	@: > cpm/$(ARCH)/$(dirstamp)
-cpm/$(ARCH)/%.$(OBJEXT): cpm/%.c cpm/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-cpm/$(ARCH)/cpm.rel: $(cpm_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += cpm/o-optimize cpm/o-debug
-noinst_DATA += cpm/$(ARCH)/cpm.rel
-
-## exceptions
-exceptions_C_FILES = exceptions/raw_exception.c
-exceptions_S_FILES = exceptions/asm_utils.S
-EXTRA_DIST += $(exceptions_C_FILES) $(exceptions_S_FILES)
-
-exceptions_rel_OBJECTS = \
-    $(exceptions_C_FILES:exceptions/%.c=exceptions/$(ARCH)/%.$(OBJEXT)) \
-    $(exceptions_S_FILES:exceptions/%.S=exceptions/$(ARCH)/%.$(OBJEXT))
-
-exceptions/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) exceptions/$(ARCH)
-	@: > exceptions/$(ARCH)/$(dirstamp)
-exceptions/$(ARCH)/%.$(OBJEXT): exceptions/%.c exceptions/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-exceptions/$(ARCH)/%.$(OBJEXT): exceptions/%.S exceptions/$(ARCH)/$(dirstamp)
-	${CCASCOMPILE} -o $@ -c $<
-exceptions/$(ARCH)/exceptions.rel: $(exceptions_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += exceptions/o-optimize exceptions/o-debug
-noinst_DATA += exceptions/$(ARCH)/exceptions.rel
+noinst_DATA += exceptions$(LIB_VARIANT).rel
 
 ## mmu
-mmu_C_FILES = mmu/mmu.c
-EXTRA_DIST += $(mmu_C_FILES)
+include_mpc8xx_HEADERS += include/mmu.h
 
-mmu_rel_OBJECTS = $(mmu_C_FILES:mmu/%.c=mmu/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += mmu.rel
+CLEANFILES += mmu.rel
+mmu_rel_SOURCES = mmu/mmu.c
+mmu_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+mmu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-mmu/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) mmu/$(ARCH)
-	@: > mmu/$(ARCH)/$(dirstamp)
-mmu/$(ARCH)/%.$(OBJEXT): mmu/%.c mmu/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-mmu/$(ARCH)/mmu.rel: $(mmu_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += mmu/o-optimize mmu/o-debug
-noinst_DATA += mmu/$(ARCH)/mmu.rel
+EXTRA_PROGRAMS += mmu_g.rel
+CLEANFILES += mmu_g.rel
+mmu_g_rel_SOURCES = $(mmu_rel_SOURCES)
+mmu_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+mmu_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += mmu$(LIB_VARIANT).rel
 
 ## timer
-timer_C_FILES = timer/timer.c
-EXTRA_DIST += $(timer_C_FILES)
+EXTRA_PROGRAMS += timer.rel
+CLEANFILES += timer.rel
+timer_rel_SOURCES = timer/timer.c
+timer_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer_rel_OBJECTS = $(timer_C_FILES:timer/%.c=timer/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += timer_g.rel
+CLEANFILES += timer_g.rel
+timer_g_rel_SOURCES = $(timer_rel_SOURCES)
+timer_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+timer_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) timer/$(ARCH)
-	@: > timer/$(ARCH)/$(dirstamp)
-timer/$(ARCH)/%.$(OBJEXT): timer/%.c timer/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-timer/$(ARCH)/timer.rel: $(timer_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += timer/o-optimize timer/o-debug
-noinst_DATA += timer/$(ARCH)/timer.rel
+noinst_DATA += timer$(LIB_VARIANT).rel
+endif
 
 ## --
 all-local: $(PREINSTALL_FILES)
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
@@ -128,10 +125,16 @@
 	@$(mkdir_p) $(PROJECT_INCLUDE)
 	@: > $(PROJECT_INCLUDE)/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
 
+if mpc8xx
 $(PROJECT_INCLUDE)/mpc8xx/$(dirstamp):
 	@$(mkdir_p) $(PROJECT_INCLUDE)/mpc8xx
 	@: > $(PROJECT_INCLUDE)/mpc8xx/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8xx/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/mpc8xx/$(dirstamp)
+
+$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
+	@$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
+	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 
 $(PROJECT_INCLUDE)/mpc8xx.h: include/mpc8xx.h $(PROJECT_INCLUDE)/$(dirstamp)
@@ -147,18 +150,15 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8xx/cpm.h
 
-$(PROJECT_INCLUDE)/mpc8xx/mmu.h: include/mmu.h $(PROJECT_INCLUDE)/mpc8xx/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc8xx/mmu.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8xx/mmu.h
-
-$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
-	@$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
-	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
-
 $(PROJECT_INCLUDE)/libcpu/raw_exception.h: exceptions/raw_exception.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/raw_exception.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/raw_exception.h
 
-CLEANFILES = $(PREINSTALL_FILES)
+$(PROJECT_INCLUDE)/mpc8xx/mmu.h: include/mmu.h $(PROJECT_INCLUDE)/mpc8xx/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc8xx/mmu.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8xx/mmu.h
+endif
+
+CLEANFILES += $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/local.am
Index: c/src/lib/libcpu/powerpc/ppc403/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/ppc403/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/ppc403/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -3,6 +3,7 @@
 ##
 
-CLEANDIRS =
+CLEANFILES =
 EXTRA_DIST =
+EXTRA_PROGRAMS =
 noinst_DATA =
 
@@ -10,113 +11,110 @@
 include $(top_srcdir)/../../../automake/lib.am
 
+if ppc403
 ## clock
-clock_C_FILES = clock/clock.c
-EXTRA_DIST += $(clock_C_FILES)
+EXTRA_PROGRAMS += clock.rel
+CLEANFILES += clock.rel
+clock_rel_SOURCES = clock/clock.c
+clock_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock_rel_OBJECTS = $(clock_C_FILES:clock/%.c=clock/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += clock_g.rel
+CLEANFILES += clock_g.rel
+clock_g_rel_SOURCES = $(clock_rel_SOURCES)
+clock_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+clock_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-clock/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) clock/$(ARCH)
-	@: > clock/$(ARCH)/$(dirstamp)
-clock/$(ARCH)/%.$(OBJEXT): clock/%.c clock/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-clock/$(ARCH)/clock.rel: $(clock_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += clock/o-optimize clock/o-debug
-noinst_DATA += clock/$(ARCH)/clock.rel
+noinst_DATA += clock$(LIB_VARIANT).rel
 
 ## console
-if ppc403
-console_C_FILES = console/console.c
+EXTRA_PROGRAMS += console.rel
+CLEANFILES += console.rel
+if ppc405
+console_rel_SOURCES = console/console405.c
+else
+console_rel_SOURCES = console/console.c
 endif
-EXTRA_DIST += console/console.c
-if ppc405
-console_C_FILES = console/console405.c
-endif
-EXTRA_DIST += console/console405.c
+console_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-console_rel_OBJECTS = \
-    $(console_C_FILES:console/%.c=console/$(ARCH)/%.$(OBJEXT))
-console/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) console/$(ARCH)
-	@: > console/$(ARCH)/$(dirstamp)
-console/$(ARCH)/%.$(OBJEXT): console/%.c console/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-console/$(ARCH)/console.rel: $(console_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += console/o-optimize console/o-debug
-noinst_DATA += console/$(ARCH)/console.rel
+EXTRA_PROGRAMS += console_g.rel
+CLEANFILES += console_g.rel
+console_g_rel_SOURCES = $(console_rel_SOURCES)
+console_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+console_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += console$(LIB_VARIANT).rel
 
 ## ictrl
 include_HEADERS = ictrl/ictrl.h
-ictrl_C_FILES = ictrl/ictrl.c
-EXTRA_DIST += $(ictrl_C_FILES)
 
-ictrl_rel_OBJECTS = $(ictrl_C_FILES:ictrl/%.c=ictrl/$(ARCH)/%.$(OBJEXT))
-ictrl/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) ictrl/$(ARCH)
-	@: > ictrl/$(ARCH)/$(dirstamp)
-ictrl/$(ARCH)/%.$(OBJEXT): ictrl/%.c ictrl/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-ictrl/$(ARCH)/ictrl.rel: $(ictrl_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += ictrl/o-optimize ictrl/o-debug
-noinst_DATA += ictrl/$(ARCH)/ictrl.rel
+EXTRA_PROGRAMS += ictrl.rel
+CLEANFILES += ictrl.rel
+ictrl_rel_SOURCES = ictrl/ictrl.c ictrl/ictrl.h
+ictrl_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+ictrl_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+EXTRA_PROGRAMS += ictrl_g.rel
+CLEANFILES += ictrl_g.rel
+ictrl_g_rel_SOURCES = $(ictrl_rel_SOURCES)
+ictrl_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+ictrl_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += ictrl$(LIB_VARIANT).rel
 
 ## timer
-timer_C_FILES = timer/timer.c
+EXTRA_PROGRAMS += timer.rel
+CLEANFILES += timer.rel
+timer_rel_SOURCES = timer/timer.c
+timer_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer_rel_OBJECTS = $(timer_C_FILES:timer/%.c=timer/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += timer_g.rel
+CLEANFILES += timer_g.rel
+timer_g_rel_SOURCES = $(timer_rel_SOURCES)
+timer_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+timer_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-timer/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) timer/$(ARCH)
-	@: > timer/$(ARCH)/$(dirstamp)
-timer/$(ARCH)/%.$(OBJEXT): timer/%.c timer/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-timer/$(ARCH)/timer.rel: $(timer_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += timer/o-optimize timer/o-debug
-noinst_DATA += timer/$(ARCH)/timer.rel
+noinst_DATA += timer$(LIB_VARIANT).rel
 
 ## tty_drv
 if ppc405
 include_HEADERS += tty_drv/tty_drv.h
-tty_drv_C_FILES = tty_drv/tty_drv.c
-EXTRA_DIST += $(tty_drv_C_FILES)
 
-tty_drv_rel_OBJECTS = \
-    $(tty_drv_C_FILES:tty_drv/%.c=tty_drv/$(ARCH)/%.$(OBJEXT))
+EXTRA_PROGRAMS += tty_drv.rel
+CLEANFILES += tty_drv.rel
+tty_drv_rel_SOURCES = tty_drv/tty_drv.c tty_drv/tty_drv.h
+tty_drv_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+tty_drv_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-tty_drv/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) tty_drv/$(ARCH)
-	@: > tty_drv/$(ARCH)/$(dirstamp)
-tty_drv/$(ARCH)/%.$(OBJEXT): tty_drv/%.c tty_drv/$(ARCH)/$(dirstamp)
-	${COMPILE} -o $@ -c $<
-tty_drv/$(ARCH)/tty_drv.rel: $(tty_drv_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += tty_drv/o-optimize tty_drv/o-debug
-noinst_DATA += tty_drv/$(ARCH)/tty_drv.rel
+EXTRA_PROGRAMS += tty_drv_g.rel
+CLEANFILES += tty_drv_g.rel
+tty_drv_g_rel_SOURCES = $(tty_drv_rel_SOURCES)
+tty_drv_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+tty_drv_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_DATA += tty_drv$(LIB_VARIANT).rel
 endif
 
 ## vectors
-vectors_S_FILES = vectors/vectors.S vectors/align_h.S
-EXTRA_DIST += $(vectors_S_FILES)
+EXTRA_PROGRAMS += vectors.rel
+CLEANFILES += vectors.rel
+vectors_rel_SOURCES = vectors/vectors.S vectors/align_h.S
+vectors_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_OPTIMIZE_V)
+vectors_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-vectors_rel_OBJECTS = \
-    $(vectors_S_FILES:vectors/%.S=vectors/${ARCH}/%.$(OBJEXT))
+EXTRA_PROGRAMS += vectors_g.rel
+CLEANFILES += vectors_g.rel
+vectors_g_rel_SOURCES = $(vectors_rel_SOURCES)
+vectors_g_rel_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAGS_DEBUG_V)
+vectors_g_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
 
-vectors/$(ARCH)/$(dirstamp):
-	@$(mkdir_p) vectors/$(ARCH)
-	@: > vectors/$(ARCH)/$(dirstamp)
-vectors/$(ARCH)/%.$(OBJEXT): vectors/%.S vectors/$(ARCH)/$(dirstamp)
-	${CCASCOMPILE} -o $@ -c $<
-vectors/$(ARCH)/vectors.rel: $(vectors_rel_OBJECTS)
-	$(make-rel)
-CLEANDIRS += vectors/o-optimize vectors/o-debug
-noinst_DATA += vectors/$(ARCH)/vectors.rel
+noinst_DATA += vectors$(LIB_VARIANT).rel
+endif
 
 ## --
 all-local: $(PREINSTALL_FILES)
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
@@ -124,5 +122,7 @@
 	@$(mkdir_p) $(PROJECT_INCLUDE)
 	@: > $(PROJECT_INCLUDE)/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
+
+if ppc403
 
 $(PROJECT_INCLUDE)/ictrl.h: ictrl/ictrl.h $(PROJECT_INCLUDE)/$(dirstamp)
@@ -135,6 +135,8 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/tty_drv.h
 endif
+endif
 
-CLEANFILES = $(PREINSTALL_FILES)
+CLEANFILES += $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/local.am
Index: c/src/lib/libcpu/powerpc/shared/Makefile.am
===================================================================
--- c/src/lib/libcpu/powerpc/shared/Makefile.am	(revision faf45cca28549fba8ac7dc68d3f614d6a7d2543d)
+++ c/src/lib/libcpu/powerpc/shared/Makefile.am	(revision ba4eefd932ed022d143519c5e4a1a9ae628223a6)
@@ -7,5 +7,5 @@
 
 # include
-
+if shared
 libcpuspec_C_FILES = include/cpuIdent.c
 libcpuspec_OBJS = \
@@ -53,11 +53,14 @@
 
 all-local: $(PREINSTALL_FILES) include/$(ARCH)/libcpuspec.a $(src_O_FILES) $(common_O_FILES)
+endif
 
+PREINSTALL_DIRS =
 PREINSTALL_FILES =
 
+if shared
 $(PROJECT_INCLUDE)/libcpu/$(dirstamp):
 	@$(mkdir_p) $(PROJECT_INCLUDE)/libcpu
 	@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
 
 $(PROJECT_INCLUDE)/libcpu/spr.h: include/spr.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
@@ -96,6 +99,8 @@
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cache.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cache.h
+endif
 
 CLEANFILES = $(PREINSTALL_FILES)
+DISTCLEANFILES = $(PREINSTALL_DIRS)
 
 include $(top_srcdir)/../../../automake/local.am
