Index: Makefile.am
===================================================================
--- Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -21,5 +21,5 @@
 
 SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
-DIST_SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@ benchmark longrun_tests tests tools tools/prettyprinter
+DIST_SUBDIRS = driver src . libcfa benchmark longrun_tests tests tools tools/prettyprinter
 
 @LIBCFA_TARGET_MAKEFILES@ : Makefile $(srcdir)/libcfa/configure
@@ -33,4 +33,6 @@
 
 man1_MANS = doc/man/cfa.1
+
+EXTRA_DIST = LICENSE doc/man/cfa.1 libcfa/configure automake
 
 debug=yes
Index: libcfa/Makefile.am
===================================================================
--- libcfa/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ libcfa/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -16,4 +16,4 @@
 
 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names
-ACLOCAL_AMFLAGS  = -I automake
+ACLOCAL_AMFLAGS  = -I ../automake
 SUBDIRS = prelude src      # order important
Index: libcfa/configure.ac
===================================================================
--- libcfa/configure.ac	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ libcfa/configure.ac	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -4,6 +4,6 @@
 AC_PREREQ([2.68])
 AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
-AC_CONFIG_AUX_DIR([automake])
-AC_CONFIG_MACRO_DIRS([automake])
+AC_CONFIG_AUX_DIR([../automake])
+AC_CONFIG_MACRO_DIRS([../automake])
 AM_SILENT_RULES([yes])
 
Index: libcfa/prelude/Makefile.am
===================================================================
--- libcfa/prelude/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ libcfa/prelude/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -17,9 +17,11 @@
 # create object files in directory with source files
 AUTOMAKE_OPTIONS = foreign subdir-objects
-ACLOCAL_AMFLAGS  = -I automake
+ACLOCAL_AMFLAGS  = -I ../automake
 
 # put into lib for now
 cfalibdir = ${CFA_LIBDIR}
 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c defines.hfa
+
+EXTRA_DIST = bootloader.cf builtins.c builtins.def extras.c extras.regx extras.regx2 prelude-gen.cc prototypes.awk prototypes.c prototypes.sed sync-builtins.cf
 
 CC = @LOCAL_CFACC@
Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ libcfa/src/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -17,5 +17,5 @@
 # create object files in directory with source files
 AUTOMAKE_OPTIONS = foreign subdir-objects
-ACLOCAL_AMFLAGS  = -I automake
+ACLOCAL_AMFLAGS  = -I ../automake
 
 include $(top_srcdir)/../tools/build/cfa.make
@@ -31,5 +31,5 @@
 # AM_CFAFLAGS for only cfa source
 # use -no-include-stdhdr to prevent rebuild cycles
-# The built sources must not depend on the installed headers
+# The built sources must not depend on the installed inst_headers_src
 AM_CFAFLAGS = -quiet -cfalib -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC -fexceptions -pthread @ARCH_FLAGS@ @CONFIG_CFLAGS@
@@ -39,31 +39,89 @@
 #----------------------------------------------------------------------------------------------------------------
 if BUILDLIB
-headers_nosrc = bitmanip.hfa exception.hfa math.hfa gmp.hfa time_t.hfa clock.hfa \
-		bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa \
-		containers/list.hfa containers/stackLockFree.hfa concurrency/iofwd.hfa
+inst_headers_nosrc = \
+	bitmanip.hfa \
+	clock.hfa \
+	exception.hfa \
+	gmp.hfa \
+	math.hfa \
+	time_t.hfa \
+	bits/align.hfa \
+	bits/containers.hfa \
+	bits/debug.hfa \
+	bits/defs.hfa \
+	bits/locks.hfa \
+	concurrency/iofwd.hfa \
+	containers/list.hfa \
+	containers/stackLockFree.hfa
 
-headers = common.hfa fstream.hfa heap.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa \
-		time.hfa stdlib.hfa parseargs.hfa \
-		containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
+inst_headers_src = \
+	common.hfa \
+	fstream.hfa \
+	heap.hfa \
+	iostream.hfa \
+	iterator.hfa \
+	limits.hfa \
+	parseargs.hfa \
+	rational.hfa \
+	stdlib.hfa \
+	time.hfa \
+	containers/maybe.hfa \
+	containers/pair.hfa \
+	containers/result.hfa \
+	containers/vector.hfa
 
-libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c ${headers:.hfa=.cfa}
+libsrc = ${inst_headers_src} ${inst_headers_src:.hfa=.cfa} \
+	assert.cfa \
+	bits/algorithm.hfa \
+	bits/debug.cfa \
+	exception.c \
+	exception.h \
+	interpose.cfa \
+	lsda.h \
+	startup.cfa \
+	startup.hfa \
+	virtual.c \
+	virtual.h
 
 # not all platforms support concurrency, add option do disable it
