-- $Source$
-- $State$
-- $Revision$

local d = ROOTDIR.."plat/cpm/"

include (d.."libsys/pmfile")

local bootsector = ackfile {
	file (d.."boot.s"),
	install = pm.install("%BINDIR%lib/cpm/boot.o"),
}

local descr = group {
	install = pm.install(d.."descr", "%BINDIR%%PLATIND%/%PLATFORM%/descr")
}

local headers = group {
	install = {
		pm.install(d.."include/ack/config.h", "%BINDIR%%PLATIND%/%PLATFORM%/include/ack/config.h"),
		pm.install(d.."include/unistd.h",     "%BINDIR%%PLATIND%/%PLATFORM%/include/unistd.h"),
		pm.install(d.."include/cpm.h",        "%BINDIR%%PLATIND%/%PLATFORM%/include/cpm.h"),
	}
}

platform_cpm = group {
	ARCH = "i80",
	PLATFORM = "cpm",
	OPTIMISATION = "-O",
	
	-- Ensure the descr and headers are installed first because we'll need
	-- them to build the libraries.
	
	descr,
	headers,
	
	-- Build the back-end support.
	
	mach_i80,
	support_i80,
	lang_runtimes,

	-- Build the CP/M syscall library.
	
	libsys_cpm,
	bootsector,
}