Generate proper header dependency graph with Jmk2
diff --git a/bin/jmk2 b/bin/jmk2
index c22e9cf..4bb9e1c 100755
--- a/bin/jmk2
+++ b/bin/jmk2
@@ -9,10 +9,17 @@
 
 disable_gtags=false
 
-while getopts "hD:" arg; do
+cc=cc
+ld=ld
+asm=as
+
+while getopts "hD:c:a:l:" arg; do
     case $arg in
 	h) echo "Please read the JMK manual for more information." ;;
 	D) options="$options $(echo $OPTARG | sed 's/=/ /')" ;;
+	c) cc="$OPTARG" ;;
+	a) ld="$OPTARG" ;;
+	l) asm="$OPTARG" ;;
 	?) echo "Invalid argument"
 	   exit 1 ;;
     esac
@@ -25,6 +32,9 @@
     outdir="$(dirname $file)"
 	cat - $file << EOF | tclsh - $options > "$outdir/Makefile"
 source {$root/share/jmk/jmk.tcl}
+set cc {$cc}
+set ld {$ld}
+set asm {$asm}
 set root {$root}
 set jmk_build_cmd {$0}
 set jmk_build_dir {$(pwd)}
diff --git a/doc/jmk.rst b/doc/jmk.rst
index 224abc8..e97efca 100644
--- a/doc/jmk.rst
+++ b/doc/jmk.rst
@@ -11,7 +11,9 @@
 The script ``bin/jmk2`` looks in the source tree for ``Jmk2`` files,
 and process each one into the corresponding Makefile. It accepts
 option definitions with the ``-D`` flag, eg ``./bin/jmk2
--DSOME_OPTION=123``.
+-DSOME_OPTION=123``. You can also specify the C compiler, assembler,
+and linker to use with the ``-c``, ``-a``, and ``-l`` flags,
+respectively.
 
 Here is an example Jmk2 file:
 
diff --git a/share/jmk/jmk.tcl b/share/jmk/jmk.tcl
index 64b9afd..89e775c 100644
--- a/share/jmk/jmk.tcl
+++ b/share/jmk/jmk.tcl
@@ -148,6 +148,23 @@
 		set src [file join [pwd] $src]
 		variable obj [regsub -- {(.+)\.\w+} $src {\1.o}]
 		set ::objs "$::objs $obj"
+
+		if {[string match *.c $src]} {
+			variable cc $::cc
+			if {[string match *distcc* $cc]} {
+				variable cc [regsub -- {.*distcc +(.+)$} $cc {\1}]
+			}
+
+			if {[file exists $src]} {
+				puts [exec sh -c "$cc $src -MM -MT $obj $::cflags"]
+			} else {
+				rule $obj $src {}
+			}
+
+			log CC [file normalize $src]
+			cc "-c $::first_src -o $::target"
+			puts ""
+		}
 	}
 }
 
@@ -196,10 +213,10 @@
 }
 
 proc helpers {} {
-	rule .c.o {} {
-		log CC $::first_src
-		cc "-c $::first_src -o $::target"
-	}
+	# rule .c.o {} {
+	# 	log CC $::first_src
+	# 	cc "-c $::first_src -o $::target"
+	# }
 
 	rule .s.o {} {
 		log ASM $::first_src
diff --git a/src/kernel/x86_32/x86_32.jmk b/src/kernel/x86_32/x86_32.jmk
index 875331c..9a67295 100644
--- a/src/kernel/x86_32/x86_32.jmk
+++ b/src/kernel/x86_32/x86_32.jmk
@@ -22,7 +22,7 @@
 	tss_flush.s \
 	idt.s \
 	log.c \
-	irq.c \
+	irq.s \
 	pic.c \
 	timer.c \
 	paging.c \