import os
import socketserver

import oldfart.handler
import oldfart.make

makefile = 'Makefile'
project_dir = os.path.abspath('example')
server_dir = os.path.join(project_dir, 'build', 'dist')
port = 8000

# NB: Enforce local loopback interface
host = '127.0.0.1'

maker = oldfart.make.Maker(project_dir, makefile)

Handler = oldfart.handler.make_http_request_handler_class('MakerHTTP', maker)

if not os.path.exists(server_dir):
    os.makedirs(server_dir)
os.chdir(server_dir)

httpd = socketserver.TCPServer((host, port), Handler)

print('Serving "{:s}" through {:s}:{:d}'.format(server_dir, host, port))

httpd.serve_forever()

@@ -1,16 +1,32 @@
+import argparse%0A
 import os%0Aimport
@@ -84,24 +84,76 @@
 t.make%0A%0A
+default_project_dir = os.path.abspath('.')%0A%0Adefault_
 makefile
  = 'Make
@@ -144,16 +144,21 @@
 makefile
+_path
  = 'Make
@@ -167,116 +167,817 @@
 le'%0A
-project_dir = os.path.abspath('example')%0Aserver_dir = os.path.join(project_dir, 'build', 'dist')%0Aport = 8000
+%0Adefault_server_dir = default_project_dir%0A%0Adefault_port = 8000%0A%0Aparser = argparse.ArgumentParser(description='Serve make(1) targets.')%0A%0Aopt = parser.add_argument%0A%0Aopt('--port', metavar='PORT', dest='port', type=int, default=default_port,%0A    help='Specify alternate port')%0A%0Aopt('--serve-from', metavar='DIR', dest='server_dir', type=str,%0A    default=default_server_dir, help='Serve resources from directory DIR')%0A%0Aopt('--project-dir', metavar='DIR', dest='project_dir', type=str,%0A    default=default_project_dir,%0A    help='Project is located in DIR. Make(1) is executed in the context of '%0A         'this directory')%0A%0Aopt('--makefile', metavar='PATH', dest='makefile_path', type=str,%0A    default=default_makefile_path,%0A    help='Path to Makefile relative to the project directory')%0A%0Aargs = parser.parse_args()
 %0A%0A# 
@@ -1060,16 +1060,21 @@
 e.Maker(
+args.
 project_
@@ -1078,24 +1078,29 @@
 ct_dir, 
+args.
 makefile
 )%0A%0AHandl
@@ -1091,16 +1091,21 @@
 makefile
+_path
 )%0A%0AHandl
@@ -1200,16 +1200,21 @@
 .exists(
+args.
 server_d
@@ -1234,16 +1234,21 @@
 akedirs(
+args.
 server_d
@@ -1260,16 +1260,21 @@
 s.chdir(
+args.
 server_d
@@ -1312,24 +1312,29 @@
 rver((host, 
+args.
 port), Handl
@@ -1386,16 +1386,21 @@
 .format(
+args.
 server_d
@@ -1408,17 +1408,70 @@
 r, host,
- 
+%0A                                                args.
 port))%0A%0A

Add command line arguments