shithub: minivmac

ref: d7ad068d56bdec30805a36a9973f5924ad00641b
dir: /setup/WRCCCFLS.i/

View raw version
/*
	WRCCCFLS.i
	Copyright (C) 2007 Paul C. Pratt

	You can redistribute this file and/or modify it under the terms
	of version 2 of the GNU General Public License as published by
	the Free Software Foundation.  You should have received a copy
	of the license along with this file; see the file COPYING.

	This file is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	license for more details.
*/

/*
	WRite generic Command line C Compiler specific FiLeS
*/


LOCALPROC WriteCccMakeFile(void)
{
	WriteDestFileLn("# make file generated by gryphel build system");

	WriteBlankLineToDestFile();

	WriteDestFileLn("mk_COptions = -c");
	WriteCStrToDestFile(" -I");
	Write_cfg_d_ToDestFile();
	WriteCStrToDestFile(" -I");
	Write_src_d_ToDestFile();
	WriteBlankLineToDestFile();

	WriteBgnDestFileLn();
	WriteCStrToDestFile("TheDefaultOutput : ");
	Write_machobinpath_ToDestFile();
	WriteEndDestFileLn();

	WriteBlankLineToDestFile();
	DoAllSrcFilesWithSetup(DoSrcFileMakeCompile);
	WriteBlankLineToDestFile();
	WriteBgnDestFileLn();
	WriteCStrToDestFile("ObjFiles = ");
	WriteBackSlashToDestFile();
	WriteEndDestFileLn();
	++DestFileIndent;
		DoAllSrcFilesStandardMakeObjects();
		WriteBlankLineToDestFile();
	--DestFileIndent;
	WriteBlankLineToDestFile();
	WriteBgnDestFileLn();
	Write_machobinpath_ToDestFile();
	WriteCStrToDestFile(" : $(ObjFiles)");
	WriteEndDestFileLn();
	++DestFileIndent;
		WriteDestFileLn("cc \\");
		++DestFileIndent;
			WriteBgnDestFileLn();
			WriteCStrToDestFile("-o ");
			WriteQuoteToDestFile();
			Write_machobinpath_ToDestFile();
			WriteQuoteToDestFile();
			WriteCStrToDestFile(" \\");
			WriteEndDestFileLn();

			WriteBgnDestFileLn();
			WriteCStrToDestFile("$(ObjFiles)");
#if 0
			WriteCStrToDestFile(" -lXext");
#endif
			WriteCStrToDestFile(" -L/usr/X11R6/lib -lX11");
			WriteEndDestFileLn();
		--DestFileIndent;
	--DestFileIndent;

	WriteBlankLineToDestFile();
	WriteDestFileLn("clean :");
	++DestFileIndent;
		WriteDestFileLn("rm -f $(ObjFiles)");
		WriteRmFile(WriteAppNamePath);
	--DestFileIndent;
}

LOCALPROC WriteCccSpecificFiles(void)
{
	WriteADstFile1("my_project_d",
		"Makefile", "", "Make file",
		WriteCccMakeFile);
}

LOCALPROC Write9pcMkFile(void)
{
	WriteDestFileLn("# mkfile generated by gryphel build system");

	WriteBlankLineToDestFile();

	WriteDestFileLn("</$objtype/mkfile");
	WriteBlankLineToDestFile();

	WriteDestFileLn("BIN=/$objtype/bin/games");
	WriteDestFileLn("CFLAGS=-p -D__plan9__ -Icfg -Isrc $CFLAGS");

	WriteBgnDestFileLn();
	WriteCStrToDestFile("TARG=");
	Write_machobinpath_ToDestFile();
	WriteEndDestFileLn();

	WriteBlankLineToDestFile();
	DoAllSrcFilesWithSetup(DoSrcFileMakeCompile);
	WriteBlankLineToDestFile();

	WriteBgnDestFileLn();
	WriteCStrToDestFile("OFILES=");
	WriteBackSlashToDestFile();
	WriteEndDestFileLn();
	++DestFileIndent;
		DoAllSrcFilesStandardMakeObjects();
		WriteBlankLineToDestFile();
	--DestFileIndent;

	WriteDestFileLn("$TARG: $OFILES");
	++DestFileIndent;
		WriteDestFileLn("$LD -o $target $OFILES");
	--DestFileIndent;
	WriteBlankLineToDestFile();

	WriteDestFileLn("default:V: $TARG");
	WriteBlankLineToDestFile();

	WriteDestFileLn("</sys/src/cmd/mkone");
}

LOCALPROC Write9pcSpecificFiles(void)
{
	WriteADstFile1("my_project_d",
		"mkfile", "", "mk file",
		Write9pcMkFile);
}