-- $Source$
-- $State$

local d = ROOTDIR.."lang/m2/libm2/"

local headers = group {
	install = {
		pm.install(d.."Arguments.def", "%BINDIR%include/m2/Arguments.def"),
		pm.install(d.."ArraySort.def", "%BINDIR%include/m2/ArraySort.def"),
		pm.install(d.."ASCII.def", "%BINDIR%include/m2/ASCII.def"),
		pm.install(d.."Conversion.def", "%BINDIR%include/m2/Conversion.def"),
		pm.install(d.."CSP.def", "%BINDIR%include/m2/CSP.def"),
		pm.install(d.."EM.def", "%BINDIR%include/m2/EM.def"),
		pm.install(d.."Epilogue.def", "%BINDIR%include/m2/Epilogue.def"),
		pm.install(d.."InOut.def", "%BINDIR%include/m2/InOut.def"),
		pm.install(d.."MathLib0.def", "%BINDIR%include/m2/MathLib0.def"),
		pm.install(d.."Mathlib.def", "%BINDIR%include/m2/Mathlib.def"),
		pm.install(d.."PascalIO.def", "%BINDIR%include/m2/PascalIO.def"),
		pm.install(d.."Processes.def", "%BINDIR%include/m2/Processes.def"),
		pm.install(d.."random.def", "%BINDIR%include/m2/random.def"),
		pm.install(d.."RealConver.def", "%BINDIR%include/m2/RealConver.def"),
		pm.install(d.."RealInOut.def", "%BINDIR%include/m2/RealInOut.def"),
		pm.install(d.."Semaphores.def", "%BINDIR%include/m2/Semaphores.def"),
		pm.install(d.."Storage.def", "%BINDIR%include/m2/Storage.def"),
		pm.install(d.."Streams.def", "%BINDIR%include/m2/Streams.def"),
		pm.install(d.."Strings.def", "%BINDIR%include/m2/Strings.def"),
		pm.install(d.."StripUnix.def", "%BINDIR%include/m2/StripUnix.def"),
		pm.install(d.."Termcap.def", "%BINDIR%include/m2/Termcap.def"),
--		pm.install(d.."Terminal.def", "%BINDIR%include/m2/Terminal.def"),
		pm.install(d.."Traps.def", "%BINDIR%include/m2/Traps.def"),
		pm.install(d.."Unix.def", "%BINDIR%include/m2/Unix.def"),
		pm.install(d.."XXTermcap.def", "%BINDIR%include/m2/XXTermcap.def"),
	}
}

local head = ackfile {
	file (d.."head_m2.e"),
	
	install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/modula2.o")
}

local tail = acklibrary {
	ackfile (d.."Termcap.mod"),
	ackfile (d.."CSP.mod"),
	ackfile (d.."PascalIO.mod"),
	ackfile (d.."RealInOut.mod"),
	ackfile (d.."InOut.mod"),
	ackfile (d.."Streams.mod"),
--	ackfile (d.."Terminal.mod"),
	ackfile (d.."MathLib0.mod"),
	ackfile (d.."Mathlib.mod"),
	ackfile (d.."Processes.mod"),
	ackfile (d.."RealConver.mod"),
	ackfile (d.."Storage.mod"),
	ackfile (d.."Conversion.mod"),
	ackfile (d.."Semaphores.mod"),
	ackfile (d.."random.mod"),
	ackfile (d.."Strings.mod"),
	ackfile (d.."ArraySort.mod"),
	ackfile (d.."catch.c"),
	ackfile (d.."Traps.mod"),
	ackfile (d.."XXTermcap.c"),
	ackfile (d.."dvi.c"),
	ackfile (d.."Arguments.c"),
	ackfile (d.."LtoUset.e"),
	ackfile (d.."StrAss.c"),
	ackfile (d.."cap.c"),
	ackfile (d.."absd.c"),
	ackfile (d.."absf.e"),
	ackfile (d.."absi.c"),
	ackfile (d.."absl.c"),
	ackfile (d.."halt.c"),
	ackfile (d.."SYSTEM.c"),
	ackfile (d.."par_misc.e"),
	ackfile (d.."init.c"),
	ackfile (d.."sigtrp.c"),
	ackfile (d.."store.c"),
	ackfile (d.."confarray.c"),
	ackfile (d.."load.c"),
	ackfile (d.."blockmove.c"),
	ackfile (d.."stackprio.c"),
	ackfile (d.."ucheck.c"),
	ackfile (d.."rcka.c"),
	ackfile (d.."rcku.c"),
	ackfile (d.."rcki.c"),
	ackfile (d.."rckul.c"),
	ackfile (d.."rckil.c"),
	ackfile (d.."EM.e"),
	
	install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libmodula2.a")
}

lang_m2_runtime = acklibrary {
	ACKINCLUDES = {PARENT, "%ROOTDIR%h"},
	
	headers,
	head,
	tail
}
