diff --git a/Makefile b/Makefile
index dded5a3..81a964b 100644
--- a/Makefile
+++ b/Makefile
@@ -127,7 +127,7 @@ WEAVE=${WEAVE} \
 XLIB=${XLIB} \
 ZIPS=${ZIPS} 
 
-all: noweb ${MNT}/${SYS}/bin/document
+all: tangle noweb ${MNT}/${SYS}/bin/document
 	@ echo p1 making a parallel system build
 	@ echo 1 making a ${SYS} system, PART=${PART} SUBPART=${SUBPART}
 	@ echo 2 Environment ${ENV}
@@ -220,6 +220,10 @@ book:
 	  rm book.aux )
 	@ echo 80 The book is at ${MNT}/${SYS}/doc/book.dvi 
 
+tangle: books/tangle.c
+	@echo t01 making tangle from tangle.c
+	@( cd books ; gcc -o tangle tangle.c )
+
 noweb:
 	@echo 13 making noweb
 	@mkdir -p ${OBJ}/noweb
@@ -306,4 +310,5 @@ clean:
 	@ for i in `find src -name "Makefile"` ; do rm -f $$i ; done
 	@ for i in `find src -name "Makefile.dvi"` ; do rm -f $$i ; done
 	@ rm -f lastBuildDate
+	@ rm -f books/tangle
 
diff --git a/Makefile.pamphlet b/Makefile.pamphlet
index 84b6601..7a0f542 100644
--- a/Makefile.pamphlet
+++ b/Makefile.pamphlet
@@ -163,6 +163,7 @@ clean:
 	@ for i in `find src -name "Makefile"` ; do rm -f $$i ; done
 	@ for i in `find src -name "Makefile.dvi"` ; do rm -f $$i ; done
 	@ rm -f lastBuildDate
+	@ rm -f books/tangle
 
 @
 
@@ -549,6 +550,15 @@ book:
 	@ echo 80 The book is at ${MNT}/${SYS}/doc/book.dvi 
 
 @
+\subsection{tangle.c}
+<<tangle.c>>=
+
+tangle: books/tangle.c
+	@echo t01 making tangle from tangle.c
+	@( cd books ; gcc -o tangle tangle.c )
+
+@
+
 \subsection{noweb}
 
 Note that this stanza echos a line into a file called noweb.