-thread_headers_nosrc = bits/random.hfa concurrency/invoke.h concurrency/kernel/fwd.hfa
+inst_thread_headers_nosrc = \
+	bits/random.hfa \
+	concurrency/invoke.h \
+	concurrency/kernel/fwd.hfa
 
-thread_headers = concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa \
-		concurrency/monitor.hfa concurrency/mutex.hfa
+inst_thread_headers_src = \
+	concurrency/coroutine.hfa \
+	concurrency/kernel.hfa \
+	concurrency/monitor.hfa \
+	concurrency/mutex.hfa \
+	concurrency/thread.hfa
 
-thread_libsrc = concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
-		concurrency/invoke.c concurrency/io.cfa concurrency/iocall.cfa \
-		concurrency/io/setup.cfa \
-		concurrency/kernel/startup.cfa concurrency/preemption.cfa \
-		concurrency/ready_queue.cfa concurrency/stats.cfa \
-		${thread_headers:.hfa=.cfa}
+thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \
+	bits/signal.hfa \
+	concurrency/alarm.cfa \
+	concurrency/alarm.hfa \
+	concurrency/CtxSwitch-@ARCHITECTURE@.S \
+	concurrency/invoke.c \
+	concurrency/io.cfa \
+	concurrency/io/setup.cfa \
+	concurrency/io/types.hfa \
+	concurrency/iocall.cfa \
+	concurrency/iofwd.hfa \
+	concurrency/kernel_private.hfa \
+	concurrency/kernel/startup.cfa \
+	concurrency/preemption.cfa \
+	concurrency/preemption.hfa \
+	concurrency/ready_queue.cfa \
+	concurrency/ready_subqueue.hfa \
+	concurrency/snzi.hfa \
+	concurrency/stats.cfa \
+	concurrency/stats.hfa \
+	concurrency/stats.hfa
+
 else
-headers =
-thread_headers =
-headers_nosrc =
-thread_headers_nosrc =
+inst_headers_src =
+inst_thread_headers_src =
+inst_headers_nosrc =
+inst_thread_headers_nosrc =
 libsrc =
 endif
@@ -125,5 +183,6 @@
 
 cfa_includedir = $(CFA_INCDIR)
-nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc} ${thread_headers} ${thread_headers_nosrc}
+nobase_cfa_include_HEADERS = ${stdhdr} ${inst_headers_src} ${inst_headers_nosrc} ${inst_thread_headers_src} ${inst_thread_headers_nosrc}
+EXTRA_DIST = stdhdr
 
 #----------------------------------------------------------------------------------------------------------------
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ src/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -68,5 +68,5 @@
 ___driver_cfa_cpp_SOURCES = $(SRC)
 ___driver_cfa_cpp_LDADD = -ldl $(LIBPROFILER) $(LIBTCMALLOC)
-EXTRA_DIST = include/cassert include/optional
+EXTRA_DIST = include/cassert include/optional BasicTypes-gen.cc
 
 AM_CXXFLAGS = @HOST_FLAGS@ -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I./Parser -I$(srcdir)/Parser -I$(srcdir)/include -DYY_NO_INPUT -O3 -g -std=c++14 $(TCMALLOCFLAG)
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ tests/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -67,5 +67,5 @@
 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
 # automake doesn't know we still need C/CPP rules so pretend like we have a C program
-_dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
+nodist__dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp
 
 #----------------------------------------------------------------------------------------------------------------
Index: tools/Makefile.am
===================================================================
--- tools/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ tools/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -21,8 +21,9 @@
 
 noinst_PROGRAMS = busy catchsig repeat watchdog
+EXTRA_DIST = build/distcc_hash build/push2dist.sh
 
-busy_SOURCES     = busy.c
-busy_LDFLAGS     = -pthread
-catchsig_SOURCES = catchsig.c
-repeat_SOURCES   = repeat.c
-watchdog_SOURCES = watchdog.c
+nodist_busy_SOURCES     = busy.c
+nodist_busy_LDFLAGS     = -pthread
+nodist_catchsig_SOURCES = catchsig.c
+nodist_repeat_SOURCES   = repeat.c
+nodist_watchdog_SOURCES = watchdog.c
Index: tools/prettyprinter/Makefile.am
===================================================================
--- tools/prettyprinter/Makefile.am	(revision 5339a87ca7689b734a2eb1d355830ea9713784a1)
+++ tools/prettyprinter/Makefile.am	(revision b7fe2e689f7d0cda2840a893f55ba1b825e03c45)
@@ -30,5 +30,5 @@
 tools_prettyprinter_PROGRAMS = pretty
 tools_prettyprinterdir = ../
-pretty_SOURCES = ${SRC}
+nodist_pretty_SOURCES = ${SRC}
 pretty_LDADD = ${LEXLIB} -ldl			# yywrap
 pretty_CXXFLAGS = -Wno-deprecated -Wall -DYY_NO_INPUT -O2 -g -std=c++14
