Index: c/src/lib/libbsp/ChangeLog
===================================================================
--- c/src/lib/libbsp/ChangeLog	(revision 900301fecbb86545586528a734bab3d14524d27e)
+++ c/src/lib/libbsp/ChangeLog	(revision 57d673c9823621a66ca2bac86e1af367d233dc82)
@@ -1,2 +1,9 @@
+2003-12-03	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* Makefile.am: Merge-in shared/Makefile.am, shmdr/Makefile.am.
+	* shared/Makefile.am: Remove.
+	* shmdir/Makefile.am: Remove.
+	* bsp.am: Add preinstallation dirstamp support.
+
 2003-12-02	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: c/src/lib/libbsp/Makefile.am
===================================================================
--- c/src/lib/libbsp/Makefile.am	(revision 900301fecbb86545586528a734bab3d14524d27e)
+++ c/src/lib/libbsp/Makefile.am	(revision 57d673c9823621a66ca2bac86e1af367d233dc82)
@@ -2,4 +2,7 @@
 ## $Id$
 ##
+
+include $(top_srcdir)/automake/compile.am
+include $(top_srcdir)/automake/lib.am
 
 # If we are building a "real" BSP, then we need to descend into the
@@ -9,9 +12,72 @@
 # into that directory.
 
-SUBDIRS = shared shmdr @libbsp_cpu_subdir@
-DIST_SUBDIRS = shared shmdr @libbsp_cpu_subdir@
+SUBDIRS = @libbsp_cpu_subdir@
+DIST_SUBDIRS = @libbsp_cpu_subdir@
 
 EXTRA_DIST = MERGE.PROCEDURE bsp.am
 
+# shared
+EXTRA_DIST += shared/bootcard.c shared/bspclean.c shared/bsplibc.c \
+    shared/bsppost.c shared/console-polled.c shared/console.c \
+    shared/gnatinstallhandler.c shared/main.c shared/sbrk.c shared/tod.c \
+    shared/tod.h
+EXTRA_DIST += shared/vmeUniverse/vmeUniverse.c \
+    shared/vmeUniverse/vmeUniverse.h
+EXTRA_DIST += shared/include/coverhd.h
+EXTRA_DIST += shared/gdbstub/rtems-stub-glue.c
+
+# shmdr
+shmdr_C_FILES = shmdr/addlq.c shmdr/cnvpkt.c shmdr/getlq.c shmdr/dump.c \
+    shmdr/fatal.c shmdr/getpkt.c shmdr/init.c shmdr/initlq.c shmdr/intr.c \
+    shmdr/mpisr.c shmdr/poll.c shmdr/receive.c shmdr/retpkt.c shmdr/send.c \
+    shmdr/setckvec.c
+shmdr_OBJS = $(shmdr_C_FILES:shmdr/%.c=shmdr/$(ARCH)/%.$(OBJEXT))
+
+# the .rel file built here will be put into libbsp.a by
+#   ../$(RTEMS_BSP_FAMILY)/wrapup/Makefile
+
+shmdr/$(ARCH)/$(dirstamp):
+	@$(mkinstalldirs) shmdr/$(ARCH)
+	@: > shmdr/$(ARCH)/$(dirstamp)
+shmdr/$(ARCH)/%.$(OBJEXT): shmdr/%.c shmdr/$(ARCH)/$(dirstamp)
+	${COMPILE} -o $@ -c $<
+shmdr/$(ARCH)/shmdr.rel: $(shmdr_OBJS)
+	$(make-rel)
+
+$(PROJECT_RELEASE)/lib/shmdr$(LIB_VARIANT).rel: shmdr/$(ARCH)/shmdr.rel
+	$(INSTALL_DATA) $< $@
+
+if HAS_MP
+include_HEADERS = shmdir/shm_driver.h shmdir/mpci.h
+
+TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/shmdr$(LIB_VARIANT).rel
+
+all-local: $(PREINSTALL_FILES) shmdr/$(ARCH)/shmdr.rel $(TMPINSTALL_FILES)
+endif
+
+.PRECIOUS: shmdr/$(ARCH)/shmdr.rel
+
+EXTRA_DIST += shmdr/README shmdr/addlq.c shmdr/cnvpkt.c shmdr/dump.c \
+    shmdr/fatal.c shmdr/getlq.c shmdr/getpkt.c shmdr/init.c shmdr/initlq.c \
+    shmdr/intr.c shmdr/mpisr.c shmdr/poll.c shmdr/receive.c shmdr/retpkt.c \
+    shmdr/send.c shmdr/setckvec.c
+
+PREINSTALL_FILES =
+
+$(PROJECT_INCLUDE)/$(dirstamp):
+	@$(mkinstalldirs) $(PROJECT_INCLUDE)
+	@: > $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/$(dirstamp)
+
+if HAS_MP
+$(PROJECT_INCLUDE)/shm_driver.h: shmdir/shm_driver.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/shm_driver.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/shm_driver.h
+
+$(PROJECT_INCLUDE)/mpci.h: shmdir/mpci.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpci.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpci.h
+endif
+
 include $(top_srcdir)/automake/subdirs.am
 include $(top_srcdir)/automake/local.am