@@ -965,6 +975,7 @@ all: rootdirs noweb srcsetup lspdir srcdir
 	@- grep "result FAILED" int/input/*.regress
 
 <<rootdirs>>
+<<tangle.c>>
 <<noweb>>
 <<literate commands>>
 <<srcsetup>>
diff --git a/books/tangle.c b/books/tangle.c
new file mode 100644
index 0000000..b4008ea
--- /dev/null
+++ b/books/tangle.c
@@ -0,0 +1,158 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+
+#define DEBUG 0
+
+/* forward reference for the C compiler */
+int getchunk(char *chunkname);
+
+/* a memory mapped buffer copy of the file */
+char *buffer;
+int bufsize;
+
+/* return the length of the next line */
+int nextline(int i) {
+  int j;
+  if (i >= bufsize) return(-1);
+  for (j=0; ((i+j < bufsize) && (buffer[i+j] != '\n')); j++);
+  return(j);
+}
+
+/* output the line we need */
+int printline(int i, int length) {
+  int j;
+  for (j=0; j<length; j++) { putchar(buffer[i+j]); }
+  printf("\n");
+}
+
+/* handle begin{chunk}{chunkname}        */
+/* is this chunk name we are looking for? */
+int foundchunk(int i, char *chunkname) {
+  if ((strncmp(&buffer[i+14],chunkname,strlen(chunkname)) == 0) &&
+      (buffer[i+13] == '{') &&
+      (buffer[i+14+strlen(chunkname)] == '}')) return(1);
+  return(0);
+}
+
+/* handle end{chunk}   */
+/* is it really an end? */
+int foundEnd(int i) {
+  if ((buffer[i] == '\\') && 
+      (strncmp(&buffer[i+1],"end{chunk}",10) == 0)) {
+    return(1); 
+  }
+  return(0);
+}
+
+/* handle getchunk{chunkname} */
+/* is this line a getchunk?    */
+int foundGetchunk(int i, int linelen) {
+  int len;
+  if (strncmp(&buffer[i],"\\getchunk{",10) == 0) {
+    for(len=0; ((len < linelen) && (buffer[i+len] != '}')); len++);
+    return(len-10);
+  }
+  return(0);
+}
+
+/* Somebody did a getchunk and we need a copy of the name */
+/* malloc string storage for a copy of the getchunk name  */
+char *getChunkname(int k, int getlen) {
+  char *result = (char *)malloc(getlen+1);
+  strncpy(result,&buffer[k+10],getlen);
+  result[getlen]='\0';
+  return(result);
+}
+  
+/* print lines in this chunk, possibly recursing into getchunk */
+int printchunk(int i, int chunklinelen, char *chunkname) {
+  int j;
+  int k;
+  int linelen;
+  char *getname;
+  int getlen = 0;
+  for (k=i+chunklinelen+1; ((linelen=nextline(k)) != -1); ) {
+    if (DEBUG==2) { 
+      printf(">>>>"); printline(k,linelen); printf("<<<<\n"); 
+    }
+    if ((getlen=foundGetchunk(k,linelen)) > 0) {
+       getname = getChunkname(k,getlen);
+       getchunk(getname);
+       free(getname);
+       k=k+getlen+12l;
+    } else {
+    if ((linelen >= 11) && (foundEnd(k) == 1)) {
+      if (DEBUG) { printf("=================\\end{%s}\n",chunkname); }
+      return(k+12);
+    } else {
+      if (DEBUG==2) { 
+        printf("======== printchunk else %d %d\n",k,linelen); 
+      }
+      printline(k,linelen);
+      k=k+linelen+1;
+    }
+  }}
+  if (DEBUG==2) {
+     printf("=================\\out{%s} %d\n",chunkname,k); 
+  }
+  return(k);
+}
+
+/* find the named chunk and call printchunk on it */
+int getchunk(char *chunkname) {
+  int i;
+  int j;
+  int linelen;
+  int chunklen = strlen(chunkname);
+  for (i=0; ((linelen=nextline(i)) != -1); ) {
+    if (DEBUG==2) { 
+      printf("----"); printline(i,linelen); printf("----\n"); 
+    }
+    if ((linelen >= chunklen+15) && (foundchunk(i,chunkname) == 1)) {
+      if (DEBUG) {
+         fprintf(stderr,"=================\\getchunk(%s)\n",chunkname); 
+      }
+      i=printchunk(i,linelen,chunkname);
+    } else {
+      i=i+linelen+1;
+    }
+  }
+  if (DEBUG) { 
+    fprintf(stderr,"=================getchunk returned=%d\n",i); 
+  }
+  return(i);
+}
+
+/* memory map the input file into the global buffer and get the chunk */
+int main(int argc, char *argv[]) {
+  int fd;
+  struct stat filestat;
+  if ((argc < 2) || (argc > 3)) { 
+    perror("Usage: tangle filename chunkname");
+    exit(-1);
+  }
+  fd = open(argv[1],O_RDONLY);
+  if (fd == -1) {
+    perror("Error opening file for reading");
+    exit(-2);
+  }
+  if (fstat(fd,&filestat) < 0) {
+    perror("Error getting input file size");
+    exit(-3);
+  }
+  bufsize = (int)filestat.st_size;
+  buffer = mmap(0,filestat.st_size,PROT_READ,MAP_SHARED,fd,0);
+  if (buffer == MAP_FAILED) {
+    close(fd);
+    perror("Error reading the file");
+    exit(-4);
+  }
+  getchunk(argv[2]);
+  close(fd);
+  return(0);
+}
+
diff --git a/changelog b/changelog
index 2655c9f..5bfe02f 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,6 @@
+20140623 tpd src/axiom-website/patches.html 20140623.05.tpd.patch
+20140623 tpd Makefile set up a native tangle function
+20140623 tpd books/tangle.c set up a native tangle function
 20140623 tpd src/axiom-website/patches.html 20140623.04.tpd.patch
 20140623 tpd src/scripts/showdvi removed
 20140623 tpd src/scripts/boxup removed
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index 37f8d7f..fe7b36e 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -4492,6 +4492,9 @@ books/bookvolbib.pamphlet add Baez09
 src/axiom-website/download.html add texlive-fonts-extra
 <a href="patches/20140623.04.tpd.patch">20140623.04.tpd.patch</a>
 src/scripts/boxhead, boxtail, boxup, showdvi removed
+<a href="patches/20140623.05.tpd.patch">20140623.05.tpd.patch</a>
+Makefile, books/tangle.c set up a native tangle function
+
  </body>
 </html>
 
