-- $Source$
-- $State$

local d = ROOTDIR.."util/opt/"

local cfile_with_headers = cfile {
	class = "cfile_with_headers",
	dynamicheaders = {
		file (d),
	}
}

local local_tool_opt = cprogram {
	class = "opt_rule",
	
	cfile_with_headers (d.."main.c"),
	cfile_with_headers (d.."getline.c"),
	cfile_with_headers (d.."lookup.c"),
	cfile_with_headers (d.."var.c"),
	cfile_with_headers (d.."process.c"),
	cfile_with_headers (d.."backward.c"),
	cfile_with_headers (d.."util.c"),
	cfile_with_headers (d.."alloc.c"),
	cfile_with_headers (d.."putline.c"),
	cfile_with_headers (d.."cleanup.c"),
	cfile_with_headers (d.."peephole.c"),
	cfile_with_headers (d.."flow.c"),
	cfile_with_headers (d.."tes.c"),
	cfile_with_headers (d.."reg.c"),	
	
	cfile_with_headers {
		simple {
			outputs = {"%U%-pop_push.c"},
			command = {
				"awk -f %in[1]% < %in[2]% > %out%"
			},
			
			file (d.."pop_push.awk"),
			file (ROOTDIR.."etc/em_table")
		}
	},

	cfile_with_headers {
		simple {
			outputs = {"%U%-pattern.c"},
			command = {
				"%in[1]% %in[2]% > %out%"
			},

			cprogram {
				CLIBRARIES = {PARENT, "fl"},
				
				cfile {
					yacc {
						file (d.."mktab.y")
					},
					
					dynamicheaders = {
						file (d),
						flex {
							file (d.."scan.l")
						}
					},
				},
				
				lib_em_data,
			},

			file (d.."patterns")
		}
	},

	lib_em_data,
	lib_assert,
	lib_print,
	lib_alloc,
	lib_system,
	lib_string,
	
	outputs = {"%U%/em_opt"},
}

tool_opt = group {
	group {
		local_tool_opt,
		install = pm.install(BINDIR.."lib.bin/em_opt")
	},
	
	group {
		CDEFINES = {PARENT, "GLOBAL_OPT"},
		local_tool_opt,
		install = pm.install(BINDIR.."lib.bin/em_opt2")
	},
}

-- Revision history
-- $Log$
-- Revision 1.3  2006-10-15 00:28:12  dtrg
-- Updated to the version 0.1 of Prime Mover (which involves some syntax changes).
--
-- Revision 1.2  2006/07/20 23:10:07  dtrg
-- Fixed revision history.
--