Index: c/src/lib/libbsp/bsp.am
===================================================================
--- c/src/lib/libbsp/bsp.am	(revision 900301fecbb86545586528a734bab3d14524d27e)
+++ c/src/lib/libbsp/bsp.am	(revision 57d673c9823621a66ca2bac86e1af367d233dc82)
@@ -8,21 +8,23 @@
 nodist_include_HEADERS = include/bspopts.h
 
-$(PROJECT_ROOT)/@RTEMS_BSP@/lib:
-	@$(mkinstalldirs) $@
-PREINSTALL_FILES = $(PROJECT_ROOT)/@RTEMS_BSP@/lib
+$(PROJECT_ROOT)/@RTEMS_BSP@/lib/$(dirstamp):
+	@$(mkinstalldirs) $(PROJECT_ROOT)/@RTEMS_BSP@/lib
+	@: > $(PROJECT_ROOT)/@RTEMS_BSP@/lib/$(dirstamp)
+PREINSTALL_FILES = $(PROJECT_ROOT)/@RTEMS_BSP@/lib/$(dirstamp)
 
-$(PROJECT_INCLUDE):
-	@$(mkinstalldirs) $@
-PREINSTALL_FILES += $(PROJECT_INCLUDE)
+$(PROJECT_INCLUDE)/$(dirstamp):
+	@$(mkinstalldirs) $(PROJECT_INCLUDE)
+	@: > $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/$(dirstamp)
 
-$(PROJECT_ROOT)/@RTEMS_BSP@/lib/bsp_specs: bsp_specs
+$(PROJECT_ROOT)/@RTEMS_BSP@/lib/bsp_specs: bsp_specs $(PROJECT_ROOT)/@RTEMS_BSP@/lib/$(dirstamp)
 	$(INSTALL_DATA) $< $@
 PREINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/lib/bsp_specs
 
-$(PROJECT_INCLUDE)/bsp.h: include/bsp.h
+$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
 	$(INSTALL_DATA) $< $@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
 
-$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h
+$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
 	$(INSTALL_DATA) $< $@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
Index: c/src/lib/libbsp/shared/Makefile.am
===================================================================
--- c/src/lib/libbsp/shared/Makefile.am	(revision 900301fecbb86545586528a734bab3d14524d27e)
+++ 	(revision )
@@ -1,14 +1,0 @@
-##
-## $Id$
-##
-
-EXTRA_DIST = bootcard.c bspclean.c bsplibc.c bsppost.c console-polled.c \
-    console.c gnatinstallhandler.c main.c sbrk.c tod.c tod.h
-
-EXTRA_DIST += vmeUniverse/vmeUniverse.c vmeUniverse/vmeUniverse.h
-
-EXTRA_DIST += include/coverhd.h
-
-EXTRA_DIST += gdbstub/rtems-stub-glue.c
-
-include $(top_srcdir)/automake/local.am
Index: c/src/lib/libbsp/shmdr/Makefile.am
===================================================================
--- c/src/lib/libbsp/shmdr/Makefile.am	(revision 900301fecbb86545586528a734bab3d14524d27e)
+++ 	(revision )
@@ -1,53 +1,0 @@
-##
-## $Id$
-##
-
-
-PGM = $(ARCH)/shmdr.rel
-
-C_FILES = addlq.c cnvpkt.c getlq.c dump.c fatal.c getpkt.c init.c initlq.c \
-    intr.c mpisr.c poll.c receive.c retpkt.c send.c setckvec.c
-OBJS = $(C_FILES:%.c=$(ARCH)/%.$(OBJEXT))
-
-include $(top_srcdir)/automake/compile.am
-include $(top_srcdir)/automake/lib.am
-
-#
-# (OPTIONAL) Add local stuff here using +=
-#
-
-$(PGM): $(OBJS)
-	$(make-rel)
-
-$(PROJECT_RELEASE)/lib/shmdr$(LIB_VARIANT).rel: $(ARCH)/shmdr.rel
-	$(INSTALL_DATA) $< $@
-
-# the .rel file built here will be put into libbsp.a by
-#   ../$(RTEMS_BSP_FAMILY)/wrapup/Makefile
-
-$(PROJECT_INCLUDE):
-	$(mkinstalldirs) $@
-
-if HAS_MP
-include_HEADERS = shm_driver.h mpci.h
-endif
-
-$(PROJECT_INCLUDE)/%.h: %.h
-	$(INSTALL_DATA) $< $@
-
-PREINSTALL_FILES  = $(PROJECT_INCLUDE) 
-PREINSTALL_FILES += $(include_HEADERS:%.h=$(PROJECT_INCLUDE)/%.h)
-
-TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/shmdr$(LIB_VARIANT).rel
-
-if HAS_MP
-all-local: $(PREINSTALL_FILES) $(PGM) $(TMPINSTALL_FILES)
-endif
-
-.PRECIOUS: $(PGM)
-
-EXTRA_DIST = README addlq.c cnvpkt.c dump.c fatal.c getlq.c getpkt.c init.c \
-    initlq.c intr.c mpisr.c poll.c receive.c retpkt.c send.c \
-    setckvec.c
-
-include $(top_srcdir)/automake/local.am
