Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision bcb14b51a0d19c902bee4aabf5540dbf405e490e)
+++ libcfa/src/Makefile.am	(revision a9fb796f56bcdcc50c4cfcea5f2ae6641c3b82b2)
@@ -16,5 +16,5 @@
 
 # create object files in directory with source files
-AUTOMAKE_OPTIONS = subdir-objects
+AUTOMAKE_OPTIONS = foreign subdir-objects
 ARFLAGS = cr
 
@@ -24,9 +24,11 @@
 lib_LIBRARIES =  libcfa.a
 
+VPATH += :../prelude
+
 # AM_CFLAGS for all cfa source
 # AM_CFAFLAGS for only cfa source
 # use -no-include-stdhdr to prevent rebuild cycles
 # The built sources must not depend on the installed headers
-AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
+AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
 AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
@@ -40,7 +42,5 @@
 headers += concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
 
-libobjs = ${headers:.hfa=.o}
-libsrc = prelude.c startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa \
-	${headers:.hfa=.cfa}
+libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa}
 
 # not all platforms support concurrency, add option do disable it
@@ -49,7 +49,26 @@
 #----------------------------------------------------------------------------------------------------------------
 # add dependency to cfa-cpp so all libraries are rebuilt with new translator
-${libobjs} : ${cfalib_DATA}
+#@CFACC@ @CFACPP@ prelude.cf
 
-libcfa_a_SOURCES = ${libsrc}
+# add dependency of cfa files
+libobjs = $(addsuffix .o, $(basename $(filter %.cfa,$(libsrc))))
+$(libobjs) : @CFACC@ @CFACPP@ prelude.cf
+
+
+# .deps inclusion is not done automatically by automake for new languages
+libdeps = $(join \
+	$(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \
+	$(notdir ${libobjs:.o=.Po}) \
+)
+
+-include $(libdeps)
+
+prelude.o : prelude.cf extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
+	${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -in-tree -XCFA -l ${<} -c -o ${@}
+
+
+
+#----------------------------------------------------------------------------------------------------------------
+libcfa_a_SOURCES = prelude.o ${libsrc}
 
 stdhdr = ${shell find ${srcdir}/stdhdr -type f -printf "%p "}
@@ -69,7 +88,10 @@
 	concurrency/invoke.h
 
-MOSTLYCLEANFILES = prelude.c
-
 #----------------------------------------------------------------------------------------------------------------
 maintainer-clean-local:
 	-rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
+
+
+# $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+# 	$(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+# 	$(am__mv) $$depbase.Tpo $$depbase.Po
Index: libcfa/src/Makefile.in
===================================================================
--- libcfa/src/Makefile.in	(revision bcb14b51a0d19c902bee4aabf5540dbf405e490e)
+++ libcfa/src/Makefile.in	(revision a9fb796f56bcdcc50c4cfcea5f2ae6641c3b82b2)
@@ -19,5 +19,4 @@
 
 
-VPATH = @srcdir@
 am__is_gnu_make = { \
   if test -z '$(MAKELEVEL)'; then \
@@ -147,8 +146,7 @@
 	concurrency/kernel.$(OBJEXT) concurrency/monitor.$(OBJEXT) \
 	concurrency/mutex.$(OBJEXT)
-am__objects_2 = prelude.$(OBJEXT) startup.$(OBJEXT) \
-	interpose.$(OBJEXT) bits/debug.$(OBJEXT) assert.$(OBJEXT) \
-	exception.$(OBJEXT) virtual.$(OBJEXT) heap.$(OBJEXT) \
-	$(am__objects_1) \
+am__objects_2 = startup.$(OBJEXT) interpose.$(OBJEXT) \
+	bits/debug.$(OBJEXT) assert.$(OBJEXT) exception.$(OBJEXT) \
+	virtual.$(OBJEXT) heap.$(OBJEXT) $(am__objects_1) \
 	concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT) \
 	concurrency/alarm.$(OBJEXT) concurrency/invoke.$(OBJEXT) \
@@ -220,4 +218,5 @@
 	$(top_srcdir)/./automake/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+VPATH = @srcdir@ :../prelude
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -328,5 +327,5 @@
 
 # create object files in directory with source files
-AUTOMAKE_OPTIONS = subdir-objects
+AUTOMAKE_OPTIONS = foreign subdir-objects
 ARFLAGS = cr
 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -341,5 +340,5 @@
 # use -no-include-stdhdr to prevent rebuild cycles
 # The built sources must not depend on the installed headers
-AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
+AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
 AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
@@ -354,12 +353,27 @@
 	concurrency/thread.hfa concurrency/kernel.hfa \
 	concurrency/monitor.hfa concurrency/mutex.hfa
-libobjs = ${headers:.hfa=.o}
 
 # not all platforms support concurrency, add option do disable it
-libsrc = prelude.c startup.cfa interpose.cfa bits/debug.cfa assert.cfa \
+libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa \
 	exception.c virtual.c heap.cfa ${headers:.hfa=.cfa} \
 	concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
 	concurrency/invoke.c concurrency/preemption.cfa
-libcfa_a_SOURCES = ${libsrc}
+
+#----------------------------------------------------------------------------------------------------------------
+# add dependency to cfa-cpp so all libraries are rebuilt with new translator
+#@CFACC@ @CFACPP@ prelude.cf
+
+# add dependency of cfa files
+libobjs = $(addsuffix .o, $(basename $(filter %.cfa,$(libsrc))))
+
+# .deps inclusion is not done automatically by automake for new languages
+libdeps = $(join \
+	$(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \
+	$(notdir ${libobjs:.o=.Po}) \
+)
+
+
+#----------------------------------------------------------------------------------------------------------------
+libcfa_a_SOURCES = prelude.o ${libsrc}
 stdhdr = ${shell find ${srcdir}/stdhdr -type f -printf "%p "}
 cfa_includedir = $(CFA_INCDIR)
@@ -377,5 +391,4 @@
 	concurrency/invoke.h
 
-MOSTLYCLEANFILES = prelude.c
 all: all-am
 
@@ -506,5 +519,4 @@
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prelude.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.Po@am__quote@
@@ -676,5 +688,4 @@
 	fi
 mostlyclean-generic:
-	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
@@ -784,12 +795,14 @@
 
 
-.cfa.o: $(CFACC) $(CFACPP)
+.cfa.o:
 	$(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
 	$(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
 	$(am__mv) $$depbase.Tpo $$depbase.Po
-
-#----------------------------------------------------------------------------------------------------------------
-# add dependency to cfa-cpp so all libraries are rebuilt with new translator
-${libobjs} : ${cfalib_DATA}
+$(libobjs) : @CFACC@ @CFACPP@ prelude.cf
+
+-include $(libdeps)
+
+prelude.o : prelude.cf extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
+	${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -in-tree -XCFA -l ${<} -c -o ${@}
 
 #----------------------------------------------------------------------------------------------------------------
@@ -797,4 +810,8 @@
 	-rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
 
+# $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+# 	$(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+# 	$(am__mv) $$depbase.Tpo $$depbase.Po
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
